Gnash  0.8.11dev
Public Member Functions | List of all members
gnash::SWFMovie Class Reference

Stateful Movie object (a special kind of sprite) More...

#include <SWFMovie.h>

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

Public Member Functions

DSOTEXPORT SWFMovie (as_object *object, const SWFMovieDefinition *def, DisplayObject *parent)
 
virtual ~SWFMovie ()
 
virtual void advance ()
 Advance to the next frame of the MovieClip. More...
 
virtual float frameRate () const
 
virtual size_t widthPixels () const
 
virtual size_t heightPixels () const
 
virtual bool ensureFrameLoaded (size_t frameNo) const
 
void construct (as_object *init=nullptr)
 Handle a top-level movie on stage placement. More...
 
const std::string & url () const
 Get the URL of the SWFMovie's definition. More...
 
int version () const
 Get the version of the SWFMovie. More...
 
virtual SWF::DefinitionTagexportedCharacter (const std::string &symbol)
 Get an exported character definition by its symbol name. More...
 
void addCharacter (std::uint16_t id)
 Add a character to the list of known characters. More...
 
bool initializeCharacter (std::uint16_t id)
 Attempt to mark a character as initialized. More...
 
const movie_definitiondefinition () const
 
- Public Member Functions inherited from gnash::Movie
 Movie (as_object *object, const movie_definition *def, DisplayObject *parent)
 
virtual ~Movie ()
 
- Public Member Functions inherited from gnash::MovieClip
 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
 
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...
 
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...
 

Additional Inherited Members

- Public Types inherited from gnash::MovieClip
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
 
- 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 Member Functions inherited from gnash::MovieClip
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...
 
- 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

Stateful Movie object (a special kind of sprite)

The tasks of the Movie include: 1. Keep a 'dictionary' of parsed characters. This is a container of characters defined in previous frames. It acts like a genuine runtime dictionary of characters, although Gnash actually stores the definitions in the SWFMovieDefinition as it is parsed.

Constructor & Destructor Documentation

§ SWFMovie()

gnash::SWFMovie::SWFMovie ( as_object object,
const SWFMovieDefinition def,
DisplayObject parent 
)

§ ~SWFMovie()

virtual gnash::SWFMovie::~SWFMovie ( )
inlinevirtual

References advance().

Member Function Documentation

§ addCharacter()

void gnash::SWFMovie::addCharacter ( std::uint16_t  id)
virtual

Add a character to the list of known characters.

This makes the character known to ActionScript for initialization. Exported characters must both be in the definition's list of exports and added with this function before they are available. If a duplicated character is added, it will not be marked uninitialized, as SWF::DoInitAction tags are only executed once for each id.

Reimplemented from gnash::Movie.

Referenced by version().

§ advance()

void gnash::SWFMovie::advance ( )
virtual

Advance to the next frame of the MovieClip.

Actions will be executed or pushed to the queue as necessary.

Implements gnash::Movie.

References _, gnash::MovieClip::advance(), gnash::MovieClip::get_current_frame(), gnash::MovieClip::get_frame_count(), IF_VERBOSE_MALFORMED_SWF, and gnash::log_swferror().

Referenced by ~SWFMovie().

§ construct()

void gnash::SWFMovie::construct ( as_object init = nullptr)
virtual

Handle a top-level movie on stage placement.

This method will just ensure first frame is loaded and then call MovieClip::construct

It's intended to be called by movie_root::setLevel().

Reimplemented from gnash::MovieClip.

References _, gnash::MovieClip::construct(), gnash::MovieClip::get_frame_count(), IF_VERBOSE_MALFORMED_SWF, gnash::log_swferror(), and gnash::DisplayObject::saveOriginalTarget().

Referenced by ensureFrameLoaded().

§ definition()

const movie_definition* gnash::SWFMovie::definition ( ) const
inlinevirtual

Implements gnash::Movie.

§ ensureFrameLoaded()

virtual bool gnash::SWFMovie::ensureFrameLoaded ( size_t  frameNo) const
inlinevirtual

Reimplemented from gnash::Movie.

References construct().

§ exportedCharacter()

SWF::DefinitionTag * gnash::SWFMovie::exportedCharacter ( const std::string &  symbol)
virtual

Get an exported character definition by its symbol name.

The character is only available after the ExportAssets tag has been executed.

Parameters
symbolThe exported symbol of the character to retrieve.
Returns
The DefinitionTag of the requested character or 0 if the character has not yet been exported.

Reimplemented from gnash::Movie.

Referenced by version().

§ frameRate()

virtual float gnash::SWFMovie::frameRate ( ) const
inlinevirtual

Implements gnash::Movie.

§ heightPixels()

virtual size_t gnash::SWFMovie::heightPixels ( ) const
inlinevirtual

Implements gnash::Movie.

§ initializeCharacter()

bool gnash::SWFMovie::initializeCharacter ( std::uint16_t  id)
virtual

Attempt to mark a character as initialized.

A character can be initialized once, but only after it is known to this Movie.

Parameters
idThe id of the character to initialize.
Returns
false if the character cannot be initialized. This can mean
  1. The character is not yet present (either not exported or has not yet been placed on stage).
  2. The character has already been initialized. true if the character was marked initialized.

Reimplemented from gnash::Movie.

References _, IF_VERBOSE_MALFORMED_SWF, and gnash::log_swferror().

Referenced by version().

§ url()

const std::string& gnash::SWFMovie::url ( ) const
inlinevirtual

Get the URL of the SWFMovie's definition.

Implements gnash::Movie.

§ version()

int gnash::SWFMovie::version ( ) const
inlinevirtual

Get the version of the SWFMovie.

Returns
the version of the SWFMovie.

Implements gnash::Movie.

References addCharacter(), exportedCharacter(), and initializeCharacter().

§ widthPixels()

virtual size_t gnash::SWFMovie::widthPixels ( ) const
inlinevirtual

Implements gnash::Movie.


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