Gnash  0.8.11dev
Public Types | Public Member Functions | Protected Member Functions | List of all members
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

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::LessThanTextFieldIndex
 A container for textfields, indexed by their variable name. More...
 
typedef std::map< std::string, std::string > MovieVariables
 
typedef movie_definition::PlayList PlayList
 
- Public Types inherited from gnash::DisplayObject
enum  BlendMode {
  BLENDMODE_UNDEFINED = 0, BLENDMODE_NORMAL = 1, BLENDMODE_LAYER, BLENDMODE_MULTIPLY,
  BLENDMODE_SCREEN, BLENDMODE_LIGHTEN, BLENDMODE_DARKEN, BLENDMODE_DIFFERENCE,
  BLENDMODE_ADD, BLENDMODE_SUBTRACT, BLENDMODE_INVERT, BLENDMODE_ALPHA,
  BLENDMODE_ERASE, BLENDMODE_OVERLAY, BLENDMODE_HARDLIGHT = 14
}
 
typedef std::vector< const action_buffer * > BufferList
 
typedef std::map< event_id, BufferListEvents
 

Public Member Functions

 MovieClip (as_object *object, const movie_definition *def, Movie *root, DisplayObject *parent)
 Construct a MovieClip instance. More...
 
virtual ~MovieClip ()
 
virtual Movieget_root () const
 Return the relative root of this DisplayObject. More...
 
virtual bool trackAsMenu ()
 ActionScript property of Buttons and MovieClips altering mouse handling. More...
 
void queueEvent (const event_id &id, int lvl)
 Queue event in the global action queue. More...
 
void queueLoad ()
 
virtual MovieClipgetAsRoot ()
 Return the _root ActionScript property of this sprite. More...
 
virtual SWFRect getBounds () const
 Get the composite bounds of all component drawing elements. More...
 
virtual bool pointInShape (std::int32_t x, std::int32_t y) const
 Return true if the given point falls in this DisplayObject's shape. More...
 
virtual bool pointInVisibleShape (std::int32_t x, std::int32_t y) const
 true if the given point falls in this DisplayObject's visible shape More...
 
virtual bool pointInHitableShape (std::int32_t x, std::int32_t y) const
 
size_t get_current_frame () const
 Return 0-based index to current frame. More...
 
size_t get_frame_count () const
 
size_t get_loaded_frames () const
 Return number of completely loaded frames of this sprite/movie. More...
 
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. More...
 
PlayState getPlayState () const
 
void set_background_color (const rgba &color)
 
virtual bool mouseEnabled () const
 Return true if we have any mouse event handlers. More...
 
