#include <libsswf.h>
Public Member Functions | |
Vectors & | Actions (void) |
Retrieve a reference to the actions array. | |
virtual ErrorManager::error_code_t | Save (Data &data) |
Save the TagDoAction in the specified Data buffer. | |
void | SetAction (const Action &action) |
Append one action. | |
void | SetSprite (sswf_id_t sprite) |
Set the sprite reference identifier. | |
TagDoAction (TagBase *parent) | |
Initialize a TagDoAction. | |
virtual swf_type_t | TypeFlags (void) const |
Returns the type flags of a TagDoAction. | |
Private Member Functions | |
virtual ErrorManager::error_code_t | ParseTag (swf_tag_t tag, const Data &data) |
Parse data from a file into a DoAction tag. | |
virtual ErrorManager::error_code_t | PreSave (void) |
Determine the minimum version required to save this tag. | |
Private Attributes | |
Vectors | f_actions |
sswf_id_t | f_sprite |
An ActionScript is executed each time the given frame is played back unless a Sprite identifier is specified, in that case the ActionScript is an initialization script an thus it will be run only once.
TagDoAction::TagDoAction | ( | TagBase * | parent | ) |
The constructor assumes that there is no actions and no sprite reference to this tag.
parent | The parent of this TagDoAction |
References sswf::assert(), and f_sprite.
Vectors & sswf::TagDoAction::Actions | ( | void | ) | [inline] |
This function can be used to retrieve a reference to the array used to save all the actions.
You can then add the actions you create to this array. You most certainly will want to save a sswf::Action::Duplicate(void) const and use the sswf::MemoryManager::MemAttach(MemBuffer *ptr, size_t size, const char *info) function to attach these duplicates to your sswf::TagDoAction object.
The main idea in letting you have direct access to the array is for you to be able to manage the list they way you want: you can then insert new actions anywhere, append them, delete them...
References f_actions.
ErrorManager::error_code_t TagDoAction::ParseTag | ( | swf_tag_t | tag, | |
const Data & | data | |||
) | [private, virtual] |
This function reads the actions saved in the DoAction tag.
[in] | tag | The tag that generated this call |
[in] | data | The Data buffer from the Flash file being loaded |
Implements sswf::TagBase.
References sswf::ErrorManager::ERROR_CODE_NONE, f_actions, f_sprite, sswf::Data::GetShort(), sswf::Action::ParseList(), and sswf::TagBase::SWF_TAG_DO_INIT_ACTION.
ErrorManager::error_code_t TagDoAction::PreSave | ( | void | ) | [private, virtual] |
This function checks whether a sprite referenced was defined; if so, then the minimum version is set to 6.
Then it goes through the whole list of actions recursively to determine what the required minimum version is to save these actions.
Reimplemented from sswf::TagBase.
References sswf::ErrorManager::ERROR_CODE_NONE, f_actions, f_sprite, sswf::Action::MinimumListVersion(), and sswf::TagBase::MinimumVersion().
ErrorManager::error_code_t TagDoAction::Save | ( | Data & | data | ) | [virtual] |
This function saves the TagDoAction in the specified Data buffer.
This means saving the list of actions and, when specified, the reference to the given sprite.
The list of actions is saved using the sswf::Action::SaveList(TagBase *parent, const Vectors *list, Data& data, const Vectors *extra) function.
Implements sswf::TagBase.
References sswf::Data::Append(), sswf::Data::ByteSize(), sswf::Vectors::Count(), sswf::ErrorManager::ERROR_CODE_NONE, f_actions, f_sprite, sswf::Vectors::Get(), sswf::Data::PutShort(), sswf::Action::SaveList(), sswf::TagBase::SaveTag(), sswf::TagBase::SWF_TAG_DO_ACTION, and sswf::TagBase::SWF_TAG_DO_INIT_ACTION.
void TagDoAction::SetAction | ( | const Action & | action | ) |
First create some action, then append the action using this function.
The new action is added at the very end. The input action is duplicated internally and thus the input can be modified by the caller afterward.
For more control over the list of actions, use the Actions() function to retrieve the vector and manage the vector yourself.
action | The action to duplicate and append at the end of the list |
References sswf::Action::Duplicate(), f_actions, sswf::MemoryManager::MemAttach(), and sswf::Vectors::Set().
void TagDoAction::SetSprite | ( | sswf_id_t | sprite | ) |
This function saves the specified identifier as a sprite identifier or set to zero to remove the reference.
When a sswf::TagDoAction has a reference to a sprite, it because the ActionScript to execute once to initialize the Sprite it references (Similar to a constructor in C++).
By default, a TagDoAction has no sprite reference.
sprite | The identifier of the sprite to reference |
References f_sprite.
TagBase::swf_type_t TagDoAction::TypeFlags | ( | void | ) | const [virtual] |
This function returns CONTROL since an ActionScript is viewed as a control tag and not a definition.
It returns SCRIPT since obviously it includes a script.
It returns ONE because you are supposed to have only one per frame. This is not really enforced by the players.
It returns REFERENCE thought if you do not define a sprite reference this is obviously not the case.
Implements sswf::TagBase.
References SWF_TYPE_CONTROL, SWF_TYPE_ONE, SWF_TYPE_REFERENCE, and SWF_TYPE_SCRIPT.
Vectors sswf::TagDoAction::f_actions [private] |
Referenced by Actions(), ParseTag(), PreSave(), Save(), and SetAction().
sswf_id_t sswf::TagDoAction::f_sprite [private] |
Referenced by ParseTag(), PreSave(), Save(), SetSprite(), and TagDoAction().