Gnash  0.8.10
Public Types | Public Member Functions | Protected Member Functions
gnash::MovieClip Class Reference

A MovieClip is a container for DisplayObjects. More...

#include <MovieClip.h>

Inheritance diagram for gnash::MovieClip:
gnash::DisplayObjectContainer gnash::InteractiveObject gnash::DisplayObject gnash::GcResource gnash::Movie gnash::BitmapMovie gnash::SWFMovie

List of all members.

Public Types

enum  PlayState { PLAYSTATE_PLAY, PLAYSTATE_STOP }
enum  VariablesMethod { METHOD_NONE = 0, METHOD_GET, METHOD_POST }
 The various methods for sending data in requests. More...
typedef std::vector< TextField * > TextFields
typedef std::map< ObjectURI,
TextFields,
ObjectURI::LessThan
TextFieldIndex
 A container for textfields, indexed by their variable name.
typedef std::map< std::string,
std::string > 
MovieVariables
typedef movie_definition::PlayList PlayList

Public Member Functions

 MovieClip (as_object *object, const movie_definition *def, Movie *root, DisplayObject *parent)
 Construct a MovieClip instance.
virtual ~MovieClip ()
virtual Movieget_root () const
 Return the relative root of this DisplayObject.
virtual bool trackAsMenu ()
 ActionScript property of Buttons and MovieClips altering mouse handling.
void queueEvent (const event_id &id, int lvl)
 Queue event in the global action queue.
void queueLoad ()
virtual MovieClipgetAsRoot ()
 Return the _root ActionScript property of this sprite.
virtual SWFRect getBounds () const
 Get the composite bounds of all component drawing elements.
virtual bool pointInShape (boost::int32_t x, boost::int32_t y) const
 Return true if the given point falls in this DisplayObject's shape.
virtual bool pointInVisibleShape (boost::int32_t x, boost::int32_t y) const
 true if the given point falls in this DisplayObject's visible shape
virtual bool pointInHitableShape (boost::int32_t x, boost::int32_t y) const
size_t get_current_frame () const
 Return 0-based index to current frame.
size_t get_frame_count () const
size_t get_loaded_frames () const
 Return number of completely loaded frames of this sprite/movie.
size_t get_bytes_total () const
size_t get_bytes_loaded () const
const SWFRectget_frame_size () const
DSOEXPORT void setPlayState (PlayState s)
 Stop or play the sprite.
PlayState getPlayState () const
void set_background_color (const rgba &color)
virtual bool mouseEnabled () const
 Return true if we have any mouse event handlers.
virtual InteractiveObjecttopmostMouseEntity (boost::int32_t x, boost::int32_t y)
 Return the topmost entity that the given point covers that can receive mouse events. NULL if none. Coords are in parent's frame.
const DisplayObjectfindDropTarget (boost::int32_t x, boost::int32_t y, DisplayObject *dragging) const
 Point coordinates in global twips.
void setDropTarget (const std::string &tgt)
const std::string & getDropTarget () const
virtual void advance ()
 Advance to the next frame of the MovieClip.
DSOEXPORT void goto_frame (size_t target_frame_number)
 Set the sprite state at the specified frame number.
bool get_frame_number (const as_value &frame_spec, size_t &frameno) const
 Parse frame spec and return a 0-based frame number.
bool goto_labeled_frame (const std::string &label)
 Look up the labeled frame, and jump to it.
virtual void display (Renderer &renderer, const Transform &xform)
 Render this MovieClip.
void draw (Renderer &renderer, const Transform &xform)
 Draw this MovieClip.
void omit_display ()
void swapDepths (DisplayObject *ch1, int newdepth)
 Swap depth of the given DisplayObjects in the DisplayList.
DisplayObjectgetDisplayObjectAtDepth (int depth)
 Return the DisplayObject at given depth in our DisplayList.
DisplayObjectaddDisplayListObject (DisplayObject *obj, int depth)
 Attach a DisplayObject at the specified depth.
DisplayObjectadd_display_object (const SWF::PlaceObject2Tag *tag, DisplayList &dlist)
 Place a DisplayObject or mask to the DisplayList.
void move_display_object (const SWF::PlaceObject2Tag *tag, DisplayList &dlist)
 Proxy of DisplayList::moveDisplayObject()
void replace_display_object (const SWF::PlaceObject2Tag *tag, DisplayList &dlist)
 Proxy of DisplayList::replaceDisplayObject()
void remove_display_object (const SWF::PlaceObject2Tag *tag, DisplayList &dlist)
 Proxy of DisplayList::removeDisplayObject()
void remove_display_object (int depth, int)
 Remove the object at the specified depth.
