Made to Order Software Corporation Logo

libsswf: sswf::ActionWaitForFrame Class Reference

Create an action used to wait for a frame to be loaded. More...

#include <libsswf.h>

Inheritance diagram for sswf::ActionWaitForFrame:

:Action :MemoryManager :ItemBase :MemBuffer

List of all members.

Public Member Functions

 ActionWaitForFrame (TagBase *tag, action_t action=ACTION_WAIT_FOR_FRAME)
 Initialize the ActionWaitForFrame object.
void AddAction (Action *action)
 Add a sub-action to the wait frame action.
void SetFrameName (const char *name)
 Set the name of the frame to wait for.
virtual VectorsSubList (void)
 Return the Vectors holding the sub-actions.

Private Member Functions

virtual ActionDuplicate (void) const
 Create a clone of this action.
virtual ErrorManager::error_code_t ParseData (const Data &data)
 Parse the data of the ActionWaitForFrame object.
virtual ErrorManager::error_code_t SaveData (Data &data, Data &nested_data)
 Save the extraneous data of the ActionWaitForFrame object.

Private Attributes

Vectors f_actions
uint16_t f_frame
char * f_frame_name

Detailed Description

This class creates an action one can use to wait for a certain frame to be saved. As long as that frame is not loaded, the sub-actions are skipped. Once the frame was loaded, the actions are executed. These actions can result in the execution of the rest of the movie.

The WaitForFrame action uses a byte to define the number of the sub-actions to skip. That means a maximum of 255 actions, which is relatively small for an ActionScript. In general, you can bypass the problem by calling a function.
This is 255 actions. Thus in bytes it can be much larger. However, do NOT try to define a function or an object within this block. It is likely to fail.
It could be that the ACTION_WAIT_FOR_FRAME and ACTION_WAIT_FOR_FRAME2 should each have its own class since the dynamic version should not be given a frame name (it is taken dynamically!). On the other hand it could be that I could change the code and if you define a frame name then I force the ACTION_WAIT_FOR_FRAME and by default I would use ACTION_WAIT_FOR_FRAME2. In this latter case, I would need a PreSave() to determine the action before to save the result.
See also:
SWF Alexis' Reference—Wait For Frame

SWF Alexis' Reference—Wait For Frame (dynamic)

Constructor & Destructor Documentation

ActionWaitForFrame::ActionWaitForFrame ( TagBase tag,
action_t  action = ACTION_WAIT_FOR_FRAME 

This constructor initializes the ActionWaitForFrame object with a frame with no name and no actions.

The action parameter can be set to:


[in] tag The tag in which this action is being added
[in] action One of the wait for action codes

References sswf::Action::ACTION_WAIT_FOR_FRAME, sswf::Action::ACTION_WAIT_FOR_FRAME2, sswf::assert(), and f_frame_name.

Referenced by Duplicate().

Member Function Documentation

void ActionWaitForFrame::AddAction ( Action action  ) 

This function adds a sub-action to execute once the movie loaded the specified frame.

You can also access the list of sub-actions using the sswf::ActioWaitForFrame::SubList() function.

Note that the total number of these actions is 255 (and not 255 bytes!) This makes it difficult to read this action.

[in] action The action to append to this wait for frame

References f_actions, and sswf::Vectors::Set().

Referenced by Duplicate().

Action * ActionWaitForFrame::Duplicate ( void   )  const [private, virtual]

This function creates a new ActionWaitForFrame and copies the frame name and all the sub-actions in it. Finally, it returns the pointer of the new action.

The pointer of the clone action

Reimplemented from sswf::Action.

References ActionWaitForFrame(), AddAction(), sswf::Vectors::Count(), sswf::Action::Duplicate(), sswf::Action::f_action, f_actions, f_frame_name, sswf::Vectors::Get(), SetFrameName(), and sswf::Action::Tag().

ErrorManager::error_code_t ActionWaitForFrame::ParseData ( const Data data  )  [private, virtual]

This function parses the Data buffer to retrieve the frame number (ACTION_WAIT_FOR_FRAME) and the number of nested actions.

[in] data The Data buffer where the information is saved
An error code or ERROR_CODE_NONE

Reimplemented from sswf::Action.

References sswf::Action::ACTION_WAIT_FOR_FRAME, sswf::ErrorManager::ERROR_CODE_NONE, sswf::Action::f_action, f_actions, f_frame, sswf::Data::GetByte(), sswf::Data::GetShort(), sswf::Action::Parse(), and sswf::Action::Tag().

ErrorManager::error_code_t ActionWaitForFrame::SaveData ( Data data,
Data nested_data 
) [private, virtual]

This function saves the frame number (ACTION_WAIT_FOR_FRAME) and the number of nested actions.

If the specified frame is not found or no frame name is specified for an ACTION_WAIT_FOR_FRAME, then an error results.

[in] data The Data buffer where the information is saved
[in] nested_data The Action::Save() function defines this buffer, this function does not need it since the size is not what is saved in these actions
An error code or ERROR_CODE_NONE

Reimplemented from sswf::Action.

References sswf::Action::ACTION_WAIT_FOR_FRAME, sswf::Vectors::Count(), sswf::ErrorManager::ERROR_CODE_ACTION_OVERFLOW, sswf::ErrorManager::ERROR_CODE_MISSING_FRAME_NAME, sswf::ErrorManager::ERROR_CODE_NONE, sswf::ErrorManager::ERROR_CODE_OBJECT_NOT_FOUND, sswf::Action::f_action, f_actions, f_frame_name, sswf::TagBase::FindLabelledTag(), sswf::ErrorManager::KeepFirst(), sswf::Action::OnError(), sswf::Data::PutByte(), sswf::Data::PutShort(), sswf::Action::Tag(), and sswf::TagBase::WhichFrame().

void ActionWaitForFrame::SetFrameName ( const char *  frame_name  ) 

In case you used ACTION_WAIT_FOR_FRAME, this is the name of the frame to wait for.

[in] frame_name The name of the frame to wait for

References f_frame_name, sswf::MemoryManager::MemFree(), and sswf::MemoryManager::StrDup().

Referenced by Duplicate().

Vectors * ActionWaitForFrame::SubList ( void   )  [virtual]

This function is used to retrieve the pointer of the Vectors used to register all the sub-actions of this ActionWaitForFrame object.

The Vectors pointers of the sub-actions

Reimplemented from sswf::Action.

References f_actions.

Member Data Documentation

Referenced by ParseData().

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

Generated on Wed Mar 18 15:13:57 2009 for libsswf by  doxygen 1.5.5