Made to Order Software Corporation Logo

libsswf: sswf::TagSprite Class Reference

Group shapes, sprites, texts, buttons, sound, etc. More...

#include <libsswf.h>

Inheritance diagram for sswf::TagSprite:

:TagBaseID :TagScalingGrid :TagBase :MemoryManager

List of all members.


Public Member Functions

virtual ErrorManager::error_code_t Save (Data &data)
 Save a Sprite control list.
 TagSprite (TagBase *parent)
 Initialize a sprite.
virtual swf_type_t TypeFlags (void) const
 Returns the flags defining a TagSprite object.

Protected Member Functions

virtual ErrorManager::error_code_t OnNewChild (const char *child_name) const
 Check that the child is valid for a TagSprite.

Private Member Functions

virtual ErrorManager::error_code_t ParseTag (swf_tag_t tag, const Data &data)
 Parse data from a file into a Sprite tag.
virtual ErrorManager::error_code_t PreSave (void)
 Defines the minimum version necessary to save this sprite.

Detailed Description

The TagSprite is the SWF object used to group other objects in one single entity. The sprite is given an ID which can later be used to display the sprite.

A sprite can be viewed as a group, though it only includes a set of control tags used to define a display list.

For instance, to include a TagSprite inside another TagSprite you actually need to use a TagPlace which reference the TagSprite to be inserted.

There is one special case sprite: the empty sprite. This is required if you want to use the CreateEmptyMovie() function in some ActionScript!

Since version 1.8.0, a Sprite derives from the sswf::TagScalingGrid. This means you can define a scaling rectangle with a call to the void sswf::TagScalingGrid::SetGrid(const SRectangle& rect) function.

See also:
SWF Alexis' Reference—Define Sprite

SWF Alexis' Reference—swf_tag


Constructor & Destructor Documentation

TagSprite::TagSprite ( TagBase parent  ) 

By default, a TagSprite is created empty. You can add objects using the Sprite object as the parent of other objects (instead of the TagHeader.)


Member Function Documentation

ErrorManager::error_code_t TagSprite::OnNewChild ( const char *  child_name  )  const [protected, virtual]

A sswf::TagSprite accepts only a few control tags as defined in my reference.

This function returns an error if the child is not one of these control tags:

Parameters:
child_name The name of the child to be added to this parent
Returns:
An error code: ErrorManager::ERROR_CODE_NONE or ErrorManager::ERROR_CODE_INCOMPATIBLE_CHILD
See also:
sswf::TagBase::OnNewChild(const char *child)

sswf::TagSprite::OnNewChild(const char *child)

Reimplemented from sswf::TagBase.

References sswf::ErrorManager::ERROR_CODE_INCOMPATIBLE_CHILD, and sswf::ErrorManager::ERROR_CODE_NONE.

ErrorManager::error_code_t TagSprite::ParseTag ( swf_tag_t  tag,
const Data data 
) [private, virtual]

This function reads the data associated with this sprite object.

Note:
Note that the TagHeader::Load() function handles the reading of the content of the Sprite. So when this function is called, the data buffer only includes the identifier and the number of frames. It is done this way to allow for partial loading of sprites just like the main movie.
Parameters:
[in] tag The tag that generated this call
[in] data The Data buffer from the Flash file being loaded
Returns:
An error if one occurs, or ErrorManager::ERROR_CODE_NONE

Implements sswf::TagBase.

References sswf::ErrorManager::ERROR_CODE_NONE, sswf::Data::GetShort(), sswf::TagScalingGrid::ParseGridTag(), sswf::TagBaseID::ParseID(), and sswf::TagBase::SWF_TAG_DEFINE_SCALING_GRID.

ErrorManager::error_code_t TagSprite::PreSave ( void   )  [private, virtual]

Sprites appeared in version 3 of SWF.

Since version 8 of SWF, it is possible to attached a scaling grid to a sprite (by referencing the sprite in the scaling grid.)

When no grid is defined, then a version 3 movie is sufficient.

When a grid is defined, then a version 8 or better is required.

Reimplemented from sswf::TagBase.

References sswf::TagScalingGrid::GridPreSave(), sswf::TagBase::MinimumVersion(), and sswf::TagBase::PreSave().

ErrorManager::error_code_t TagSprite::Save ( Data data  )  [virtual]

This function saves all the children defined in this sprite, the Sprite header and when the user did not specify them, the TagShowFrame and TagEnd at the end of the list.

Warning:
The size of the sub-list of tags within a sprite is limited to 64Kb.
Parameters:
data The Data buffer in which the sprite is to be saved
Returns:
An error manager code

Implements sswf::TagBase.

References sswf::Data::Append(), sswf::Data::ByteSize(), sswf::TagBase::Children(), sswf::ErrorManager::ERROR_CODE_NONE, sswf::TagBase::FrameCount(), sswf::TagScalingGrid::GridSave(), sswf::TagBaseID::Identification(), sswf::TagBase::Name(), sswf::TagBase::Next(), sswf::Data::OverwriteShort(), sswf::Data::PutShort(), sswf::TagBase::ResetFrames(), sswf::TagBase::Save(), sswf::TagBaseID::SaveID(), sswf::TagBase::SaveTag(), sswf::TagBase::ShowFrame(), sswf::TagBase::SWF_TAG_DEFINE_SPRITE, sswf::TagBase::SWF_TAG_END, and sswf::TagBase::SWF_TAG_SHOW_FRAME.

TagBase::swf_type_t TagSprite::TypeFlags ( void   )  const [virtual]

A Sprite is a definition, it includes references to other objects, it accept scripts, it is a sprite and it has an identifier.

Returns:
The set of flags that the TagSprite support

Implements sswf::TagBase.

References SWF_TYPE_DEFINE, SWF_TYPE_HAS_ID, SWF_TYPE_REFERENCE, SWF_TYPE_SCRIPT, and SWF_TYPE_SPRITE.


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


Generated on Wed Mar 18 15:14:00 2009 for libsswf by  doxygen 1.5.5