void unloadMovie ()
void attachCharacter (DisplayObject &newch, int depth, as_object *initObject)
 Attach the given DisplayObject instance to current display list.
virtual void construct (as_object *initObj=0)
 Handle placement event.
void destroy ()
 Mark this sprite as destroyed.
void add_action_buffer (const action_buffer *a)
void execute_init_action_buffer (const action_buffer &a, int cid)
 Execute the given init action buffer, if not done yet for the target DisplayObject id.
void execute_action (const action_buffer &ab)
 Execute a single action buffer (DOACTION block)
MovieClipto_movie ()
virtual void getLoadedMovie (Movie *newMovie)
 Accept a loaded Movie.
void loadVariables (const std::string &urlstr, VariablesMethod sendVarsMethod)
 Load url-encoded variables from the given url, optionally sending variables from this timeline too.
bool getTextFieldVariables (const ObjectURI &uri, as_value &val)
 Get TextField variables.
bool setTextFieldVariables (const ObjectURI &uri, const as_value &val)
 TODO: this is also unlikely to be the best way to do it.
DisplayObjectgetDisplayListObject (const ObjectURI &uri)
 Search for a named object on the DisplayList.
as_objectpathElement (const ObjectURI &uri)
 Overridden to look in DisplayList for a match.
virtual void call_frame_actions (const as_value &frame_spec)
 Execute the actions for the specified frame.
MovieClipduplicateMovieClip (const std::string &newname, int newdepth, as_object *init_object=0)
 Duplicate this sprite in its timeline.
virtual void mouseEvent (const event_id &id)
 Called when a mouse event affects this MovieClip.
void notifyEvent (const event_id &id)
 Dispatch event handler(s), if any.
virtual as_environmentget_environment ()
 Return a reference to the variable scope of this DisplayObject.
void set_textfield_variable (const ObjectURI &name, TextField *ch)
 Set a TextField variable to this timeline.
void add_invalidated_bounds (InvalidatedRanges &ranges, bool force)
 Add the DisplayObject's invalidated bounds *to* the given ranges list.
const DisplayListgetDisplayList () const
int getNextHighestDepth () const
 Return the next highest available depth.
void setStreamSoundId (int id)
 Set the currently playing m_sound_stream_id.
void removeMovieClip ()
 Remove this sprite from the stage.
DynamicShapegraphics ()
 Direct access to the Graphics object for drawing.
virtual bool handleFocus ()
 Set focus to this MovieClip.
DSOEXPORT void setVariables (const MovieVariables &vars)
 Set all variables in the given map with their corresponding values.
virtual void visitNonProperties (KeyVisitor &v) const
 Enumerate child DisplayObjects.
void cleanupDisplayList ()
void queueAction (const action_buffer &buf)
 Queue the given action buffer.
void constructAsScriptObject ()
 Construct this instance as an ActionScript object.
bool getLockRoot () const
void setLockRoot (bool lr)
virtual int getDefinitionVersion () const
 Return the version of the SWF this MovieClip was parsed from.

Protected Member Functions

virtual bool unloadChildren ()
 Unload all contents in the displaylist and this instance.
virtual void markOwnResources () const
 Mark sprite-specific reachable resources.
void placeDisplayObject (DisplayObject *ch, int depth)

Detailed Description

A MovieClip is a container for DisplayObjects.

TODO: This class should inherit from Sprite In AS3 is it distinguished from a Sprite by having a timeline, i.e. more than one frame. In AS2, there is no Sprite class. There are basically two types of MovieClip: dynamic and non-dynamic. Dynamic clips are created using createEmptyMovieClip() or duplicateMovieClip(). Non-dynamic MovieClips are parsed from a SWF file. The isDynamic() member function is the only way to tell the difference (see following paragraph). The presence of a definition (the _def member) reveals whether the MovieClip was constructed with an immutable definition or not. MovieClips created using createEmptyMovieClip() have no definition. MovieClips constructed using duplicateMovieClip() have the same definition as the duplicated clip. They are "dynamic", but may have a definition! A MovieClip always has an _swf member. This is the top-level SWF (Movie) containing either the definition or the code from which the MovieClip was created. The _url member and SWF version are dependent on the _swf. Exports are also sought in this Movie.


Member Typedef Documentation

typedef std::map<std::string, std::string> gnash::MovieClip::MovieVariables

A container for textfields, indexed by their variable name.

typedef std::vector<TextField*> gnash::MovieClip::TextFields

Member Enumeration Documentation

Enumerator:
PLAYSTATE_PLAY 
PLAYSTATE_STOP 

The various methods for sending data in requests.

Used in loadMovie, getURL, loadVariables etc.

Enumerator:
METHOD_NONE 
METHOD_GET 
METHOD_POST 

Constructor & Destructor Documentation

gnash::MovieClip::MovieClip ( as_object object,
const movie_definition def,
Movie root,
DisplayObject parent 
)

Construct a MovieClip instance.

Parameters:
defPointer to the movie_definition this object is an instance of (may be a top-level movie or a sprite). This may be 0 if there is no immutable definition.
rootThe "relative" _swf of this sprite, which is the instance of top-level sprite defined by the same SWF that also contained *this* sprite definition. Note that this can be *different* from the top-level movie accessible through the VM, in case this sprite was defined in an externally loaded movie.
parentParent of the created instance in the display list. May be 0 for top-level movies (_level#).

References assert, and gnash::as_environment::set_target().

Referenced by duplicateMovieClip().

gnash::MovieClip::~MovieClip ( ) [virtual]

Member Function Documentation

void gnash::MovieClip::add_action_buffer ( const action_buffer a) [inline]

Add the given action buffer to the list of action buffers to be processed at the end of the next frame advance.

References queueAction(), and execute_action().

Referenced by gnash::SWF::DoActionTag::executeActions().

DisplayObject * gnash::MovieClip::add_display_object ( const SWF::PlaceObject2Tag tag,
DisplayList dlist 
)

Place a DisplayObject or mask to the DisplayList.

This method instantiates the given DisplayObject definition and places it on the stage at the given depth.

If the specified depth is already occupied, it results a no-ops. Otherwise, a new DisplayObject will be created and onload handler will be triggerred.

Parameters:
tagA swf defined placement tag (PlaceObject, or PlaceObject2, or PlaceObject3). No ownership transfer, the tag is still owned by the movie_definition class.
dlistThe display list to add the DisplayObject to.
Returns:
A pointer to the DisplayObject being added or NULL

References assert, gnash::DisplayObject::isDestroyed(), gnash::key::SWF, gnash::SWF::PlaceObject2Tag::getID(), IF_VERBOSE_MALFORMED_SWF, _, gnash::DisplayList::getDisplayObjectAtDepth(), gnash::SWF::DisplayListTag::getDepth(), gnash::getGlobal(), gnash::getObject(), gnash::getVM(), gnash::SWF::DefinitionTag::createDisplayObject(), gnash::SWF::PlaceObject2Tag::hasName(), gnash::DisplayObject::set_name(), gnash::getURI(), gnash::SWF::PlaceObject2Tag::getName(), gnash::isReferenceable(), gnash::DisplayObject::getNextUnnamedInstanceName(), gnash::SWF::PlaceObject2Tag::hasBlendMode(), gnash::SWF::PlaceObject2Tag::getBlendMode(), gnash::DisplayObject::setBlendMode(), gnash::SWF::PlaceObject2Tag::getEventHandlers(), gnash::key::i, gnash::key::n, gnash::DisplayObject::add_event_handler(), gnash::swf_event::event(), gnash::swf_event::action(), gnash::DisplayObject::setCxForm(), gnash::SWF::PlaceObject2Tag::getCxform(), gnash::DisplayObject::setMatrix(), gnash::SWF::PlaceObject2Tag::getMatrix(), gnash::DisplayObject::set_ratio(), gnash::SWF::PlaceObject2Tag::getRatio(), gnash::DisplayObject::set_clip_depth(), gnash::SWF::PlaceObject2Tag::getClipDepth(), gnash::DisplayList::placeDisplayObject(), and gnash::DisplayObject::construct().

Referenced by gnash::SWF::PlaceObject2Tag::executeState().

void gnash::MovieClip::add_invalidated_bounds ( InvalidatedRanges ranges,
bool  force 
) [virtual]

Add the DisplayObject's invalidated bounds *to* the given ranges list.

NOTE that this method should include the bounds that it covered the last time clear_invalidated() was called, as those need to be rerendered as well (to clear the region previously occupied by this DisplayObject).

That's why it returns the *union* of old_invalidated_ranges and the current bounds. The function is also used internally by set_invalidated() to update m_old_invalidated_ranges itself (you may notice some kind of circular reference), but that's no problem since old_invalidated_ranges is NULL during that call.

It is used to determine what area needs to be re-rendered. The coordinates are world coordinates (in TWIPS). Only instances with _invalidated flag set are checked unless force is set.

Add drawable.

Implements gnash::InteractiveObject.

References gnash::DisplayObject::visible(), gnash::invisible(), gnash::getCxForm(), gnash::geometry::SnappingRanges2d::add(), gnash::DisplayObject::m_old_invalidated_ranges, gnash::DisplayObject::invalidated(), gnash::DisplayObject::childInvalidated(), gnash::DisplayObjectContainer::_displayList, gnash::DisplayList::add_invalidated_bounds(), gnash::SWFRect::expand_to_transformed_rect(), gnash::getWorldMatrix(), gnash::DynamicShape::getBounds(), and gnash::SWFRect::getRange().

DisplayObject * gnash::MovieClip::addDisplayListObject ( DisplayObject obj,
int  depth 
)
void gnash::MovieClip::advance ( ) [virtual]
void gnash::MovieClip::attachCharacter ( DisplayObject newch,
int  depth,
as_object initObject 
)

Attach the given DisplayObject instance to current display list.

Parameters:
newchThe DisplayObject instance to attach.
depthThe depth to assign to the instance.

References gnash::DisplayObjectContainer::_displayList, gnash::DisplayList::placeDisplayObject(), and gnash::DisplayObject::construct().

void gnash::MovieClip::call_frame_actions ( const as_value frame_spec) [virtual]

Execute the actions for the specified frame.

The frame_spec could be an integer or a string.

References gnash::DisplayObject::isDestroyed(), get_frame_number(), IF_VERBOSE_ASCODING_ERRORS, _, gnash::getVM(), gnash::getObject(), gnash::key::e, and gnash::DisplayObjectContainer::_displayList.

void gnash::MovieClip::cleanupDisplayList ( )

Delete DisplayObjects removed from the stage from the display lists

References gnash::DisplayObjectContainer::_displayList, and gnash::DisplayList::removeUnloaded().

void gnash::MovieClip::construct ( as_object initObj = 0) [virtual]

Handle placement event.

This callback will (not known to be a problem):

(1) Register ourselves with the global instance list (2) Take note of our original target path (3) Register as listener of core broadcasters (4) Execute tags of frame 0

The callback will also (known to be bogus): (1) Construct this instance as an ActionScript object. See constructAsScriptObject() method, including constructing registered class and adding properties.

Reimplemented from gnash::DisplayObject.

Reimplemented in gnash::SWFMovie.

References assert, gnash::DisplayObject::unloaded(), gnash::DisplayObject::saveOriginalTarget(), gnash::DisplayObject::getTarget(), gnash::DisplayObject::stage(), gnash::movie_root::addLiveChar(), gnash::DisplayObject::get_event_handlers(), queueLoad(), gnash::DisplayObjectContainer::_displayList, gnash::SWF::ControlTag::TAG_ACTION, gnash::DisplayObject::isDynamic(), gnash::movie_root::pushAction(), gnash::movie_root::PRIORITY_CONSTRUCT, gnash::getObject(), gnash::as_object::copyProperties(), constructAsScriptObject(), queueEvent(), gnash::event_id::INITIALIZE, and gnash::movie_root::PRIORITY_INIT.

Referenced by gnash::movie_root::setLevel(), duplicateMovieClip(), and getLoadedMovie().

void gnash::MovieClip::constructAsScriptObject ( )

Construct this instance as an ActionScript object.

This method invokes the constructor associated with our definition, either MovieClip or any user-speficied one (see sprite_definition::registerClass). It will also invoke the onClipConstruct and onConstruct handlers.

References gnash::getObject(), assert, gnash::DisplayObject::parent(), gnash::as_object::init_member(), gnash::getVM(), gnash::VM::getPlayerVersion(), gnash::DisplayObject::stage(), gnash::movie_root::getRegisteredClass(), gnash::DisplayObject::getTarget(), gnash::NSV::PROP_PROTOTYPE, gnash::as_object::set_prototype(), gnash::Property::getValue(), notifyEvent(), gnash::event_id::CONSTRUCT, gnash::getSWFVersion(), and get_environment().

Referenced by construct().

void gnash::MovieClip::destroy ( ) [virtual]

Mark this sprite as destroyed.

This is an override of DisplayObject::destroy()

A sprite should be destroyed when is removed from the display list and is not more needed for names (target) resolutions. Sprites are needed for names resolution whenever themselves or a contained object has an onUnload event handler defined, in which case we want the event handler to find the 'this' variable w/out attempting to rebind it.

When a sprite is destroyed, all its children are also destroyed.

Note: this function will release most memory associated with the sprite as no members or drawable should be needed anymore.

Reimplemented from gnash::DisplayObject.

References gnash::DisplayObjectContainer::_displayList, and gnash::DisplayList::destroy().

Referenced by gnash::movie_root::dropLevel().

void gnash::MovieClip::display ( Renderer renderer,
const Transform xform 
) [virtual]
void gnash::MovieClip::draw ( Renderer renderer,
const Transform xform 
)

Draw this MovieClip.

This is effectively the same as display(), but uses only the passed transform.

References gnash::DynamicShape::finalize(), gnash::DynamicShape::display(), gnash::DisplayObjectContainer::_displayList, and gnash::DisplayList::display().

Referenced by gnash::BitmapData_as::draw(), and display().

MovieClip * gnash::MovieClip::duplicateMovieClip ( const std::string &  newname,
int  newdepth,
as_object init_object = 0 
)
void gnash::MovieClip::execute_action ( const action_buffer ab)

Execute a single action buffer (DOACTION block)

Referenced by add_action_buffer().

void gnash::MovieClip::execute_init_action_buffer ( const action_buffer a,
int  cid 
)

Execute the given init action buffer, if not done yet for the target DisplayObject id.

The action will normally be pushed on queue, but will be executed immediately if we are executing actions resulting from a callFame instead.

Parameters:
aThe action buffer to execute
cidThe referenced DisplayObject id

References assert, gnash::Movie::initializeCharacter(), gnash::DisplayObject::getTarget(), gnash::DisplayObject::stage(), gnash::movie_root::pushAction(), and gnash::movie_root::PRIORITY_INIT.

Referenced by gnash::SWF::DoInitActionTag::executeState().

const DisplayObject * gnash::MovieClip::findDropTarget ( boost::int32_t  x,
boost::int32_t  y,
DisplayObject dragging 
) const [virtual]

Point coordinates in global twips.

Find highest depth DisplayObject whose shape contains the given point and is not the DisplayObject being dragged or any of its childs.

Reimplemented from gnash::DisplayObject.

References gnash::DisplayObject::visible(), gnash::DisplayObjectContainer::_displayList, and gnash::DisplayList::visitAll().

size_t gnash::MovieClip::get_bytes_loaded ( ) const [inline]

Return number of loaded bytes in the movie (not sprite!)

References gnash::DisplayObject::isDynamic().

Referenced by gnash::movie_root::processInvoke().

size_t gnash::MovieClip::get_bytes_total ( ) const [inline]

Return total number of bytes in the movie (not sprite!)

References gnash::DisplayObject::isDynamic().

Referenced by gnash::movie_root::processInvoke().

size_t gnash::MovieClip::get_current_frame ( ) const [inline]

Return 0-based index to current frame.

Referenced by gnash::Gui::advanceMovie(), nsPluginInstance::threadMain(), and gnash::SWFMovie::advance().

virtual as_environment& gnash::MovieClip::get_environment ( ) [inline, virtual]

Return a reference to the variable scope of this DisplayObject.

Reimplemented from gnash::DisplayObject.

Referenced by gnash::DumpGui::run(), notifyEvent(), and constructAsScriptObject().

size_t gnash::MovieClip::get_frame_count ( ) const [inline]
bool gnash::MovieClip::get_frame_number ( const as_value frame_spec,
size_t &  frameno 
) const

Parse frame spec and return a 0-based frame number.

If frame spec cannot be converted to !NAN and !Infinity number it will be converted to a string and considered a frame label (returns false if referring to an unknwown label).

Parameters:
frame_specThe frame specification.
framenoThe evaluated frame number (0-based)
Returns:
True if the frame_spec could be resolved to a frame number. False if the frame_spec was invalid.

References gnash::as_value::to_string(), gnash::toNumber(), gnash::getVM(), gnash::getObject(), and gnash::isFinite().

Referenced by call_frame_actions().

const SWFRect& gnash::MovieClip::get_frame_size ( ) const [inline]

References gnash::key::r.

Referenced by gnash::movie_root::display().

size_t gnash::MovieClip::get_loaded_frames ( ) const [inline]

Return number of completely loaded frames of this sprite/movie.

Note: the number is also the last frame accessible (frames numberes are 1-based)

Referenced by gnash::movie_root::processInvoke(), advance(), and goto_frame().

Movie * gnash::MovieClip::get_root ( ) const [virtual]

Return the relative root of this DisplayObject.

The "relative" is the Movie created by the same SWF definition that contained the definition of this DisplayObject.

The default implementation is to invoke get_root against this DisplayObject's parent.

Reimplemented from gnash::DisplayObject.

Referenced by gnash::SWF::DefinitionTag::executeState(), gnash::SWF::ExportAssetsTag::executeState(), and gnash::SWF::ImportAssetsTag::executeState().

MovieClip * gnash::MovieClip::getAsRoot ( ) [virtual]

Return the _root ActionScript property of this sprite.

Relative or absolute is determined by the _lockroot property, see getLockRoot and setLockRoot. May return this.

Reimplemented from gnash::DisplayObject.

References gnash::key::p, gnash::DisplayObject::parent(), gnash::DisplayObject::stage(), gnash::movie_root::getRootMovie(), gnash::Movie::version(), getDefinitionVersion(), getLockRoot(), and gnash::DisplayObject::getAsRoot().

SWFRect gnash::MovieClip::getBounds ( ) const [virtual]
int gnash::MovieClip::getDefinitionVersion ( ) const [virtual]

Return the version of the SWF this MovieClip was parsed from.

Reimplemented from gnash::DisplayObject.

References gnash::Movie::version().

Referenced by getAsRoot(), and gnash::TextField::getDefinitionVersion().

const DisplayList& gnash::MovieClip::getDisplayList ( ) const [inline]
DisplayObject * gnash::MovieClip::getDisplayListObject ( const ObjectURI uri)

Search for a named object on the DisplayList.

These are properties, but not attached as genuine members to the MovieClip object. They take priority over DisplayObject magic properties and inherited properties, but not over own properties.

Parameters:
nameObject identifier. This function handles case-sensitivity.
Returns:
The object if found, otherwise 0.

References gnash::getObject(), assert, gnash::getStringTable(), gnash::DisplayObjectContainer::_displayList, gnash::DisplayList::getDisplayObjectByName(), gnash::caseless(), and gnash::isReferenceable().

Referenced by gnash::getDisplayObjectProperty(), and pathElement().

DisplayObject * gnash::MovieClip::getDisplayObjectAtDepth ( int  depth)

Return the DisplayObject at given depth in our DisplayList.

Returns:
NULL if the specified depth is available (no chars there)

References gnash::DisplayObjectContainer::_displayList, and gnash::DisplayList::getDisplayObjectAtDepth().

const std::string& gnash::MovieClip::getDropTarget ( ) const [inline]
void gnash::MovieClip::getLoadedMovie ( Movie newMovie) [virtual]
bool gnash::MovieClip::getLockRoot ( ) const [inline]

Return true if getAsRoot() should return the *relative* root, false otherwise.

Referenced by getLoadedMovie(), and getAsRoot().

int gnash::MovieClip::getNextHighestDepth ( ) const [inline]

Return the next highest available depth.

Placing an object at the depth returned by this function should result in a DisplayObject that is displayd above all others

References gnash::DisplayObjectContainer::_displayList, and gnash::DisplayList::getNextHighestDepth().

PlayState gnash::MovieClip::getPlayState ( ) const [inline]
bool gnash::MovieClip::getTextFieldVariables ( const ObjectURI uri,
as_value val 
)

Get TextField variables.

This handles special properties of MovieClip.

TODO: this is unlikely to be the best way of doing it, and it would simplify things if this function could be dropped.

The only genuine special properties are DisplayList members. These are accessible as properties and are enumerated, but not ownProperties of a MovieClip. The TextField variables should probably be handled in a more generic way.

References gnash::key::i, gnash::key::e, gnash::TextField::getTextDefined(), and gnash::TextField::get_text_value().

Referenced by gnash::getDisplayObjectProperty().

void gnash::MovieClip::goto_frame ( size_t  target_frame_number)

Set the sprite state at the specified frame number.

0-based frame numbers!! (in contrast to ActionScript and Flash MX)

References gnash::DisplayObject::getTargetPath(), setPlayState(), PLAYSTATE_STOP, _, get_loaded_frames(), IF_VERBOSE_ASCODING_ERRORS, assert, gnash::DisplayObjectContainer::_displayList, and gnash::SWF::ControlTag::TAG_ACTION.

Referenced by goto_labeled_frame().

bool gnash::MovieClip::goto_labeled_frame ( const std::string &  label)

Look up the labeled frame, and jump to it.

References goto_frame(), IF_VERBOSE_MALFORMED_SWF, and _.

DynamicShape& gnash::MovieClip::graphics ( ) [inline]

Direct access to the Graphics object for drawing.

References gnash::DisplayObject::set_invalidated().

bool gnash::MovieClip::handleFocus ( ) [virtual]
void gnash::MovieClip::loadVariables ( const std::string &  urlstr,
VariablesMethod  sendVarsMethod 
)

Load url-encoded variables from the given url, optionally sending variables from this timeline too.

A LoadVariablesThread will be started to load and parse variables and added to the _loadVariableRequests. Then, at every ::advance_sprite any completed threads will be processed (see processCompletedLoadVariableRequests)

NOTE: the given url will be security-checked

Parameters:
urlstr,:The url to load variables from.
sendVarsMethod,:The VariablesMethod to use. If METHOD_NONE, no data will be sent.

References gnash::DisplayObject::stage(), url, gnash::movie_root::runResources(), gnash::RunResources::streamProvider(), gnash::StreamProvider::baseURL(), METHOD_NONE, gnash::getURLEncodedVars(), gnash::getObject(), gnash::getRunResources(), METHOD_POST, METHOD_GET, and _.

void gnash::MovieClip::markOwnResources ( ) const [protected, virtual]

Mark sprite-specific reachable resources.

sprite-specific reachable resources are:

Canvas for dynamic drawing (_drawable)

  • sprite environment
  • definition the sprite has been instantiated from
  • Textfields having an associated variable registered in this instance.
  • Relative root of this instance (_swf)

Reimplemented from gnash::DisplayObject.

References gnash::DisplayObjectContainer::_displayList, gnash::DisplayList::visitAll(), gnash::as_environment::markReachableResources(), gnash::key::i, gnash::key::e, gnash::renderer::opengl::for_each(), and gnash::GcResource::setReachable().

bool gnash::MovieClip::mouseEnabled ( ) const [virtual]
virtual void gnash::MovieClip::mouseEvent ( const event_id id) [inline, virtual]

Called when a mouse event affects this MovieClip.

Implements gnash::InteractiveObject.

References notifyEvent().

void gnash::MovieClip::move_display_object ( const SWF::PlaceObject2Tag tag,
DisplayList dlist 
)
void gnash::MovieClip::notifyEvent ( const event_id id)
void gnash::MovieClip::omit_display ( ) [virtual]

Called instead of display() when the DisplayObject is not visible on stage. Used to clear the invalidated flags.

Reimplemented from gnash::DisplayObject.

References gnash::DisplayObject::childInvalidated(), gnash::DisplayObjectContainer::_displayList, gnash::DisplayList::omit_display(), and gnash::DisplayObject::clear_invalidated().

as_object * gnash::MovieClip::pathElement ( const ObjectURI uri) [virtual]
void gnash::MovieClip::placeDisplayObject ( DisplayObject ch,
int  depth 
) [inline, protected]
bool gnash::MovieClip::pointInHitableShape ( boost::int32_t  x,
boost::int32_t  y 
) const [virtual]

return true if the given point is located in a(this) hitable sprite.

all sprites except mouse-insensitive dynamic masks are hitable. _visible property is ignored for hitable DisplayObjects.

References gnash::DisplayObject::isDynamicMask(), mouseEnabled(), gnash::DisplayObject::getMask(), gnash::DisplayObject::pointInShape(), gnash::DisplayObjectContainer::_displayList, and gnash::DisplayList::visitBackward().

bool gnash::MovieClip::pointInShape ( boost::int32_t  x,
boost::int32_t  y 
) const [virtual]

Return true if the given point falls in this DisplayObject's shape.

Point coordinates are in world TWIPS

The default implementation warns about a missing override and invokes pointInBounds().

Reimplemented from gnash::InteractiveObject.

References gnash::DisplayObjectContainer::_displayList, and gnash::DisplayList::visitBackward().

bool gnash::MovieClip::pointInVisibleShape ( boost::int32_t  x,
boost::int32_t  y 
) const [virtual]

true if the given point falls in this DisplayObject's visible shape

Point coordinates are in world TWIPS

The default implementation returns false if the DisplayObject is not visible, calling pointInShape() otherwise.

Note that this is good for simple DisplayObjects but needs to be overridden for DisplayObjects with childs. When a DisplayObject has childs it must take into account the case in which some childs are visible and some are not.

Reimplemented from gnash::DisplayObject.

References gnash::DisplayObject::visible(), gnash::DisplayObject::isDynamicMask(), mouseEnabled(), gnash::DisplayObject::getTarget(), gnash::DisplayObject::getMask(), gnash::DisplayObject::pointInShape(), x, y, gnash::DisplayObjectContainer::_displayList, and gnash::DisplayList::visitBackward().

Referenced by topmostMouseEntity().

void gnash::MovieClip::queueAction ( const action_buffer buf)

Queue the given action buffer.

The action will be pushed on the current global list (see movie_root).

References gnash::DisplayObject::stage(), and gnash::movie_root::pushAction().

Referenced by add_action_buffer().

void gnash::MovieClip::queueEvent ( const event_id id,
int  lvl 
)

Queue event in the global action queue.

notifyEvent(id) will be called by execution of the queued action

References gnash::DisplayObject::stage(), and gnash::movie_root::pushAction().

Referenced by queueLoad(), advance(), construct(), and unloadChildren().

void gnash::MovieClip::queueLoad ( )
void gnash::MovieClip::remove_display_object ( const SWF::PlaceObject2Tag tag,
DisplayList dlist 
)
void gnash::MovieClip::remove_display_object ( int  depth,
int   
)

Remove the object at the specified depth.

NOTE: (1)the id parameter is currently unused, but required to avoid breaking of inheritance from movie.h. (2)the id might be used for specifying a DisplayObject in the depth(think about multiple DisplayObjects within the same depth, not tested and a rare case)

References gnash::DisplayObject::set_invalidated(), gnash::DisplayObjectContainer::_displayList, and gnash::DisplayList::removeDisplayObject().

void gnash::MovieClip::removeMovieClip ( )

Remove this sprite from the stage.

This function is intended to be called by effect of a removeMovieClip() ActionScript call and implements the checks required for this specific case.

Callers are:

The removal will not occur if the depth of this DisplayObjects is not in the "dynamic" range [0..1048575] as described at the following URL:

http://www.senocular.com/flash/tutorials/depths/?page=2

A testcases for this behaviour can be found in

testsuite/misc-ming.all/displaylist_depths_test.swf

References gnash::DisplayObject::get_depth(), IF_VERBOSE_ASCODING_ERRORS, _, gnash::DisplayObject::getTarget(), gnash::key::p, gnash::DisplayObject::parent(), remove_display_object(), gnash::DisplayObject::stage(), and gnash::movie_root::dropLevel().

void gnash::MovieClip::replace_display_object ( const SWF::PlaceObject2Tag tag,
DisplayList dlist 
)
void gnash::MovieClip::set_background_color ( const rgba color)
void gnash::MovieClip::set_textfield_variable ( const ObjectURI name,
TextField ch 
)

Set a TextField variable to this timeline.

A TextField variable is a variable that acts as a setter/getter for a TextField 'text' member.

References assert.

void gnash::MovieClip::setDropTarget ( const std::string &  tgt) [inline]
void gnash::MovieClip::setLockRoot ( bool  lr) [inline]

Set whether getAsRoot() should return the *relative* root, false otherwise. True for relative root.

Referenced by getLoadedMovie().

void gnash::MovieClip::setPlayState ( PlayState  s)

Stop or play the sprite.

If stopped, any stream sound associated with this sprite will also be stopped.

References PLAYSTATE_STOP, and gnash::key::s.

Referenced by gnash::Gui::advanceMovie(), and goto_frame().

void gnash::MovieClip::setStreamSoundId ( int  id)

Set the currently playing m_sound_stream_id.

Referenced by gnash::SWF::StreamSoundBlockTag::executeActions().

bool gnash::MovieClip::setTextFieldVariables ( const ObjectURI uri,
const as_value val 
)

TODO: this is also unlikely to be the best way to do it.

References gnash::key::i, gnash::key::e, gnash::as_value::to_string(), gnash::getSWFVersion(), and gnash::getObject().

Referenced by gnash::as_object::set_member().

void gnash::MovieClip::setVariables ( const MovieVariables vars)

Set all variables in the given map with their corresponding values.

References gnash::getVM(), gnash::getObject(), gnash::as_object::set_member(), and gnash::getURI().

Referenced by gnash::movie_root::init().

void gnash::MovieClip::swapDepths ( DisplayObject ch1,
int  newdepth 
) [inline]

Swap depth of the given DisplayObjects in the DisplayList.

See DisplayList::swapDepths for more info

References gnash::DisplayObjectContainer::_displayList, and gnash::DisplayList::swapDepths().

MovieClip* gnash::MovieClip::to_movie ( ) [inline, virtual]

Reimplemented from gnash::DisplayObject.

InteractiveObject * gnash::MovieClip::topmostMouseEntity ( boost::int32_t  x,
boost::int32_t  y 
) [virtual]
bool gnash::MovieClip::trackAsMenu ( ) [virtual]

ActionScript property of Buttons and MovieClips altering mouse handling.

Reimplemented from gnash::InteractiveObject.

References gnash::getObject(), assert, gnash::getVM(), gnash::as_object::get_member(), gnash::getURI(), and gnash::toBool().

bool gnash::MovieClip::unloadChildren ( ) [protected, virtual]
void gnash::MovieClip::unloadMovie ( )

Remove the 'contents' of the MovieClip, but leave properties and event handlers intact.

References LOG_ONCE, and _.

void gnash::MovieClip::visitNonProperties ( KeyVisitor v) const [virtual]

Enumerate child DisplayObjects.

See DisplayObject::enumerateNonProperties for more info.

Reimplemented from gnash::DisplayObject.

References gnash::DisplayObjectContainer::_displayList, and gnash::DisplayList::visitAll().


The documentation for this class was generated from the following files: