Gnash
0.8.10
|
A MovieClip is a container for DisplayObjects. More...
#include <MovieClip.h>
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 Movie * | get_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 MovieClip * | getAsRoot () |
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 SWFRect & | get_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 InteractiveObject * | topmostMouseEntity (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 DisplayObject * | findDropTarget (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. | |
DisplayObject * | getDisplayObjectAtDepth (int depth) |
Return the DisplayObject at given depth in our DisplayList. | |
DisplayObject * | addDisplayListObject (DisplayObject *obj, int depth) |
Attach a DisplayObject at the specified depth. | |
DisplayObject * | add_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) | |
MovieClip * | to_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. | |
DisplayObject * | getDisplayListObject (const ObjectURI &uri) |
Search for a named object on the DisplayList. | |
as_object * | pathElement (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. | |
MovieClip * | duplicateMovieClip (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_environment & | get_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 DisplayList & | getDisplayList () 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. | |
DynamicShape & | graphics () |
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) |
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.
typedef std::map<std::string, std::string> gnash::MovieClip::MovieVariables |
typedef std::map<ObjectURI, TextFields, ObjectURI::LessThan> gnash::MovieClip::TextFieldIndex |
A container for textfields, indexed by their variable name.
typedef std::vector<TextField*> gnash::MovieClip::TextFields |
gnash::MovieClip::MovieClip | ( | as_object * | object, |
const movie_definition * | def, | ||
Movie * | root, | ||
DisplayObject * | parent | ||
) |
Construct a MovieClip instance.
def | Pointer 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. |
root | The "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. |
parent | Parent 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] |
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.
tag | A swf defined placement tag (PlaceObject, or PlaceObject2, or PlaceObject3). No ownership transfer, the tag is still owned by the movie_definition class. |
dlist | The display list to add the DisplayObject to. |
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 | ||
) |
Attach a DisplayObject at the specified depth.
References gnash::DisplayObject::set_invalidated(), gnash::DisplayObjectContainer::_displayList, gnash::DisplayList::placeDisplayObject(), and gnash::DisplayObject::construct().
void gnash::MovieClip::advance | ( | ) | [virtual] |
Advance to the next frame of the MovieClip.
Actions will be executed or pushed to the queue as necessary.
Reimplemented in gnash::SWFMovie, gnash::Movie, and gnash::BitmapMovie.
References gnash::DisplayObject::getTargetPath(), get_frame_count(), assert, gnash::DisplayObject::unloaded(), get_loaded_frames(), IF_VERBOSE_MALFORMED_SWF, LOG_ONCE, _, gnash::DisplayObject::getTarget(), queueLoad(), queueEvent(), gnash::event_id::ENTER_FRAME, gnash::movie_root::PRIORITY_DOACTION, PLAYSTATE_PLAY, IF_VERBOSE_ACTION, gnash::DisplayObjectContainer::_displayList, gnash::SWF::ControlTag::TAG_DLIST, and gnash::SWF::ControlTag::TAG_ACTION.
void gnash::MovieClip::attachCharacter | ( | DisplayObject & | newch, |
int | depth, | ||
as_object * | initObject | ||
) |
Attach the given DisplayObject instance to current display list.
newch | The DisplayObject instance to attach. |
depth | The 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().
Render this MovieClip.
Implements gnash::InteractiveObject.
References gnash::DisplayObject::transform(), draw(), and gnash::DisplayObject::clear_invalidated().
Referenced by gnash::movie_root::display().
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 |
||
) |
Duplicate this sprite in its timeline.
Add the new DisplayObject at a the given depth to this sprite parent displaylist.
NOTE: the call will fail for the root movie (no parent). NOTE2: any DisplayObject at the given target depth will be replaced by the new DisplayObject NOTE3: event handlers will also be copied
newname | Name for the copy |
newdepth | Depth for the copy |
init_object | If not null, will be used to copy properties over. |
References gnash::DisplayObject::parent(), IF_VERBOSE_ASCODING_ERRORS, _, gnash::DisplayObject::to_movie(), gnash::DisplayObject::getTarget(), gnash::key::o, gnash::getObjectWithPrototype(), gnash::getGlobal(), gnash::getObject(), gnash::NSV::CLASS_MOVIE_CLIP, MovieClip(), gnash::getURI(), gnash::getVM(), gnash::DisplayObject::set_name(), gnash::DisplayObject::setDynamic(), gnash::DisplayObject::set_event_handlers(), gnash::DisplayObject::get_event_handlers(), gnash::DisplayObject::setCxForm(), gnash::getCxForm(), gnash::DisplayObject::setMatrix(), gnash::getMatrix(), gnash::DisplayObject::set_ratio(), gnash::DisplayObject::get_ratio(), gnash::DisplayObject::set_clip_depth(), gnash::DisplayObject::get_clip_depth(), gnash::DisplayObjectContainer::_displayList, gnash::DisplayList::placeDisplayObject(), and construct().
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.
a | The action buffer to execute |
cid | The 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).
frame_spec | The frame specification. |
frameno | The evaluated frame number (0-based) |
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] |
Get the composite bounds of all component drawing elements.
Implements gnash::InteractiveObject.
References gnash::key::f, gnash::DisplayObjectContainer::_displayList, gnash::DisplayList::visitAll(), gnash::DynamicShape::getBounds(), and gnash::SWFRect::expand_to_rect().
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] |
References gnash::DisplayObjectContainer::_displayList.
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.
name | Object identifier. This function handles case-sensitivity. |
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.
References gnash::DisplayObjectContainer::_displayList, and gnash::DisplayList::getDisplayObjectAtDepth().
const std::string& gnash::MovieClip::getDropTarget | ( | ) | const [inline] |
void gnash::MovieClip::getLoadedMovie | ( | Movie * | newMovie | ) | [virtual] |
Accept a loaded Movie.
Reimplemented from gnash::DisplayObject.
References gnash::key::p, gnash::DisplayObject::parent(), gnash::DisplayObject::set_parent(), setLockRoot(), getLockRoot(), gnash::DisplayObject::get_event_handlers(), assert, gnash::DisplayObject::set_event_handlers(), gnash::DisplayObject::get_name(), gnash::ObjectURI::empty(), gnash::DisplayObject::set_name(), gnash::DisplayObject::set_clip_depth(), gnash::DisplayObject::get_clip_depth(), gnash::DisplayObject::to_movie(), gnash::DisplayObjectContainer::_displayList, gnash::DisplayList::replaceDisplayObject(), gnash::DisplayObject::get_depth(), construct(), gnash::DisplayObject::stage(), gnash::movie_root::replaceLevel(), and gnash::DisplayObject::staticDepthOffset.
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] |
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] |
Set focus to this MovieClip.
Reimplemented from gnash::DisplayObject.
References gnash::getObject(), assert, gnash::getSWFVersion(), gnash::as_object::get_member(), gnash::NSV::PROP_FOCUS_ENABLED, gnash::toBool(), gnash::getVM(), and mouseEnabled().
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
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)
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] |
Return true if we have any mouse event handlers.
NOTE: this function currently does not consider general mouse event handlers MOUSE_MOVE, MOUSE
Implements gnash::InteractiveObject.
References gnash::event_id::PRESS, gnash::event_id::RELEASE, gnash::event_id::RELEASE_OUTSIDE, gnash::event_id::ROLL_OVER, gnash::event_id::ROLL_OUT, gnash::event_id::DRAG_OVER, gnash::event_id::DRAG_OUT, gnash::arraySize(), gnash::key::i, and gnash::DisplayObject::hasEventHandler().
Referenced by handleFocus(), pointInVisibleShape(), pointInHitableShape(), and topmostMouseEntity().
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 | ||
) |
Proxy of DisplayList::moveDisplayObject()
References gnash::SWF::PlaceObject2Tag::getRatio(), gnash::DisplayList::moveDisplayObject(), gnash::SWF::DisplayListTag::getDepth(), gnash::SWF::PlaceObject2Tag::hasCxform(), gnash::SWF::PlaceObject2Tag::getCxform(), gnash::SWF::PlaceObject2Tag::hasMatrix(), gnash::SWF::PlaceObject2Tag::getMatrix(), and gnash::SWF::PlaceObject2Tag::hasRatio().
Referenced by replace_display_object(), and gnash::SWF::PlaceObject2Tag::executeState().
void gnash::MovieClip::notifyEvent | ( | const event_id & | id | ) |
Dispatch event handler(s), if any.
This handles key, mouse, and specific MovieClip events. TODO: split this sensibly.
References gnash::DisplayObject::getTarget(), gnash::event_id::ENTER_FRAME, gnash::DisplayObject::unloaded(), gnash::isButtonEvent(), gnash::DisplayObject::get_event_handler(), gnash::isKeyEvent(), gnash::event_id::INITIALIZE, gnash::event_id::LOAD, gnash::DisplayObject::parent(), gnash::DisplayObject::get_event_handlers(), gnash::DisplayObject::isDynamic(), gnash::DisplayObject::stage(), gnash::DisplayObject::get_depth(), gnash::sendEvent(), gnash::getObject(), and get_environment().
Referenced by gnash::movie_root::keyEvent(), constructAsScriptObject(), and mouseEvent().
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().
Overridden to look in DisplayList for a match.
Reimplemented from gnash::DisplayObject.
References gnash::getObject(), getDisplayListObject(), assert, gnash::as_value::is_object(), gnash::as_value::is_sprite(), gnash::as_value::toDisplayObject(), gnash::toObject(), and gnash::getVM().
void gnash::MovieClip::placeDisplayObject | ( | DisplayObject * | ch, |
int | depth | ||
) | [inline, protected] |
References gnash::DisplayObjectContainer::_displayList, and gnash::DisplayList::placeDisplayObject().
Referenced by gnash::BitmapMovie::BitmapMovie().
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 | ( | ) |
References gnash::DisplayObject::parent(), gnash::getSWFVersion(), gnash::getObject(), queueEvent(), gnash::event_id::LOAD, and gnash::movie_root::PRIORITY_DOACTION.
Referenced by advance(), and construct().
void gnash::MovieClip::remove_display_object | ( | const SWF::PlaceObject2Tag * | tag, |
DisplayList & | dlist | ||
) |
Proxy of DisplayList::removeDisplayObject()
References gnash::DisplayObject::set_invalidated(), gnash::DisplayList::removeDisplayObject(), and gnash::SWF::DisplayListTag::getDepth().
Referenced by removeMovieClip(), gnash::SWF::PlaceObject2Tag::executeState(), and gnash::TextField::removeTextField().
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 | ||
) |
Proxy of DisplayList::replaceDisplayObject()
References assert, gnash::SWF::PlaceObject2Tag::getID(), gnash::key::SWF, _, gnash::DisplayList::getDisplayObjectAtDepth(), gnash::SWF::DisplayListTag::getDepth(), gnash::isReferenceable(), move_display_object(), gnash::getGlobal(), gnash::getObject(), gnash::SWF::DefinitionTag::createDisplayObject(), gnash::SWF::PlaceObject2Tag::hasName(), gnash::getVM(), gnash::DisplayObject::set_name(), gnash::getURI(), gnash::SWF::PlaceObject2Tag::getName(), gnash::DisplayObject::getNextUnnamedInstanceName(), gnash::SWF::PlaceObject2Tag::hasRatio(), gnash::DisplayObject::set_ratio(), gnash::SWF::PlaceObject2Tag::getRatio(), gnash::SWF::PlaceObject2Tag::hasCxform(), gnash::DisplayObject::setCxForm(), gnash::SWF::PlaceObject2Tag::getCxform(), gnash::SWF::PlaceObject2Tag::hasMatrix(), gnash::DisplayObject::setMatrix(), gnash::SWF::PlaceObject2Tag::getMatrix(), gnash::DisplayList::replaceDisplayObject(), and gnash::DisplayObject::construct().
Referenced by gnash::SWF::PlaceObject2Tag::executeState().
void gnash::MovieClip::set_background_color | ( | const rgba & | color | ) |
References gnash::DisplayObject::stage(), and gnash::movie_root::set_background_color().
Referenced by gnash::SWF::SetBackgroundColorTag::executeState().
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().
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] |
Return the topmost entity that the given point covers that can receive mouse events. NULL if none. Coords are in parent's frame.
Implements gnash::InteractiveObject.
References gnash::DisplayObject::visible(), gnash::key::p, gnash::DisplayObject::parent(), gnash::getWorldMatrix(), gnash::SWFMatrix::transform(), mouseEnabled(), pointInVisibleShape(), gnash::geometry::Point2d::x, gnash::geometry::Point2d::y, gnash::key::m, gnash::getMatrix(), gnash::SWFMatrix::invert(), gnash::DisplayObjectContainer::_displayList, and gnash::DisplayList::visitAll().
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] |
Unload all contents in the displaylist and this instance.
Return true if there was an unloadHandler.
Reimplemented from gnash::DisplayObject.
References gnash::DisplayObject::getTargetPath(), gnash::DynamicShape::clear(), gnash::DisplayObjectContainer::_displayList, gnash::DisplayList::unload(), gnash::DisplayObject::unloaded(), queueEvent(), gnash::event_id::UNLOAD, gnash::movie_root::PRIORITY_DOACTION, gnash::DisplayObject::hasEventHandler(), gnash::DisplayObject::stage(), and gnash::movie_root::removeQueuedConstructor().
void gnash::MovieClip::unloadMovie | ( | ) |
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().