virtual InteractiveObjecttopmostMouseEntity (std::int32_t x, std::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. More...
 
const DisplayObjectfindDropTarget (std::int32_t x, std::int32_t y, DisplayObject *dragging) const
 Point coordinates in global twips. More...
 
void setDropTarget (const std::string &tgt)
 
const std::string & getDropTarget () const
 
virtual void advance ()
 Advance to the next frame of the MovieClip. More...
 
DSOEXPORT void goto_frame (size_t target_frame_number)
 Set the sprite state at the specified frame number. More...
 
bool get_frame_number (const as_value &frame_spec, size_t &frameno) const
 Parse frame spec and return a 0-based frame number. More...
 
bool goto_labeled_frame (const std::string &label)
 Look up the labeled frame, and jump to it. More...
 
virtual void display (Renderer &renderer, const Transform &xform)
 Render this MovieClip. More...
 
void draw (Renderer &renderer, const Transform &xform)
 Draw this MovieClip. More...
 
void omit_display ()
 
void swapDepths (DisplayObject *ch1, int newdepth)
 Swap depth of the given DisplayObjects in the DisplayList. More...
 
DisplayObjectgetDisplayObjectAtDepth (int depth)
 Return the DisplayObject at given depth in our DisplayList. More...
 
DisplayObjectaddDisplayListObject (DisplayObject *obj, int depth)
 Attach a DisplayObject at the specified depth. More...
 
DisplayObjectadd_display_object (const SWF::PlaceObject2Tag *tag, DisplayList &dlist)
 Place a DisplayObject or mask to the DisplayList. More...
 
void move_display_object (const SWF::PlaceObject2Tag *tag, DisplayList &dlist)
 Proxy of DisplayList::moveDisplayObject() More...
 
void replace_display_object (const SWF::PlaceObject2Tag *tag, DisplayList &dlist)
 Proxy of DisplayList::replaceDisplayObject() More...
 
void remove_display_object (const SWF::PlaceObject2Tag *tag, DisplayList &dlist)
 Proxy of DisplayList::removeDisplayObject() More...
 
void remove_display_object (int depth, int)
 Remove the object at the specified depth. More...
 
void unloadMovie ()
 
void attachCharacter (DisplayObject &newch, int depth, as_object *initObject)
 Attach the given DisplayObject instance to current display list. More...
 
virtual void construct (as_object *initObj=nullptr)
 Handle placement event. More...
 
void destroy ()
 Mark this sprite as destroyed. More...
 
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. More...
 
void execute_action (const action_buffer &ab)
 Execute a single action buffer (DOACTION block) More...
 
MovieClipto_movie ()
 
virtual void getLoadedMovie (Movie *newMovie)
 Accept a loaded Movie. More...
 
void loadVariables (const std::string &urlstr, VariablesMethod sendVarsMethod)
 Load url-encoded variables from the given url, optionally sending variables from this timeline too. More...
 
bool getTextFieldVariables (const ObjectURI &uri, as_value &val)
 Get TextField variables. More...
 
bool setTextFieldVariables (const ObjectURI &uri, const as_value &val)
 TODO: this is also unlikely to be the best way to do it. More...
 
DisplayObjectgetDisplayListObject (const ObjectURI &uri)
 Search for a named object on the DisplayList. More...
 
as_objectpathElement (const ObjectURI &uri)
 Overridden to look in DisplayList for a match. More...
 
virtual void call_frame_actions (const as_value &frame_spec)
 Execute the actions for the specified frame. More...
 
MovieClipduplicateMovieClip (const std::string &newname, int newdepth, as_object *init_object=nullptr)
 Duplicate this sprite in its timeline. More...
 
virtual void mouseEvent (const event_id &id)
 Called when a mouse event affects this MovieClip. More...
 
void notifyEvent (const event_id &id)
 Dispatch event handler(s), if any. More...
 
virtual as_environmentget_environment ()
 Return a reference to the variable scope of this DisplayObject. More...
 
void set_textfield_variable (const ObjectURI &name, TextField *ch)
 Set a TextField variable to this timeline. More...
 
void add_invalidated_bounds (InvalidatedRanges &ranges, bool force)
 Add the DisplayObject's invalidated bounds to the given ranges list. More...
 
const DisplayListgetDisplayList () const
 
int getNextHighestDepth () const
 Return the next highest available depth. More...
 
void setStreamSoundId (int id)
 Set the currently playing m_sound_stream_id. More...
 
void removeMovieClip ()
 Remove this sprite from the stage. More...
 
DynamicShapegraphics ()
 Direct access to the Graphics object for drawing. More...
 
virtual bool handleFocus ()
 Set focus to this MovieClip. More...
 
DSOEXPORT void setVariables (const MovieVariables &vars)
 Set all variables in the given map with their corresponding values. More...
 
virtual void visitNonProperties (KeyVisitor &v) const
 Enumerate child DisplayObjects. More...
 
void cleanupDisplayList ()
 
void queueAction (const action_buffer &buf)
 Queue the given action buffer. More...
 
void constructAsScriptObject ()
 Construct this instance as an ActionScript object. More...
 
bool getLockRoot () const
 
void setLockRoot (bool lr)
 
virtual int getDefinitionVersion () const
 Return the version of the SWF this MovieClip was parsed from. More...
 
- Public Member Functions inherited from gnash::DisplayObjectContainer
 DisplayObjectContainer (as_object *object, DisplayObject *parent)
 
virtual ~DisplayObjectContainer ()
 
size_t numChildren () const
 
- Public Member Functions inherited from gnash::InteractiveObject
 InteractiveObject (as_object *object, DisplayObject *parent)
 
virtual ~InteractiveObject ()
 
virtual StaticTextgetStaticText (std::vector< const SWF::TextRecord *> &, size_t &)
 Allow extraction of static text. More...
 
- Public Member Functions inherited from gnash::DisplayObject
 DisplayObject (movie_root &mr, as_object *object, DisplayObject *parent)
 Construct a DisplayObject. More...
 
virtual ~DisplayObject ()
 
DisplayObjectparent () const
 Return the parent of this DisplayObject, or NULL if the DisplayObject has no parent. More...
 
void set_parent (DisplayObject *parent)
 Set the parent of this DisplayObject. More...
 
int get_depth () const
 
void set_depth (int d)
 
int getVolume () const
 Get sound volume for this DisplayObject. More...
 
void setVolume (int vol)
 Set sound volume for this DisplayObject. More...
 
int getWorldVolume () const
 Get concatenated sound volume for this DisplayObject. More...
 
const Transformtransform () const
 
void setMatrix (const SWFMatrix &m, bool updateCache=false)
 Set local transform SWFMatrix for this DisplayObject. More...
 
void set_x_scale (double factor)
 Set the xscale value of current SWFMatrix. More...
 
void set_y_scale (double factor)
 Set the yscale value of current SWFMatrix. More...
 
void set_rotation (double rot)
 Set the rotation value of current SWFMatrix. More...
 
virtual void setWidth (double width)
 Set the width of this DisplayObject, modifying its SWFMatrix. More...
 
virtual void setHeight (double height)
 Set the height of this DisplayObject, modifying its SWFMatrix. More...
 
void setCxForm (const SWFCxForm &cx)
 
std::uint16_t get_ratio () const
 
void set_ratio (std::uint16_t r)
 
int get_clip_depth () const
 
void set_clip_depth (int d)
 See get_clip_depth() More...
 
bool isMaskLayer () const
 
bool isDynamicMask () const
 
DisplayObjectgetMask () const
 Return the DisplayObject masking this instance (if any) More...
 
void setMask (DisplayObject *mask)
 
void set_name (const ObjectURI &uri)
 Set DisplayObject name, initializing the original target member. More...
 
const ObjectURIget_name () const
 
std::unique_ptr< ExecutableCodeget_event_handler (const event_id &id) const
 Get the built-in function handlers code for the given event. More...
 
void add_event_handler (const event_id &id, const action_buffer &code)
 Set a built-in function handler for the given event. More...
 
bool pointInBounds (std::int32_t x, std::int32_t y) const
 Return true if the given point falls in this DisplayObject's bounds. More...
 
bool get_accept_anim_moves () const
 Return true if PlaceObjects tag are allowed to move this DisplayObject. More...
 
bool isDynamic () const
 Was this DisplayObject dynamically created ? More...
 
void setDynamic ()
 Mark this DisplayObject as dynamically created. More...
 
void transformedByScript ()
 Call this function when the sprite has been transformed due to ActionScript code. More...
 
void set_visible (bool visible)
 Set whether this DisplayObject should be rendered. More...
 
bool visible () const
 
bool hasEventHandler (const event_id &id) const
 Return true if an handler for the given event is defined. More...
 
bool invalidated () const
 Return whether this DisplayObject has been invalidated or not. More...
 
bool childInvalidated () const
 Return whether this DisplayObject has and invalidated child or not. More...
 
virtual void update ()
 Notify a change in the DisplayObject's appearance. More...
 
void set_invalidated ()
 This function marks the DisplayObject as being modified in aspect and keeps track of current invalidated bounds the first time it's called after each call to clear_invalidated(). More...
 
void set_invalidated (const char *debug_file, int debug_line)
 
void extend_invalidated_bounds (const InvalidatedRanges &ranges)
 
void set_child_invalidated ()
 
void clear_invalidated ()
 
bool unload ()
 Unload this instance from the stage. More...
 
bool unloaded () const
 Return true if this DisplayObject was unloaded from the stage. More...
 
bool isDestroyed () const
 Return true if this DisplayObject was destroyed. More...
 
bool boundsInClippingArea (Renderer &renderer) const
 
std::string getTargetPath () const
 Return full path to this object, in slash notation. More...
 
const std::string & getOrigTarget () const
 
std::string DSOEXPORT getTarget () const
 Return full path to this object, in dot notation. More...
 
virtual bool isSelectableTextField () const
 Return true if this DisplayObject is a selectable TextField. More...
 
bool DSOEXPORT allowHandCursor () const
 Return true if this DisplayObject allows turning the cursor into an hand shape when it happens to be the one receiving mouse events. More...
 
ObjectURI getNextUnnamedInstanceName ()
 Used to assign a name to unnamed instances. More...
 
BlendMode getBlendMode () const
 
void setBlendMode (BlendMode bm)
 
virtual void killFocus ()
 Some DisplayObjects require actions on losing focus. More...
 
double rotation () const
 
double scaleX () const
 
double scaleY () const
 
as_objectobject () const
 
virtual void markReachableResources () const
 Mark all reachable resources. More...
 
boost::tribool focusRect () const
 
void focusRect (boost::tribool focus)
 
- Public Member Functions inherited from gnash::GcResource
 GcResource (GC &gc)
 Create a Garbage-collected resource associated with a GC. More...
 
void setReachable () const
 Mark this resource as being reachable. More...
 
bool isReachable () const
 Return true if this object is marked as reachable. More...
 
void clearReachable () const
 Clear the reachable flag. More...
 

Protected Member Functions

virtual bool unloadChildren ()
 Unload all contents in the displaylist and this instance. More...
 
virtual void markOwnResources () const
 Mark sprite-specific reachable resources. More...
 
void placeDisplayObject (DisplayObject *ch, int depth)
 
- Protected Member Functions inherited from gnash::DisplayObject
movie_rootstage () const
 Get the movie_root to which this DisplayObject belongs. More...
 
void saveOriginalTarget ()
 
const Eventsget_event_handlers () const
 
void set_event_handlers (const Events &copyfrom)
 
as_objectgetPathElementSeparator (string_table::key key)
 look for '.', 'this', '..', '_parent', '_level0' and '_root' More...
 
- Protected Member Functions inherited from gnash::GcResource
virtual ~GcResource ()
 Delete this resource. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from gnash::DisplayObject
static as_value blendMode (const fn_call &fn)
 Getter-setter for blendMode. More...
 
- Static Public Attributes inherited from gnash::DisplayObject
static const int lowerAccessibleBound = -16384
 See also http://www.kirupa.com/developer/actionscript/depths2.htm. More...
 
static const int upperAccessibleBound = 2130690044
 
static const int staticDepthOffset = lowerAccessibleBound
 
static const int removedDepthOffset = -32769
 
static const int noClipDepthValue = -1000000
 
- Protected Attributes inherited from gnash::DisplayObjectContainer
DisplayList _displayList
 
- Protected Attributes inherited from gnash::DisplayObject
ObjectURI _name
 Name of this DisplayObject (if any) More...
 
DisplayObject_parent
 
InvalidatedRanges m_old_invalidated_ranges
 Bounds of this DisplayObject instance before first invalidation since last call to clear_invalidated(). More...
 

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

§ MovieVariables

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

§ PlayList

§ TextFieldIndex

A container for textfields, indexed by their variable name.

§ TextFields

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

Member Enumeration Documentation

§ PlayState

Enumerator
PLAYSTATE_PLAY 
PLAYSTATE_STOP 

§ VariablesMethod

The various methods for sending data in requests.

Used in loadMovie, getURL, loadVariables etc.

Enumerator
METHOD_NONE 
METHOD_GET 
METHOD_POST 

Constructor & Destructor Documentation

§ MovieClip()

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 gnash::as_environment::set_target().

Referenced by duplicateMovieClip().

§ ~MovieClip()

gnash::MovieClip::~MovieClip ( )
virtual

Member Function Documentation

§ add_action_buffer()

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 gnash::key::a.

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

§ add_display_object()

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

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

§ add_invalidated_bounds()

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::DisplayObjectContainer::_displayList, gnash::geometry::SnappingRanges2d< T >::add(), gnash::DisplayList::add_invalidated_bounds(), gnash::DisplayObject::childInvalidated(), gnash::SWFRect::expand_to_transformed_rect(), gnash::DynamicShape::getBounds(), gnash::getCxForm(), gnash::SWFRect::getRange(), gnash::getWorldMatrix(), gnash::DisplayObject::invalidated(), gnash::invisible(), gnash::DisplayObject::m_old_invalidated_ranges, and gnash::DisplayObject::visible().

§ addDisplayListObject()

DisplayObject * gnash::MovieClip::addDisplayListObject ( DisplayObject obj,
int  depth 
)

§ advance()

void gnash::MovieClip::advance ( )
virtual

§ attachCharacter()

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::DisplayObject::construct(), and gnash::DisplayList::placeDisplayObject().

Referenced by gnash::registerMovieClipNative().

§ call_frame_actions()

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::DisplayObjectContainer::_displayList, gnash::key::e, get_frame_number(), gnash::getObject(), gnash::getVM(), IF_VERBOSE_ASCODING_ERRORS, gnash::DisplayObject::isDestroyed(), and gnash::log_aserror().

§ cleanupDisplayList()

void gnash::MovieClip::cleanupDisplayList ( )

Delete DisplayObjects removed from the stage from the display lists

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

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

§ construct()

void gnash::MovieClip::construct ( as_object initObj = nullptr)
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 gnash::DisplayObjectContainer::_displayList, gnash::movie_root::addLiveChar(), constructAsScriptObject(), gnash::as_object::copyProperties(), gnash::DisplayObject::get_event_handlers(), gnash::getObject(), gnash::DisplayObject::getTarget(), gnash::event_id::INITIALIZE, gnash::DisplayObject::isDynamic(), gnash::log_debug(), gnash::movie_root::PRIORITY_CONSTRUCT, gnash::movie_root::PRIORITY_INIT, gnash::movie_root::pushAction(), queueEvent(), queueLoad(), gnash::DisplayObject::saveOriginalTarget(), gnash::DisplayObject::stage(), gnash::SWF::ControlTag::TAG_ACTION, gnash::SWF::ControlTag::TAG_DLIST, and gnash::DisplayObject::unloaded().

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

§ constructAsScriptObject()

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::event_id::CONSTRUCT, gnash::as_function::construct(), get_environment(), gnash::getObject(), gnash::as_object::getOwnProperty(), gnash::VM::getPlayerVersion(), gnash::movie_root::getRegisteredClass(), gnash::getSWFVersion(), gnash::DisplayObject::getTarget(), gnash::Property::getValue(), gnash::getVM(), gnash::as_object::init_member(), gnash::log_debug(), notifyEvent(), gnash::DisplayObject::parent(), gnash::NSV::PROP_PROTOTYPE, gnash::as_object::set_prototype(), and gnash::DisplayObject::stage().

Referenced by construct().

§ destroy()

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, gnash::DisplayList::destroy(), and gnash::DisplayObject::destroy().

Referenced by gnash::movie_root::dropLevel(), and gnash::movie_root::registerButton().

§ display()

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

§ draw()

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::DisplayObjectContainer::_displayList, gnash::DynamicShape::display(), gnash::DisplayList::display(), and gnash::DynamicShape::finalize().

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

§ duplicateMovieClip()

MovieClip * gnash::MovieClip::duplicateMovieClip ( const std::string &  newname,
int  newdepth,
as_object init_object = nullptr 
)

§ execute_action()

void gnash::MovieClip::execute_action ( const action_buffer ab)

§ execute_init_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 gnash::DisplayObject::getTarget(), gnash::Movie::initializeCharacter(), gnash::log_debug(), gnash::movie_root::PRIORITY_INIT, gnash::movie_root::pushAction(), and gnash::DisplayObject::stage().

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

§ findDropTarget()

const DisplayObject * gnash::MovieClip::findDropTarget ( std::int32_t  x,
std::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::DisplayObjectContainer::_displayList, gnash::DisplayObject::visible(), and gnash::DisplayList::visitAll().

§ get_bytes_loaded()

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

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

Referenced by gnash::moviecliploader_class_init(), gnash::movie_root::processInvoke(), and gnash::registerMovieClipNative().

§ get_bytes_total()

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

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

Referenced by gnash::moviecliploader_class_init(), gnash::movie_root::processInvoke(), and gnash::registerMovieClipNative().

§ get_current_frame()

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

§ get_environment()

virtual as_environment& gnash::MovieClip::get_environment ( )
inlinevirtual

Return a reference to the variable scope of this DisplayObject.

Reimplemented from gnash::DisplayObject.

References name.

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

§ get_frame_count()

size_t gnash::MovieClip::get_frame_count ( ) const
inline

§ get_frame_number()

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::getObject(), gnash::getVM(), gnash::isFinite(), gnash::as_value::to_string(), and gnash::toNumber().

Referenced by call_frame_actions(), and gnash::registerMovieClipNative().

§ get_frame_size()

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

§ get_loaded_frames()

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 advance(), gnash::SWF::SWFHandlers::execute(), goto_frame(), gnash::movie_root::processInvoke(), remove_display_object(), and gnash::DisplayObject::MaskRenderer::~MaskRenderer().

§ get_root()

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::ExportAssetsTag::executeState(), gnash::SWF::ImportAssetsTag::executeState(), gnash::SWF::DefinitionTag::executeState(), and gnash::registerMovieClipNative().

§ getAsRoot()

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::DisplayObject::getAsRoot(), getDefinitionVersion(), getLockRoot(), gnash::movie_root::getRootMovie(), gnash::key::p, gnash::DisplayObject::parent(), gnash::DisplayObject::stage(), and gnash::Movie::version().

§ getBounds()

SWFRect gnash::MovieClip::getBounds ( ) const
virtual

§ getDefinitionVersion()

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(), gnash::TextField::getDefinitionVersion(), and gnash::registerMovieClipNative().

§ getDisplayList()

const DisplayList& gnash::MovieClip::getDisplayList ( ) const
inline

§ getDisplayListObject()

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::DisplayObjectContainer::_displayList, gnash::caseless(), gnash::DisplayList::getDisplayObjectByName(), gnash::getObject(), gnash::getStringTable(), and gnash::isReferenceable().

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

§ getDisplayObjectAtDepth()

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().

Referenced by gnash::registerMovieClipNative().

§ getDropTarget()

const std::string& gnash::MovieClip::getDropTarget ( ) const
inline

§ getLoadedMovie()

void gnash::MovieClip::getLoadedMovie ( Movie newMovie)
virtual

§ getLockRoot()

bool gnash::MovieClip::getLockRoot ( ) const
inline

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

Referenced by getAsRoot(), getLoadedMovie(), and gnash::registerMovieClipNative().

§ getNextHighestDepth()

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

Referenced by gnash::registerMovieClipNative().

§ getPlayState()

PlayState gnash::MovieClip::getPlayState ( ) const
inline

References color, x, and y.

§ getTextFieldVariables()

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::e, gnash::TextField::get_text_value(), gnash::TextField::getTextDefined(), gnash::key::i, and test::uri.

Referenced by gnash::getDisplayObjectProperty().

§ goto_frame()

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

§ 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 gnash::log_swferror().

Referenced by gnash::SWF::SWFHandlers::execute().

§ graphics()

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

Direct access to the Graphics object for drawing.

References DSOEXPORT, and test::v.

Referenced by gnash::registerMovieClipNative().

§ handleFocus()

bool gnash::MovieClip::handleFocus ( )
virtual

§ loadVariables()

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
urlstrThe url to load variables from.
sendVarsMethodThe VariablesMethod to use. If METHOD_NONE, no data will be sent.

References _, gnash::StreamProvider::baseURL(), gnash::LoadVariablesThread::completed(), gnash::event_id::DATA, gnash::getObject(), gnash::getRunResources(), gnash::getURLEncodedVars(), gnash::LoadVariablesThread::getValues(), gnash::log_error(), METHOD_GET, METHOD_NONE, METHOD_POST, notifyEvent(), gnash::movie_root::runResources(), setVariables(), gnash::DisplayObject::stage(), gnash::RunResources::streamProvider(), and url.

Referenced by gnash::registerMovieClipNative().

§ markOwnResources()

void gnash::MovieClip::markOwnResources ( ) const
protectedvirtual

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::key::e, gnash::renderer::opengl::for_each(), gnash::key::i, gnash::as_environment::markReachableResources(), gnash::GcResource::setReachable(), and gnash::DisplayList::visitAll().

§ mouseEnabled()

bool gnash::MovieClip::mouseEnabled ( ) const
virtual

§ mouseEvent()

virtual void gnash::MovieClip::mouseEvent ( const event_id id)
inlinevirtual

Called when a mouse event affects this MovieClip.

Implements gnash::InteractiveObject.

§ move_display_object()

void gnash::MovieClip::move_display_object ( const SWF::PlaceObject2Tag tag,
DisplayList dlist 
)

§ notifyEvent()

void gnash::MovieClip::notifyEvent ( const event_id id)

§ omit_display()

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::DisplayObjectContainer::_displayList, gnash::DisplayObject::childInvalidated(), gnash::DisplayObject::clear_invalidated(), and gnash::DisplayList::omit_display().

§ pathElement()

as_object * gnash::MovieClip::pathElement ( const ObjectURI uri)
virtual

§ placeDisplayObject()

void gnash::MovieClip::placeDisplayObject ( DisplayObject ch,
int  depth 
)
inlineprotected

§ pointInHitableShape()

bool gnash::MovieClip::pointInHitableShape ( std::int32_t  x,
std::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::DisplayObjectContainer::_displayList, gnash::DisplayObject::getMask(), gnash::DisplayObject::isDynamicMask(), mouseEnabled(), gnash::DisplayObject::pointInShape(), and gnash::DisplayList::visitBackward().

Referenced by gnash::registerMovieClipNative().

§ pointInShape()

bool gnash::MovieClip::pointInShape ( std::int32_t  x,
std::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().

§ pointInVisibleShape()

bool gnash::MovieClip::pointInVisibleShape ( std::int32_t  x,
std::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::DisplayObjectContainer::_displayList, gnash::DynamicShape::getBounds(), gnash::DisplayObject::getMask(), gnash::DisplayObject::getTarget(), gnash::getWorldMatrix(), gnash::SWFMatrix::invert(), gnash::DisplayObject::isDynamicMask(), gnash::log_debug(), mouseEnabled(), gnash::SWFRect::point_test(), gnash::DisplayObject::pointInShape(), gnash::DynamicShape::pointTestLocal(), gnash::SWFMatrix::transform(), gnash::DisplayObject::visible(), gnash::DisplayList::visitBackward(), gnash::geometry::Point2d::x, x, gnash::geometry::Point2d::y, and y.

Referenced by topmostMouseEntity().

§ queueAction()

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::movie_root::pushAction(), and gnash::DisplayObject::stage().

§ queueEvent()

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::movie_root::pushAction(), and gnash::DisplayObject::stage().

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

§ queueLoad()

void gnash::MovieClip::queueLoad ( )

§ remove_display_object() [1/2]

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

§ remove_display_object() [2/2]

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::DisplayObjectContainer::_displayList, get_loaded_frames(), gnash::DisplayList::removeDisplayObject(), and gnash::DisplayObject::set_invalidated().

§ removeMovieClip()

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::movie_root::dropLevel(), gnash::DisplayObject::get_depth(), gnash::DisplayObject::getTarget(), IF_VERBOSE_ASCODING_ERRORS, gnash::log_aserror(), gnash::key::p, gnash::DisplayObject::parent(), remove_display_object(), and gnash::DisplayObject::stage().

Referenced by gnash::SWF::SWFHandlers::execute(), and gnash::registerMovieClipNative().

§ replace_display_object()

void gnash::MovieClip::replace_display_object ( const SWF::PlaceObject2Tag tag,
DisplayList dlist 
)

§ set_background_color()

void gnash::MovieClip::set_background_color ( const rgba color)

§ set_textfield_variable()

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 name.

Referenced by gnash::TextField::getDefinitionVersion().

§ setDropTarget()

void gnash::MovieClip::setDropTarget ( const std::string &  tgt)
inline

§ setLockRoot()

void gnash::MovieClip::setLockRoot ( bool  lr)
inline

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

Referenced by getLoadedMovie(), and gnash::registerMovieClipNative().

§ setPlayState()

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, gnash::key::s, and gnash::key::t.

Referenced by gnash::Gui::advanceMovie(), gnash::SWF::SWFHandlers::execute(), goto_frame(), and gnash::registerMovieClipNative().

§ setStreamSoundId()

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

§ setTextFieldVariables()

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::getObject(), gnash::getSWFVersion(), gnash::as_value::to_string(), and test::uri.

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

§ setVariables()

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

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

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

Referenced by gnash::MovieLoader::clear(), gnash::movie_root::init(), and loadVariables().

§ swapDepths()

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

Swap depth of the given DisplayObjects in the DisplayList.

See DisplayList::swapDepths for more info

Referenced by gnash::registerMovieClipNative().

§ to_movie()

MovieClip* gnash::MovieClip::to_movie ( )
inlinevirtual

Reimplemented from gnash::DisplayObject.

Referenced by gnash::SWF::SWFHandlers::execute().

§ topmostMouseEntity()

InteractiveObject * gnash::MovieClip::topmostMouseEntity ( std::int32_t  x,
std::int32_t  y 
)
virtual

§ trackAsMenu()

bool gnash::MovieClip::trackAsMenu ( )
virtual

ActionScript property of Buttons and MovieClips altering mouse handling.

Reimplemented from gnash::InteractiveObject.

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

§ unloadChildren()

bool gnash::MovieClip::unloadChildren ( )
protectedvirtual

§ unloadMovie()

void gnash::MovieClip::unloadMovie ( )

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

References _, LOG_ONCE, and gnash::log_unimpl().

Referenced by gnash::registerMovieClipNative().

§ visitNonProperties()

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: