Made to Order Software Corporation Logo

libsswf: sswf::TagBase Class Reference

The base of all the tags. More...

#include <libsswf.h>

Inheritance diagram for sswf::TagBase:

:MemoryManager :TagBaseID :TagDoAction :TagEnd :TagExport :TagFrameLabel :TagHeader :TagImport :TagInfo :TagMetadata :TagPlace :TagProductInfo :TagProtect :TagRemove :TagSceneFrameData :TagScriptLimits :TagSetBackgroundColor :TagSetTabIndex :TagShowFrame :TagStartSound

List of all members.


Public Types

enum  swf_tag_t {
  SWF_TAG_UNKNOWN = -1, SWF_TAG_END = 0, SWF_TAG_SHOW_FRAME = 1, SWF_TAG_DEFINE_SHAPE = 2,
  SWF_TAG_PLACE_OBJECT = 4, SWF_TAG_REMOVE_OBJECT = 5, SWF_TAG_DEFINE_BITS = 6, SWF_TAG_DEFINE_BITS_JPEG = 6,
  SWF_TAG_DEFINE_BUTTON = 7, SWF_TAG_JPEG_TABLES = 8, SWF_TAG_SET_BACKGROUND_COLOR = 9, SWF_TAG_DEFINE_FONT = 10,
  SWF_TAG_DEFINE_TEXT = 11, SWF_TAG_DO_ACTION = 12, SWF_TAG_DEFINE_FONT_INFO = 13, SWF_TAG_DEFINE_SOUND = 14,
  SWF_TAG_START_SOUND = 15, SWF_TAG_STOP_SOUND = 16, SWF_TAG_DEFINE_BUTTON_SOUND = 17, SWF_TAG_SOUND_STREAM_HEAD = 18,
  SWF_TAG_SOUND_STREAM_BLOCK = 19, SWF_TAG_DEFINE_BITS_LOSSLESS = 20, SWF_TAG_DEFINE_BITS_JPEG2 = 21, SWF_TAG_DEFINE_SHAPE2 = 22,
  SWF_TAG_DEFINE_BUTTON_COLOR_TRANSFORM = 23, SWF_TAG_PROTECT = 24, SWF_TAG_PLACE_OBJECT2 = 26, SWF_TAG_REMOVE_OBJECT2 = 28,
  SWF_TAG_DEFINE_SHAPE3 = 32, SWF_TAG_DEFINE_TEXT2 = 33, SWF_TAG_DEFINE_BUTTON2 = 34, SWF_TAG_DEFINE_BITS_JPEG3 = 35,
  SWF_TAG_DEFINE_BITS_LOSSLESS2 = 36, SWF_TAG_DEFINE_SPRITE = 39, SWF_TAG_PRODUCT_INFO = 41, SWF_TAG_FRAME_LABEL = 43,
  SWF_TAG_DEFINE_BEHAVIOR = 44, SWF_TAG_SOUND_STREAM_HEAD2 = 45, SWF_TAG_DEFINE_MORPH_SHAPE = 46, SWF_TAG_DEFINE_FONT2 = 48,
  SWF_TAG_DEFINE_INFO = 49, SWF_TAG_TEXT_FIELD = 37, SWF_TAG_DEFINE_FUNCTION = 53, SWF_TAG_PLACE_FUNCTION = 54,
  SWF_TAG_GENERATE_TAG_OBJECT = 55, SWF_TAG_EXPORT = 56, SWF_TAG_IMPORT = 57, SWF_TAG_PROTECT_DEBUG = 58,
  SWF_TAG_DO_INIT_ACTION = 59, SWF_TAG_DEFINE_VIDEO_STREAM = 60, SWF_TAG_VIDEO_FRAME = 61, SWF_TAG_DEFINE_FONT_INFO2 = 62,
  SWF_TAG_DEBUG_ID = 63, SWF_TAG_PROTECT_DEBUG2 = 64, SWF_TAG_SCRIPT_LIMITS = 65, SWF_TAG_SET_TAB_INDEX = 66,
  SWF_TAG_FILE_ATTRIBUTES = 69, SWF_TAG_PLACE_OBJECT3 = 70, SWF_TAG_IMPORT2 = 71, SWF_TAG_DEFINE_FONT_ALIGN_ZONES = 73,
  SWF_TAG_CSM_TEXT_SETTINGS = 74, SWF_TAG_DEFINE_FONT3 = 75, SWF_TAG_METADATA = 77, SWF_TAG_DEFINE_SCALING_GRID = 78,
  SWF_TAG_DEFINE_SHAPE4 = 83, SWF_TAG_DEFINE_MORPH_SHAPE2 = 84, SWF_TAG_ACTIONSCRIPT2 = 72, SWF_TAG_ACTIONSCRIPT2_INSTANTIATE = 76,
  SWF_TAG_ACTIONSCRIPT2_DEFINE = 82, SWF_TAG_SCENE_FRAME_DATA = 86, SWF_TAG_DEFINE_BINARY_DATA = 87, SWF_TAG_DEFINE_FONT_NAME = 88,
  SWF_TAG_DEFINE_BITS_JPEG4 = 90, SWF_TAG_max
}
 Defines all the tags supported by SSWF. More...
typedef long swf_type_t
 An integer holding flags representing the type of a tag.

Public Member Functions

TagBaseChildren (void)
 Retrieve the first child.
TagBaseFindLabelledTag (const char *label) const
 Find a tag in the entire tree.
TagBaseFindTagWithID (sswf_id_t id, bool search_import=true) const
 Find a tag anywhere in the tree using its identifier.
sswf_frame_t FrameCount (void) const
 Returns the current number of frames counted so far.
TagHeaderHeader (void) const
 Search the TagHeader and return its pointer.
const char * Label (void) const
 Return the label of a tag.
virtual void MinimumVersion (unsigned char version)
 Request for a minimum version for this movie.
const char * Name (void) const
 Return the name (i.e. the type) of a tag.
TagBaseNext (void)
 Retrieve the following tag.
virtual ErrorManager::error_code_t OnError (ErrorManager::error_code_t errcode, const char *message,...) const
 Call the error manager OnError() function.
virtual ErrorManager::error_code_t OnError (ErrorManager::error_code_t errcode, const char *message, va_list ap) const
 Call the error manager OnError() function.
TagBaseParent (void)
 Retrieve the parent tag.
virtual ErrorManager::error_code_t ParseTag (swf_tag_t tag, const Data &data)=0
TagBasePrevious (void)
 Retrieve the preceeding tag.
void ResetFrames (void)
 Reset the frames counter.
virtual ErrorManager::error_code_t Save (Data &data)=0
 Pre-save all the children tags of this tag.
ErrorManager::error_code_t SaveString (Data &data, const char *string)
 Save a C string in a Data buffer.
void SetLabel (const char *label)
 Name the tag (user name, internal).
void ShowFrame (void)
 Called automatically each time a TagShowFrame is saved.
virtual swf_type_t TypeFlags (void) const =0
 Retrieve a set of flags desribing the type of the tag.
virtual unsigned char Version (void) const
 Return the current movie version.
sswf_frame_t WhichFrame (void) const
 Frame number of this tag.
virtual ~TagBase ()
 Clean up the base information of a tag.

Static Public Member Functions

static long Double2Signed (double value)
 Converts a double to a 32 bits fixed number.
static long Double2Signed16 (double value)
 Converts a double to a 16 bits fixed number.
static int SaveTag (Data &data, swf_tag_t tag, size_t size)
 Save a tag in the specified Data buffer.
static long SIBitSize (long value)
 Number of bits necessary to save the specified signed value.
static double Signed162Double (long value)
 Converts an 8.8 fixed point number to a double.
static double Signed2Double (long value)
 Converts a 32 bits fixed number to a double.
static long UIBitSize (unsigned long value)
 Number of bits necessary to save the specified unsigned value.

Public Attributes

void * f_userdata
 A pointer you are welcome to use.

Protected Member Functions

virtual ErrorManager::error_code_t OnNewChild (const char *child_name) const
 Check the validity of this child for a parent tag.
virtual ErrorManager::error_code_t PreSave (void)
 Pre-save all the children tags of this tag.
virtual ErrorManager::error_code_t PreSave2ndPass (void)
 Pre-save all the children tags of this tag.
 TagBase (const char *name, TagBase *parent)
 Initialize the base information of a tag.

Private Member Functions

TagBaseFindID (const TagBase *p, sswf_id_t id, bool search_import) const
 Find a tag using its identifier.
TagBaseFindLabel (const TagBase *p, const char *label) const
 Find the tag with the specified user name.

Private Attributes

TagBasef_children
sswf_frame_t f_frames
char * f_label
const char * f_name
TagBasef_next
TagBasef_parent
TagBasef_previous

Detailed Description

The TagBase class is the base class for all the tags. You cannot instantiate a TagBase since it has several pure virtual functions (and it would not make sense.)

The TagBase defines basic functions and functions that the other tags re-implement.

There is a set of functions used to manage the tree of tags:

Name Type of the tag (in a string) Label Retrieve the label of the tag WhichFrame Frame number where this tag resides SetLabel Give a label to the tag FindLabelledTag Search the tree for an object with that name FindTagWithID Search the tree for an object with that identifier Children Get a pointer to all the children of that tag Next Get a pointer to the next tag Previous Get a pointer to the previous tag Parent Get a pointer to the parent Header Get a pointer to the header (parent most tag) TypeFlags Type of a tag defined with flags

The tree is always started with a Header. The header can be the parent of any other tag. Sprites can themselves be composed of a certain number of sub-tags.

Tags use the MinimumVersion() and Version() functions to know more about the version of the current movie being saved.

The following functions are used to help you save the movie. Mainly the tags when saving themselves use these functions as helpers.

Save Save the whole tag and its content PreSave Prepare the tag to be saved (usually to determine the minimum version required to save that tag) PreSave2ndPass Prepare the tag once the exact version of the movie is known (especially used by the TagFont); this may still generate a fatal error if the tag cannot be saved properly SaveString Save a C string SaveTag Save the tag number and size SIBitSize Number of bits necessary to save a specified value UIBitSize Number of bits necessary to save a specified value Double2Signed Transform a double in a fixed value Signed2Double Transform a fixed value to a double

See also:
SWF Alexis' Reference—swf_tag

Member Typedef Documentation

This type is used by the sswf::TagBase::TypeFlags() function. It represents different flags that different tags can set. They are used to determine the generic type of a tag.

The two main groups of tags are the CONTROL tags and the DEFINE tags.


Member Enumeration Documentation

This type lists all the tags supported by SSWF. The numbers are those saved in the final SWF output.

The SWF_TAG_UNKNOWN and SWF_TAG_max are only for the SSWF library to declare unknown tags and know what the largest possible value in the current version.

The SWF_TAG_END has the special value of zero.

Enumerator:
SWF_TAG_UNKNOWN  An undefined or unknown tag.

This special SSWF tag value is used to mark an unknown or undefined tag number. It cannot be saved in an SWF file.



SWF_TAG_END  The last tag in a list of tags.

This tag is used to terminate a list of tags. In general you don't need to terminate your lists since the library does it for you.

Also, the library will ensure that a SWF_TAG_SHOW_FRAME is included.

See also:
SWF_TAG_DEFINE_SPRITE

SWF Alexis' Reference



SWF_TAG_SHOW_FRAME  This tag marks the end of the current frame.

An SWF movie is composed of a set of frames. Each frame is terminated with one SWF_TAG_SHOW_FRAME tag.

Adding multiple SWF_TAG_SHOW_FRAME tags one after another is a way to slow down the playback at different location in your SWF movie.

There should be a show frame tag before any end tag.

See also:
SWF_TAG_END

SWF_TAG_DEFINE_SPRITE

SWF Alexis' Reference



SWF_TAG_DEFINE_SHAPE  Defines a shape.

Of the different graphical objects supported by SWF, the shapes are the primary ones. Shapes are vector based objects.

See also:
SWF_TAG_DEFINE_SHAPE2

SWF_TAG_DEFINE_SHAPE3

SWF_TAG_DEFINE_SHAPE4

SWF_TAG_DEFINE_MORPH_SHAPE

SWF_TAG_DEFINE_MORPH_SHAPE2

SWF Alexis' Reference



SWF_TAG_PLACE_OBJECT  Place an object in the display list.

This tag places an object such as a shape or a sprite in the current display list.

See also:
SWF_TAG_PLACE_OBJECT2

SWF_TAG_PLACE_OBJECT3

SWF_TAG_DEFINE_SPRITE

SWF Alexis' Reference



SWF_TAG_REMOVE_OBJECT  Remove an object from the display list.

This tag removes an object from the display list. You need to specify the object identifier and the depth at which it was inserted.

You can use the SWF_TAG_REMOVE_OBJECT2 to reduce the size of the tag used to remove an object since in that case the identifier is not included. In most cases, the depth is enough since only one object should be inserted at one depth.

See also:
SWF_TAG_REMOVE_OBJECT2

SWF_TAG_DEFINE_SPRITE

SWF Alexis' Reference



SWF_TAG_DEFINE_BITS  This tag is deprecated. Please use SWF_TAG_DEFINE_BITS_JPEG instead.

See also:
SWF_TAG_DEFINE_BITS_JPEG


SWF_TAG_DEFINE_BITS_JPEG  Define a JPEG image data.

This tag is used to define a 2D image.

This is a synonym of SWF_TAG_DEFINE_BITS which is deprecated in the SSWF library.

See also:
SWF_TAG_DEFINE_BITS_LOSSLESS

SWF_TAG_DEFINE_BITS_LOSSLESS2

SWF_TAG_JPEG_TABLES

SWF_TAG_DEFINE_BITS_JPEG2

SWF_TAG_DEFINE_BITS_JPEG3

SWF Alexis' Reference



SWF_TAG_DEFINE_BUTTON  Define some image data.

This tag is used to define a button. This really means an active area (it does not need to react to clicks.)

See also:
SWF_TAG_DEFINE_BUTTON2

SWF_TAG_DEFINE_BUTTON_COLOR_TRANSFORM

SWF Alexis' Reference



SWF_TAG_JPEG_TABLES  Define compression tables for JPEG images.

To save some space, multiple JPEG images may share the same set of compression tables. In reality, this can result in a high decrease in decompressed image quality and in practice it is rarely used these days.

See also:
SWF_TAG_DEFINE_BITS_JPEG

SWF Alexis' Reference



SWF_TAG_SET_BACKGROUND_COLOR  Defines the color to use for the animation background.

To save some space, multiple JPEG images may share the same set of compression tables. In reality, this can result in a high decrease in decompressed image quality and in practice it is rarely used these days.

See also:
SWF Alexis' Reference


SWF_TAG_DEFINE_FONT  Define a version 1 font.

This tag is used to declare an internal or external font definition. Fonts are composed of glyphs which happen to be shapes.

Warning:
This font cannot be referenced from an SWF_TAG_TEXT_FIELD tag. Instead, you need to use an SWF_TAG_DEFINE_FONT2.
See also:
SWF_TAG_DEFINE_FONT2

SWF_TAG_DEFINE_FONT3

SWF_TAG_TEXT_FIELD

SWF_TAG_DEFINE_FONT_ALIGN_ZONES

SWF_TAG_CSM_TEXT_SETTINGS

SWF Alexis' Reference



SWF_TAG_DEFINE_TEXT  Define a graphical object to draw text.

This tag defines a string to be displayed using a specified font.

See also:
SWF_TAG_DEFINE_TEXT2

SWF_TAG_TEXT_FIELD

SWF Alexis' Reference



SWF_TAG_DO_ACTION  Define an SWF ActionScript.

This tag is used to execute an ActionScript.

See also:
SWF_TAG_DO_INIT_ACTION

SWF_TAG_DEFINE_SPRITE

SWF_TAG_ACTIONSCRIPT2

SWF_TAG_ACTIONSCRIPT2_DEFINE

SWF_TAG_ACTIONSCRIPT2_INSTANTIATE

SWF Alexis' Reference



SWF_TAG_DEFINE_FONT_INFO  Define font metrics, names, etc.

This tag is used to define more details about a font such as its name and whether to try to use the system font if available.

See also:
SWF_TAG_DEFINE_FONT_INFO2

SWF_TAG_DEFINE_TEXT

SWF_TAG_TEXT_FIELD

SWF Alexis' Reference



SWF_TAG_DEFINE_SOUND  Define a sound data block.

This tag defines a block of data which represent a sound. It can be played with the SWF_TAG_START_SOUND tag.

See also:
SWF Alexis' Reference


SWF_TAG_START_SOUND  Starts playing a sound.

This tag starts playing a sound previously defined with an SWF_TAG_DEFINE_SOUND tag. The same sound can be played multiple times. Also this tag can be used to stop playing a sound (which is why there are no 'stop sound' tag.)

See also:
SWF_TAG_DEFINE_SOUND

SWF_TAG_DEFINE_SPRITE

SWF Alexis' Reference



SWF_TAG_STOP_SOUND 
SWF_TAG_DEFINE_BUTTON_SOUND  Attach sound effects to a button.

This tag attaches sound effects to a button. The sounds will be played whenever a given event occur.

See also:
SWF Alexis' Reference


SWF_TAG_SOUND_STREAM_HEAD  Header defining a streaming sound.

This tag initializes a streaming sound effect. The actual data of the sound effect is in the SWF_TAG_SOUND_STREAM_BLOCK tags which follow.

See also:
SWF_TAG_SOUND_STREAM_BLOCK

SWF_TAG_SOUND_STREAM_HEAD2

SWF_TAG_DEFINE_SPRITE

SWF Alexis' Reference



SWF_TAG_SOUND_STREAM_BLOCK  Block of data of a streaming sound.

This tag defines data for the streaming sound started with an SWF_TAG_SOUND_STREAM_HEAD or SWF_TAG_SOUND_STREAM_HEAD2 tag.

See also:
SWF_TAG_SOUND_STREAM_HEAD

SWF_TAG_SOUND_STREAM_HEAD2

SWF_TAG_DEFINE_SPRITE

SWF Alexis' Reference



SWF_TAG_DEFINE_BITS_LOSSLESS  Define a PNG image data.

This tag inserts a PNG image. This can be used for much higher image quality, but it is in general larger than a JPEG image.

See also:
SWF_TAG_DEFINE_BITS_LOSSLESS2

SWF_TAG_DEFINE_BITS_JPEG

SWF_TAG_DEFINE_BITS_JPEG2

SWF_TAG_DEFINE_BITS_JPEG3

SWF Alexis' Reference



SWF_TAG_DEFINE_BITS_JPEG2  Define a JPEG image data and tables.

This tag inserts a complete JPEG image, meaning the JPEG data and tables are all saved in this tag.

See also:
SWF_TAG_DEFINE_BITS_JPEG

SWF_TAG_DEFINE_BITS_JPEG3

SWF_TAG_DEFINE_BITS_LOSSLESS

SWF_TAG_DEFINE_BITS_LOSSLESS2

SWF Alexis' Reference



SWF_TAG_DEFINE_SHAPE2  Define an extended shape.

This tag is used to define a shape. This tag extends the SWF_TAG_DEFINE_SHAPE by allowing more vectices within a single shape.

See also:
SWF_TAG_DEFINE_SHAPE

SWF_TAG_DEFINE_SHAPE3

SWF_TAG_DEFINE_SHAPE4

SWF_TAG_DEFINE_MORPH_SHAPE

SWF_TAG_DEFINE_MORPH_SHAPE2

SWF Alexis' Reference



SWF_TAG_DEFINE_BUTTON_COLOR_TRANSFORM  Define a simple color transformation for a button.

This tag is a button complete used to allow a color transformation of the shape used in a button.

If you really need color transformations, it is usually better to use the SWF_TAG_DEFINE_BUTTON2 and get the color transformation on a per state basis.

See also:
SWF_TAG_DEFINE_BUTTON

SWF_TAG_DEFINE_BUTTON2

SWF Alexis' Reference



SWF_TAG_PROTECT  Mark the movie as protected (opposed to open).

This precense of this tag marks the entire movie as protected. The concept is that a protected movie cannot be edited by a person other than the author (who has the source file used to generate this movie.)

This tag was introducted in version 4 and it 100% protects the movie. That is, even the author cannot re-read the movie (unless you either remove this tag from the movie or you use a tool which ignores the tag.)

In order for the authors to be able to re-read the movie later, you need to let the author enter a password. This is done using the SWF_TAG_PROTECT_DEBUG or SWF_TAG_PROTECT_DEBUG2 tag (which tag to use will actually depend on the movie version and not what you want to do with it.)

See also:
SWF_TAG_PROTECT_DEBUG

SWF_TAG_PROTECT_DEBUG2

SWF Alexis' Reference



SWF_TAG_PLACE_OBJECT2  Place or remove an object.

This tag lets you place, replace or remove an object at a given depth.

See also:
SWF_TAG_PLACE_OBJECT

SWF_TAG_PLACE_OBJECT3

SWF_TAG_DEFINE_SPRITE

SWF Alexis' Reference



SWF_TAG_REMOVE_OBJECT2  Remove an object at a specified depth.

This tag lets you remove one object at a given depth without having to specify its reference ID.

See also:
SWF_TAG_REMOVE_OBJECT

SWF_TAG_DEFINE_SPRITE

SWF Alexis' Reference



SWF_TAG_DEFINE_SHAPE3  Defines a shape which supports transparency.

This tag is similar to the SWF_TAG_DEFINE_SHAPE and SWF_TAG_DEFINE_SHAPE2. It adds the capability to define an alpha channel along the shape colors.

See also:
SWF_TAG_DEFINE_SHAPE

SWF_TAG_DEFINE_SHAPE2

SWF_TAG_DEFINE_SHAPE4

SWF_TAG_DEFINE_MORPH_SHAPE

SWF_TAG_DEFINE_MORPH_SHAPE2

SWF Alexis' Reference



SWF_TAG_DEFINE_TEXT2  Defines a text which supports transparency.

This tag is similar to the SWF_TAG_DEFINE_TEXT. It adds the capability to define an alpha channel along the glyphs colors.

See also:
SWF_TAG_DEFINE_TEXT

SWF_TAG_TEXT_FIELD

SWF_TAG_DEFINE_FONT_INFO

SWF_TAG_DEFINE_FONT_INFO2

SWF Alexis' Reference



SWF_TAG_DEFINE_BUTTON2  Defines a button which reacts upon a set of predefined events.

This tag is similar to the SWF_TAG_DEFINE_BUTTON. It adds the capability to define an event which needs to occur for the linked actions to be executed.

See also:
SWF_TAG_DEFINE_BUTTON

SWF Alexis' Reference



SWF_TAG_DEFINE_BITS_JPEG3  Defines a JPEG image with an Alpha channel.

This tag is an extension of the SWF_TAG_DEFINE_BITS_JPEG2 which supports an alpha channel. Thus this tag includes a full JPEG definition and a plane compressed with zlib to define an Alpha channel.

See also:
SWF_TAG_DEFINE_BITS_LOSSLESS

SWF_TAG_DEFINE_BITS_LOSSLESS2

SWF_TAG_DEFINE_BITS_JPEG

SWF_TAG_DEFINE_BITS_JPEG2

SWF Alexis' Reference



SWF_TAG_DEFINE_BITS_LOSSLESS2  Defines a loss less image with an Alpha channel.

This tag is an extension of the SWF_TAG_DEFINE_BITS_LOSSLESS which supports an alpha channel. Thus this tag includes a full JPEG definition and a plane compressed with zlib to define an Alpha channel.

See also:
SWF_TAG_DEFINE_BITS_LOSSLESS

SWF_TAG_DEFINE_BITS_JPEG

SWF_TAG_DEFINE_BITS_JPEG2

SWF_TAG_DEFINE_BITS_JPEG3

SWF Alexis' Reference



SWF_TAG_DEFINE_SPRITE  Defines a sprite: an object composed of any number of other objects.

A sprite is composed of a control list. This means any tag marked as a CONTROL tag such as SWF_TAG_PLACE_OBJECT. You cannot use a definition tag within a sprite. However, you can put a script which creates new objects.

See also:
SWF_TAG_DO_ACTION

SWF_TAG_END

SWF_TAG_FRAME_LABEL

SWF_TAG_PLACE_OBJECT

SWF_TAG_PLACE_OBJECT2

SWF_TAG_PLACE_OBJECT3

SWF_TAG_REMOVE_OBJECT

SWF_TAG_REMOVE_OBJECT2

SWF_TAG_SHOW_FRAME

SWF_TAG_SOUND_STREAM_BLOCK

SWF_TAG_SOUND_STREAM_HEAD

SWF_TAG_SOUND_STREAM_HEAD2

SWF_TAG_START_SOUND

SWF Alexis' Reference



SWF_TAG_PRODUCT_INFO  Defines the name of the product used to create the SWF file.

This tag holds information about the product used to create this SWF file.

It is all defined as numbers (Identifiers). It includes many versions and the date when it was compiled.

See also:
SWF Alexis' Reference


SWF_TAG_FRAME_LABEL  Defines the name of the current frame.

This tag names a frame in order to allow scripts to jump to that frame by name.

A URL can also specify a frame label (since version 6 of SWF).

See also:
SWF_TAG_DO_ACTION

SWF_TAG_DEFINE_SPRITE

SWF Alexis' Reference



SWF_TAG_DEFINE_BEHAVIOR 
SWF_TAG_SOUND_STREAM_HEAD2  Initializes the streaming sound effect.

This tag initializes a streaming sound effect. The actual data of the sound effect is in the SWF_TAG_SOUND_STREAM_BLOCK tags which follow.

See also:
SWF_TAG_SOUND_STREAM_BLOCK

SWF_TAG_SOUND_STREAM_HEAD

SWF_TAG_DEFINE_SPRITE

SWF Alexis' Reference



SWF_TAG_DEFINE_MORPH_SHAPE  Defines a set of shapes to morph.

This tag is similar to the SWF_TAG_DEFINE_SHAPE tag except that it defines two shapes. When placing this shape with SWF_TAG_PLACE_OBJECT2, you can specify the morphing position (percentage).

See also:
SWF_TAG_DEFINE_SHAPE

SWF_TAG_DEFINE_SHAPE2

SWF_TAG_DEFINE_SHAPE3

SWF_TAG_DEFINE_SHAPE4

SWF_TAG_DEFINE_MORPH_SHAPE2

SWF Alexis' Reference



SWF_TAG_DEFINE_FONT2  Defines a set of glyphs in a font.

This tag is used to declare an internal or external font definition. Internal fonts are composed of glyphs which happen to be shapes.

This font (or a newer version) is required if you reference the font from an SWF_TAG_TEXT_FIELD tag.

See also:
SWF_TAG_DEFINE_FONT

SWF_TAG_DEFINE_FONT3

SWF_TAG_TEXT_FIELD

SWF_TAG_DEFINE_FONT_ALIGN_ZONES

SWF_TAG_CSM_TEXT_SETTINGS

SWF Alexis' Reference



SWF_TAG_DEFINE_INFO  Put info in the file.

This tag seems to be used by Macromedia Flash MX to insert some sort of a comment in the SWF movies. Do not use unless you know what you're doing!

See also:
SWF Alexis' Reference


SWF_TAG_TEXT_FIELD  Defines a field of editable text.

This tag is used to create an edit box where end users can type text. You can specify the font, sizes, edit mode (it can even be read-only!)

This can be used as a dynamic box to display a string to the user (i.e. an ActionScript can write a string in a text field.)

See also:
SWF_TAG_DEFINE_TEXT

SWF_TAG_DEFINE_TEXT2

SWF_TAG_DEFINE_FONT_INFO

SWF_TAG_DEFINE_FONT_INFO2

SWF_TAG_SET_TAB_INDEX

SWF Alexis' Reference



SWF_TAG_DEFINE_FUNCTION 
SWF_TAG_PLACE_FUNCTION 
SWF_TAG_GENERATE_TAG_OBJECT 
SWF_TAG_EXPORT  Make objects visible to the external world.

This tag lists objects from this SWF movie that you want to be able to used from other SWF movies with the use of the SWF_TAG_IMPORT tag.

See also:
SWF_TAG_IMPORT

SWF_TAG_IMPORT2

SWF Alexis' Reference



SWF_TAG_IMPORT  Retrieve objects from another SWF movie.

This tag lists the objects from another movie that this SWF movie is interested in. The resulting effect is as if these objects had been defined in this SWF movie. This tag can be used in movies version 5, 6 or 7. Since version 8, use must SWF_TAG_IMPORT2.

See also:
SWF_TAG_EXPORT

SWF_TAG_IMPORT2

SWF Alexis' Reference



SWF_TAG_PROTECT_DEBUG  Mark the animation as protected and include a password.

This tag is used to add a password to your animation. This in effect protects the movie so you are the only one who can load it (and thus debug it.)

This tag is only available in SWF version 5.

Warning:
Of course, tools which ignore this tag will be capable of reading your entire animation since this is just one tag among others and it isn't used to decode the rest of the animation.
See also:
SWF_TAG_PROTECT

SWF_TAG_PROTECT_DEBUG2

SWF Alexis' Reference



SWF_TAG_DO_INIT_ACTION  Execute actions only once.

This tag is like the SWF_TAG_DO_ACTION but it is executed at most once per session even when the display list loops through that tag over and over again.

"It is often used to initialize a sprite"—which means that quite often it will be used to initialize an object class.

Note that the tag is not part of the sprite. It references it.

See also:
SWF_TAG_DO_ACTION

SWF_TAG_ACTIONSCRIPT2

SWF_TAG_ACTIONSCRIPT2_DEFINE

SWF_TAG_ACTIONSCRIPT2_INSTANTIATE

SWF Alexis' Reference



SWF_TAG_DEFINE_VIDEO_STREAM 
SWF_TAG_VIDEO_FRAME 
SWF_TAG_DEFINE_FONT_INFO2  Defines a font including language specifications.

This tag declares additional information about a font (i.e. use a corresponding system font name or a list of glyphs to declare an embedded font.)

This is similar to the SWF_TAG_DEFINE_FONT_INFO plus the language support.

See also:
SWF_TAG_DEFINE_FONT_INFO

SWF_TAG_DEFINE_TEXT

SWF_TAG_TEXT_FIELD

SWF Alexis' Reference



SWF_TAG_DEBUG_ID 
SWF_TAG_PROTECT_DEBUG2  Mark the animation as protected and include a password.

This tag is used to add a password to your animation. This in effect protects the movie so you are the only one who can load it (and thus debug it.)

This tag is available since SWF version 6. It includes an additional 2 bytes (compared to SWF_TAG_PROTECT_DEBUG) for what looks like a version or a compression mode for the password.

Warning:
Of course, tools which ignore this tag will be capable of reading your entire animation since this is just one tag among others and it isn't used to decode the rest of the animation.
See also:
SWF Alexis' Reference


SWF_TAG_SCRIPT_LIMITS  Define different limits for script execution.

This tag is used to change script limits. For instance, it happens that someone writes a loop which lasts forever (in computer world this means more than one frame). This may be a problem when you are trying to playback streaming sound, a realtime video and complex animated sprites.

The default is to stop these scritps after a small amount of time elapsed. If that time is too small, then you can increase it with this tag.

See also:
SWF Alexis' Reference


SWF_TAG_SET_TAB_INDEX  Define the position or indices of each tab stops.

This tag is used in link with the HTML support of the SWF_TAG_TEXT_FIELD tag.

See also:
SWF_TAG_TEXT_FIELD

SWF Alexis' Reference



SWF_TAG_FILE_ATTRIBUTES  Define some attributes in regard to the use of the file.

This tag must be the very first after the header. It is used to make sure that the player can support the movie. A set of flags are defined to determine whether all the capabilities required by that movie can be met.

The library hides this tag within the sswf::TagHeader object.

See also:
SWF_TAG_TEXT_FIELD

SWF Alexis' Reference



SWF_TAG_PLACE_OBJECT3  Place or remove an object.

This place object adds support for blend modes, filters and bitmap caching which the SWF_TAG_PLACE_OBJECT2 does not support.

It can be used inside a sprite.

See also:
SWF_TAG_PLACE_OBJECT

SWF_TAG_PLACE_OBJECT2

SWF_TAG_DEFINE_SPRITE

SWF Alexis' Reference



SWF_TAG_IMPORT2  Retrieve objects from another SWF movie.

This tag lists the objects from another movie that this SWF movie is interested in. The resulting effect is as if these objects had been defined in this SWF movie.

Use this tag instead of SWF_TAG_IMPORT in a version 8 or newer of SWF. You must use SWF_TAG_IMPORT for an animation version 5, 6 ot 7.

See also:
SWF_TAG_IMPORT

SWF_TAG_EXPORT

SWF Alexis' Reference



SWF_TAG_DEFINE_FONT_ALIGN_ZONES  Define hints on how to align the glyphs of a font.

This tag defines a few hints used to know how to place glyphs on the screen. This is useful to avoid glyphs rendered on half pixels and thus getting too blurry. This alignment definition is really only partially useful for italic fonts.

See also:
SWF_TAG_DEFINE_FONT

SWF_TAG_DEFINE_FONT2

SWF_TAG_DEFINE_FONT3

SWF_TAG_CSM_TEXT_SETTINGS

SWF Alexis' Reference



SWF_TAG_CSM_TEXT_SETTINGS  Define hints on how to align and render the glyphs of a font.

This tag defines a few hints used to know how to place glyphs on the screen and which renderer to use to draw the font.

Note that the selection of the mode is really poor since it gives you a way to force CRT or LCD monitor but nothing dynamic...

See also:
SWF_TAG_DEFINE_FONT

SWF_TAG_DEFINE_FONT2

SWF_TAG_DEFINE_FONT3

SWF_TAG_DEFINE_FONT_ALIGN_ZONES

SWF Alexis' Reference



SWF_TAG_DEFINE_FONT3  Defines a set of glyphs in a font.

This tag is used to declare an internal or external font definition. Internal fonts are composed of glyphs which happen to be shapes.

The main difference between this font definition and the SWF_TAG_DEFINE_FONT2 is that sub-pixels have an extra 20 sub-divisions.

See also:
SWF_TAG_DEFINE_FONT

SWF_TAG_DEFINE_FONT2

SWF_TAG_DEFINE_FONT_ALIGN_ZONES

SWF_TAG_CSM_TEXT_SETTINGS

SWF Alexis' Reference



SWF_TAG_METADATA  Defines humain readable information about the animation.

This tag needs to be defined near the beginning of the movie and it includes a set of humain readable strings saved in a string formatted using some XML. The only purpose of this tag (at this time) is for search engines to reference your animation properly without having to understand the complex format that is SWF.

See also:
SWF Alexis' Reference


SWF_TAG_DEFINE_SCALING_GRID  Defines a grid used to resize an object.

This tag defines a rectangle within the specified shape which is fully resized. The top and bottom edges are only stretched horizontally; the left and right edges are only stretched vertically; the corners are never resized.

This is quite used by sswf::TagButton and sswf::TagSprite.

See also:
SWF_TAG_DEFINE_BUTTON

SWF_TAG_DEFINE_BUTTON2

sswf::TagButton

SWF_TAG_DEFINE_SPRITE

sswf::TagSprite

SWF Alexis' Reference



SWF_TAG_DEFINE_SHAPE4  Defines a shape with enhanced strokes.

This shape is similar to all the previous shapes plus it lets you choose which stroke to use. You can select how the strokes are rendered and whether they follow the scaling factor.

See also:
SWF_TAG_DEFINE_SHAPE

SWF_TAG_DEFINE_SHAPE2

SWF_TAG_DEFINE_SHAPE3

SWF_TAG_DEFINE_MORPH_SHAPE

SWF_TAG_DEFINE_MORPH_SHAPE2

SWF Alexis' Reference



SWF_TAG_DEFINE_MORPH_SHAPE2  Defines a morphing shape with enhanced strokes.

This morphing shape is similar to SWF_TAG_DEFINE_MORPH_SHAPE but it also support a way for the user to choose which stroke to use.

See also:
SWF_TAG_DEFINE_SHAPE

SWF_TAG_DEFINE_SHAPE2

SWF_TAG_DEFINE_SHAPE3

SWF_TAG_DEFINE_SHAPE4

SWF_TAG_DEFINE_MORPH_SHAPE

SWF Alexis' Reference



SWF_TAG_ACTIONSCRIPT2  Defines a block of ActionScript version 2.

This tag defines a list of actions to be executed. This is similar to the SWF_TAG_DOACTION except that it supports a really object oriented definition set.

See also:
SWF_TAG_DOACTION

SWF Alexis' Reference



SWF_TAG_ACTIONSCRIPT2_INSTANTIATE  Instantiate objects from a previously defined ActionScript version 2 block.

This tag defines a list of objects to create. The objects are defined in the SWF_TAG_ACTIONSCRIPT2_DEFINE referenced by this tag.

See also:
SWF_TAG_ACTIONSCRIPT2_DEFINE

SWF Alexis' Reference



SWF_TAG_ACTIONSCRIPT2_DEFINE  Create an ActionScript version 2 which can later be referenced.

This tag defines a list of classes to instantiate later with the use of an SWF_TAG_ACTIONSCRIPT2_INSTANTIATE.

See also:
SWF_TAG_ACTIONSCRIPT2_INSTANTIATE

SWF Alexis' Reference



SWF_TAG_SCENE_FRAME_DATA  Define raw data for a scene and frame.

This tag defines raw data usable by a scene and frame.

See also:
SWF_TAG_DEFINE_BINARY_DATA

SWF Alexis' Reference



SWF_TAG_DEFINE_BINARY_DATA  Define binary data a script can use later.

This tag defines some user defined binary data.

See also:
SWF_TAG_SCENE_FRAME_DATA

SWF Alexis' Reference



SWF_TAG_DEFINE_FONT_NAME  Define the name and copyright of a font.

This tag defines the legal name and copyright of an embedded font.

See also:
SWF_TAG_DEFINE_FONT

SWF_TAG_DEFINE_FONT2

SWF_TAG_DEFINE_FONT3

SWF_TAG_DEFINE_FONT_INFO

SWF_TAG_DEFINE_FONT_INFO2

SWF Alexis' Reference



SWF_TAG_DEFINE_BITS_JPEG4 
SWF_TAG_max  Mark the end of the list of tags.

No tag is defined beyond this point, SWF_TAG_max included, in what the SSWF library supports. Also, new tags may be created by Macromedia beyond this point before SSWF is updated.

This can be used for a rather weak test to know whether a tag number is valid. It is a weak test since many values between 0 and SWF_TAG_max are not defined.


Constructor & Destructor Documentation

TagBase::~TagBase (  )  [virtual]

This function takes care of deleting all the children of a tag and unlinking the tag from its sibling and/or parent.

References sswf::assert(), f_children, f_label, f_name, f_next, f_parent, and f_previous.

TagBase::TagBase ( const char *  name,
TagBase parent 
) [protected]

Each tag needs to have a name. The name is actually the type of the tag and not a user name. This is enforced by all the derived tags (i.e. the users of the library cannot themselves define this name.)

The parent can be set to NULL (especially if you are creating the TagHeader object). Otherwise it needs to be a tag which supports having children (i.e. TagHeader or TagSprite).

Note:
It is possible to add a TagEnd which is not at the very end of the movie. This is useful in order to test the movie up to that point.
Bug:
When creating a child (i.e. the parent pointer is not null) the new child is linked at the end of the existing list of children. At this time, there is no way to change the order of children other than creating a new parent and add all the children in the new order...
The parent is now given a chance to reject a child. When that happens, the constructor returns normally, but the new tag is not becoming a child of the specified parent. You can test this with the following line of code:

        if(sswf::TagBase::Parent() != parent) ... // oops!

Parameters:
name The type of the tag in the form of a string
parent The parent tag (a header or a sprite)

References sswf::ErrorManager::ERROR_CODE_NONE, f_children, f_frames, f_label, f_name, f_next, f_parent, f_previous, f_userdata, Name(), OnError(), and OnNewChild().


Member Function Documentation

TagBase * TagBase::Children ( void   ) 

The SWF movies are organized as a tree of tags. The top most is the Header. The Header includes many definition and control tags. It can include Sprites. Sprites can themselves include control tags.

The pointer returned by this function represents the first child.

Returns:
A pointer to a tag or NULL
See also:
TagBase::Header(void) const

TagBase::Parent(void)

TagBase::Next(void)

TagBase::Previous(void)

References f_children.

Referenced by sswf::TagHeader::PreSave(), PreSave(), PreSave2ndPass(), sswf::TagSprite::Save(), and sswf::TagHeader::Save().

long TagBase::Double2Signed ( double  value  )  [static]

This function converts a double to a fixed number defined on 32 bits.

Note that at this time the function does not test for overflow or underflow errors.

Bug:
If the number cannot fit a long, then overflows will happen.
Parameters:
value The double to convert to a fixed number of 32 bits
Returns:
Fixed number of 32 bits (16.16 fixed point)
See also:
TagBase::Double2Signed16(double value)

TagBase::Signed2Double(long value)

TagBase::Signed162Double(double value)

Referenced by sswf::Matrix::ComputeMatrix().

long TagBase::Double2Signed16 ( double  value  )  [static]

This function converts a double to a fixed number defined on 16 bits (i.e. 8 bits before and 8 bits after the decimal point.)

This function clamps the value between -32768 and +32767.

Bug:
If the number cannot fit a long, then overflows will happen.
Parameters:
[in] value The double to convert to a fixed number of 16 bits
Returns:
A signed fixed number of 16 bits (8.8 fixed point)
See also:
TagBase::Double2Signed(double value)

TagBase::Signed2Double(long value)

TagBase::Signed162Double(double value)

Referenced by sswf::ColorTransform::IsNull(), sswf::ColorTransform::IsSolidCompatible(), and sswf::ColorTransform::Save().

TagBase * TagBase::FindID ( const TagBase p,
sswf_id_t  id,
bool  search_import 
) const [private]

Search the tree for a tag with the specified identifier.

This function searches for the first tag in the specified list. It then tests that tag with the specified identifier. If it matches, it returns that object. Otherwise it will check all the children of that object. If one of the child matches, then that child is returned. Otherwise the next tag is tested.

Each object is expected to have a unique identifier within a single movie. This is enforced by the automatic assignment of identifiers at the time a TagBaseID is created.

Note that a tag which has no identifier will never be returned by this function.

Note:
A valid identifier cannot be zero or have bit 15 set.
Parameters:
p Start with the siblings of this tag
id The identifier to search for
search_import Whether to search within TagImport tags
Returns:
The pointer of the tag with the specified identifier or NULL
See also:
TagBase::FindLabel(const TagBase *p, const char *label)

TagBase::FindLabelledTag(const char *label) const

TagBase::FindTagWithID(sswf_id_t id, bool search_import) const

References sswf::assert(), f_children, f_next, f_previous, sswf::TagBaseID::HasIdentification(), Name(), SSWF_ID_NONE, SWF_TYPE_HAS_ID, and TypeFlags().

Referenced by FindTagWithID().

TagBase * TagBase::FindLabel ( const TagBase p,
const char *  label 
) const [private]

This function is used to search a tag using the label set using the SetLabel(const char *label) function.

All the siblings of the specified tag are search as well as all the children. The pointer of the first object with the same name is returned.

The search first check if the first object in the specified tree matches. If not, then its children are searched. If none of its children are searched then the next object is checked. Usually, the pointer to you TagHeader is used.

Parameters:
p A pointer to a tag, usually the Header()
label The label to search for
Returns:
A pointer to the tag with the specified label or NULL
Bug:
This function is slow.
See also:
TagBase::SetLabel(const char *label)

TagBase::FindLabelledTag(const char *label) const

References f_children, f_label, f_next, and f_previous.

Referenced by FindLabelledTag().

TagBase * TagBase::FindLabelledTag ( const char *  label  )  const

This function is the same as the sswf::TagBase::FindLabel(const TagBase *p, const char *label) const but it will always start the search from the Header() tag.

If the label is set to NULL or the empty string, then the root tag is returned (i.e. the Header() tag).

Parameters:
label The label to search for
Returns:
A pointer to the tag with the specified label or NULL
See also:
sswf::TagBase::FindLabel(const TagBase *p, const char *label) const

sswf::TagBase::SetLabel(const char *label)

References f_parent, and FindLabel().

Referenced by sswf::ActionWaitForFrame::SaveData(), and sswf::ActionGoto::SaveData().

TagBase * TagBase::FindTagWithID ( sswf_id_t  id,
bool  search_import = true 
) const

Search the entire tree for a tag with the specified identifier.

This function calls TagBase::FindID(const TagBase *p, sswf_id_t id, bool search_import) const with the Header() as the starting point tag.

Note that the header has no identifier and thus the header will never be returned.

Note:
A valid identifier cannot be zero or have bit 15 set.
Parameters:
id The identifier to search for
search_import Whether to search within TagImport tags
Returns:
The pointer of the tag with the specified identifier or NULL
See also:
TagBase::FindLabel(const TagBase *p, const char *label)

TagBase::FindLabelledTag(const char *label) const

TagBase::FindID(const TagBase *p, sswf_id_t id, bool search_import) const

References f_parent, and FindID().

Referenced by sswf::TagEditText::ParseTag(), and sswf::TagExport::PreSave().

sswf_frame_t TagBase::FrameCount ( void   )  const

This function is called to know how many TagShowFrame have been saved so far (at the end, to know how many frames were saved total.)

See also:
TagShowFrame::Save(Data& data)

TagBase::ShowFrame(void)

TagBase::ResetFrames(void)

References f_frames.

Referenced by sswf::TagSprite::Save(), and sswf::TagHeader::Save().

TagHeader * TagBase::Header ( void   )  const

This function searches for the Header of a movie.

It does so by testing 'this' tag name to "header". If it is equal return 'this' tag. Otherwise try again with the parent tag.

If the Header is not found, then NULL is returned.

Returns:
The Header or NULL
See also:
TagBase::Parent(void) const

References f_parent, and Name().

Referenced by sswf::TagImport::AddName(), MinimumVersion(), sswf::TagBaseID::NoIdentification(), OnError(), sswf::TagButton::ParseTag(), sswf::TagShape::Save(), SaveString(), sswf::TagBaseID::TagBaseID(), and Version().

const char * TagBase::Label ( void   )  const

The label of a tag is a user specified name. It can be anything and it is set using TagBase::SetLabel(const char *label).

Returns:
A pointer to the label.
Bug:
The pointer returned is the copy kept by the object. DO NOT MODIFY IT!

References f_label.

void TagBase::MinimumVersion ( unsigned char  version  )  [virtual]

This function is to be used within the PreSave() functions.

Using this function outside that realm results in an error.

Whenever the movie is to be saved, a call to all the tags PreSave() functions is made. If any tag requires a minimum version to be saved (i.e. TagMetadata requires at least version 8 to be legally saved in an SWF movie,) this function is called with that minimum requirement.

Note that this function calls the function of the same name in the Header(). Trying to call this function before a save will have no effect. Instead, use the TagHeader::SetMinimumVersion(unsigned char version).

See also:
TagHeader::MinimumVersion(unsigned char version)

Reimplemented in sswf::TagHeader.

References Header(), and sswf::TagHeader::MinimumVersion().

Referenced by sswf::TagScalingGrid::GridPreSave(), sswf::TagText::PreSave(), sswf::TagSprite::PreSave(), sswf::TagSound::PreSave(), sswf::TagShape::PreSave(), sswf::TagSetTabIndex::PreSave(), sswf::TagScriptLimits::PreSave(), sswf::TagSceneFrameData::PreSave(), sswf::TagRemove::PreSave(), sswf::TagProtect::PreSave(), sswf::TagPlace::PreSave(), sswf::TagMetadata::PreSave(), sswf::TagInfo::PreSave(), sswf::TagProductInfo::PreSave(), sswf::TagImport::PreSave(), sswf::TagImage::PreSave(), sswf::TagFrameLabel::PreSave(), sswf::TagFont::PreSave(), sswf::TagExport::PreSave(), sswf::TagEditText::PreSave(), sswf::TagDoAction::PreSave(), sswf::TagButton::PreSave(), sswf::TagBinaryData::PreSave(), sswf::TagFont::PreSave2ndPass(), and sswf::TagCSMTextSettings::PreSaveCSMTextSettings().

const char * TagBase::Name ( void   )  const

This function returns the name of this tag.

The name of a tag is actually a hard coded type name. For instance, the TagHeader's name is "header".

Returns:
The name of this tag
Bug:
The name is not copied. DO NOT MODIFY IT!

References f_name.

Referenced by sswf::TagFont::AddGlyph(), FindID(), Header(), sswf::TagHeader::PreSave(), sswf::TagExport::PreSave(), sswf::TagSprite::Save(), sswf::TagHeader::Save(), sswf::TagEnd::Save(), and TagBase().

TagBase * TagBase::Next ( void   ) 

Tags are defined in a list which includes many siblings. It is possible to walk the list using the Next() and Previous() functions.

The last tag of a list has a NULL Next() pointer.

Returns:
A pointer to a tag or NULL
See also:
TagBase::Parent(void)

TagBase::Header(void) const

TagBase::Previous(void)

TagBase::Children(void)

References f_next.

Referenced by sswf::TagHeader::PreSave(), PreSave(), PreSave2ndPass(), sswf::TagSprite::Save(), and sswf::TagHeader::Save().

ErrorManager::error_code_t TagBase::OnError ( ErrorManager::error_code_t  errcode,
const char *  message,
  ... 
) const [virtual]

This function calls the sswf::ErrorManager::OnError(error_code_t errcode, const char *message, va_list ap) const whenever possible.

The function fails whenever the tag was not correctly initialized with a valid sswf::TagHeader as the root tag.

Parameters:
errcode The code of this error
message The message for this error
... Arguments for the message
Returns:
Usually the input error code; the user may change it

Reimplemented in sswf::TagHeader.

References Header(), and sswf::TagHeader::OnError().

ErrorManager::error_code_t TagBase::OnError ( ErrorManager::error_code_t  errcode,
const char *  message,
va_list  ap 
) const [virtual]

This function calls the sswf::ErrorManager::OnError(error_code_t errcode, const char *message, va_list ap) const whenever possible.

The function fails whenever the tag was not correctly initialized with a valid sswf::TagHeader as the root tag.

Parameters:
errcode The code of this error
message The message for this error
ap Arguments for the message
Returns:
Usually the input error code; the user may change it

Reimplemented in sswf::TagHeader.

References Header(), and sswf::TagHeader::OnError().

Referenced by sswf::TagShape::AddEdge(), sswf::TagFont::AddGlyph(), sswf::TagShape::AddMove(), sswf::TagShape::AddStyle(), sswf::TagText::AddText(), sswf::TagText::DefineText(), sswf::TagFont::GlyphInfo(), sswf::Action::OnError(), sswf::TagSound::PreSave(), sswf::TagStartSound::PreSave(), sswf::TagImage::PreSave(), sswf::TagExport::PreSave(), sswf::TagEditText::PreSave(), sswf::TagButton::PreSave(), sswf::TagText::RecordSetup(), sswf::TagSound::Save(), sswf::TagShape::Save(), sswf::TagPlace::Save(), sswf::TagMetadata::Save(), sswf::TagImage::Save(), sswf::TagFont::Save(), sswf::TagButton::Save(), sswf::TagImage::SaveJPEG(), sswf::TagShape::SaveStylesCount(), sswf::TagShape::SaveWithoutStyles(), sswf::TagSound::Set8Bits(), sswf::TagImage::SetAlpha(), sswf::TagShape::SetBounds(), sswf::TagSceneFrameData::SetFileData(), sswf::TagSound::SetFilename(), sswf::TagSound::SetFormat(), sswf::TagSound::SetMono(), sswf::TagButton::SetState(), sswf::TagShape::SetStrokesBounds(), sswf::TagFont::SetUsedGlyphs(), and TagBase().

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

Whenever a tag is added as a child to another tag, the parent has a chance to tell whether it accepts the child.

For instance, a sswf::TagHeader cannot be a child of any other tag.

The sswf::TagSprite also only accept a small set of the control tags.

Warning:
This function is called from the constructor and thus it cannot use any virtual function on the child. This is why you only receive the name of the child and not a pointer to it.
See also:
sswf::TagHeader::OnNewChild(const char *child)

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

Reimplemented in sswf::TagHeader, and sswf::TagSprite.

References sswf::ErrorManager::ERROR_CODE_CHILDREN_NOT_SUPPORTED.

Referenced by TagBase().

TagBase * TagBase::Parent ( void   ) 

This function returns the parent of a tag. All tags except the Header() will have a parent.

At this time, only the Header and a Sprite can be parents.

This function is used to find the Header().

See also:
TagBase::Children(void)

TagBase::Next(void)

TagBase::Previous(void)

TagBase::Header(void) const

References f_parent.

Referenced by sswf::TagShowFrame::Save(), and sswf::TagEnd::Save().

ErrorManager::error_code_t TagBase::PreSave ( void   )  [protected, virtual]

This function calls the PreSave() function of all the children unless one returns a non-zero value in which case that value will be returned and the process stopped.

This function is aumatically called by the TagHeader and TagSprite in order to pre-save their children.

The PreSave() functions are expected to be used to test whether a tag can be saved. Especially, most tags will call the MinimumVersion() function with the version required to save these tags. This ensures that you can save the entire movie in a valid SWF. Please, see the reference of each tag for more information about what their PreSave() function does.

You should not have to call this function directly.

Returns:
Zero if the PreSave() succeeds; non-zero otherwise

Reimplemented in sswf::TagHeader, sswf::TagDoAction, sswf::TagMetadata, sswf::TagPlace, sswf::TagRemove, sswf::TagSceneFrameData, sswf::TagScriptLimits, sswf::TagSetTabIndex, sswf::TagFrameLabel, sswf::TagExport, sswf::TagImport, sswf::TagProtect, sswf::TagProductInfo, sswf::TagInfo, sswf::TagStartSound, sswf::TagBinaryData, sswf::TagButton, sswf::TagFont, sswf::TagEditText, sswf::TagImage, sswf::TagShape, sswf::TagSound, sswf::TagSprite, and sswf::TagText.

References Children(), sswf::ErrorManager::ERROR_CODE_NONE, Next(), and PreSave().

Referenced by sswf::TagSprite::PreSave(), sswf::TagHeader::PreSave(), and PreSave().

ErrorManager::error_code_t TagBase::PreSave2ndPass ( void   )  [protected, virtual]

The PreSave2ndPass() is the same as the PreSave() function for the TagBase(). It calls the PreSave2ndPass() of all the children unless one returns a non-zero value in which case the process stops and that value is returned.

The second pass is used to check more information about the tag and prepare data such as tables. This is especially necessary for the TagFont which needs to create all the character tables to know the offsets to characters, etc. This is important because that tag may be accessed before its Save() function is called and it would still need to know where these characters are!

Returns:
Zero when the PreSave2ndPass() successed; non-zero otherwise

Reimplemented in sswf::TagFont.

References Children(), sswf::ErrorManager::ERROR_CODE_NONE, Next(), and PreSave2ndPass().

Referenced by sswf::TagHeader::DefineMinimumVersion(), and PreSave2ndPass().

TagBase * TagBase::Previous ( void   ) 

Tags are defined in a list which includes many siblings. It is possible to walk the list using the Next() and Previous() functions.

The first tag of a list has a NULL Previous() pointer.

Returns:
A pointer to a tag or NULL
See also:
TagBase::Next(void)

TagBase::Header(void) const

TagBase::Parent(void)

TagBase::Children(void)

References f_previous.

Referenced by sswf::TagEnd::Save().

void TagBase::ResetFrames ( void   ) 

This function is called once when the Save() starts to reset the frame counter to zero.

See also:
TagShowFrame::Save(Data& data)

TagBase::ShowFrame(void)

TagBase::FrameCount(void) const

References f_frames.

Referenced by sswf::TagSprite::Save(), and sswf::TagHeader::Save().

TagBase::Save ( Data data  )  [pure virtual]

The Save() function is the one you want to call to save an SWF movie.

You may use the Save() on any tag, however, if you do so you need to properly initialize the system. For that purpose, you may want to look at the code in the TagHeader::Save(Data& data) function.

Otherwise, you simply have to call the Save() function of the TagHeader. That will save the entire movie with the smallest possible version (or fail if something cannot be saved with the present parameters.)

The TagHeader::Save() function first calls the PreSave() functions, the PreSave2ndPass() and then the Save() functions of all the children.

The other tag Save() function simply save the tag within the specified Data buffer. Note however that the TagSprite will also call the Save() function of all of its children. Yet it does not call the PreSave() functions.

The Save() function saves the movie in a Data buffer. Later you need to save that buffer on disk or some other medium.

Returns:
Zero when the Save() succeeds, non-zero if it fails
See also:
TagBase::PreSave()

TagBase::PreSave2ndPass()

Implemented in sswf::TagHeader, sswf::TagDoAction, sswf::TagMetadata, sswf::TagPlace, sswf::TagRemove, sswf::TagSceneFrameData, sswf::TagScriptLimits, sswf::TagSetTabIndex, sswf::TagSetBackgroundColor, sswf::TagShowFrame, sswf::TagEnd, sswf::TagFrameLabel, sswf::TagExport, sswf::TagImport, sswf::TagProtect, sswf::TagProductInfo, sswf::TagInfo, sswf::TagStartSound, sswf::TagBinaryData, sswf::TagButton, sswf::TagFont, sswf::TagEditText, sswf::TagImage, sswf::TagShape, sswf::TagSound, sswf::TagSprite, and sswf::TagText.

Referenced by sswf::TagSprite::Save(), and sswf::TagHeader::Save().

ErrorManager::error_code_t TagBase::SaveString ( Data data,
const char *  string 
)

Save a C string in the specified Data buffer. This is a simple process since you just have to save the string and then add a null terminator. However, in movies prior version 6, you need to convert the string to some locale encoding specified by the user. This is done transparently whenever this function is called.

This function calls the TagHeader::SaveEncodedString() function. Note that the function will fail if the tag was not created in a TagHeader.

Returns:
The length of the string not including the null terminator or -1 when an error occured
See also:
TagHeader::SaveEncodedString(Data& data, const char *string)

References sswf::ErrorManager::ERROR_CODE_NO_HEADER, Header(), and sswf::TagHeader::SaveEncodedString().

Referenced by sswf::TagPlace::Save(), sswf::TagInfo::Save(), sswf::TagImport::Save(), sswf::TagFrameLabel::Save(), sswf::TagExport::Save(), sswf::TagEditText::Save(), and sswf::Action::SaveString().

int TagBase::SaveTag ( Data data,
swf_tag_t  tag,
size_t  size 
) [static]

This function generates a tag header given a tag and a size. It knows how to handle small (63 bytes or less) tags and large (64 or more) tags.

Note:
The main problem is that you need to know the size of the tag at the time you call this function and the data of the tag have come after.
In most cases, this is handled by first saving all the data in a separate buffer, get the size of that buffer, create the tag and then copy the separate buffer in this Data buffer.

Parameters:
data The buffer where the tag is to be saved
tag The SWF tag to save
size The size of the tag
Bug:
This function has no concept of the tag being saved and thus it does not check the validity of the tag nor of the size for that tag.
See also:
TagBase::SaveString(Data& data, const char *string)

References sswf::Data::PutLong(), sswf::Data::PutShort(), SWF_TAG_DEFINE_BITS_JPEG, SWF_TAG_DEFINE_BITS_JPEG2, SWF_TAG_DEFINE_BITS_JPEG3, SWF_TAG_DEFINE_BITS_LOSSLESS, SWF_TAG_DEFINE_BITS_LOSSLESS2, and SWF_TAG_SOUND_STREAM_BLOCK.

Referenced by sswf::TagScalingGrid::GridSave(), sswf::TagText::Save(), sswf::TagSprite::Save(), sswf::TagSound::Save(), sswf::TagStartSound::Save(), sswf::TagShowFrame::Save(), sswf::TagShape::Save(), sswf::TagSetTabIndex::Save(), sswf::TagSetBackgroundColor::Save(), sswf::TagScriptLimits::Save(), sswf::TagSceneFrameData::Save(), sswf::TagRemove::Save(), sswf::TagProtect::Save(), sswf::TagPlace::Save(), sswf::TagMetadata::Save(), sswf::TagInfo::Save(), sswf::TagProductInfo::Save(), sswf::TagImport::Save(), sswf::TagImage::Save(), sswf::TagHeader::Save(), sswf::TagFrameLabel::Save(), sswf::TagFont::Save(), sswf::TagExport::Save(), sswf::TagEnd::Save(), sswf::TagEditText::Save(), sswf::TagDoAction::Save(), sswf::TagButton::Save(), sswf::TagBinaryData::Save(), and sswf::TagCSMTextSettings::SaveCSMTextSettings().

void TagBase::SetLabel ( const char *  label  ) 

Each tag can receive a name. This is used on tags which need to be found later. Mainly, tags which an action script needs to access.

This name is NOT saved in the final output. It is only a convenience of the SSWF library. Some tags accept a name which will be saved in the SSWF library.

A label name will often be used so you can later search for a tag to go to from within an action script.

Note:
The name can be specified in UTF-8 or any other format. This is specific to your code.
Parameters:
label The name of this tag
Bug:
The system does not search the existing tree to know whether the specified label is already in use (for speed reasons). It is expected that the developer using the SSWF library knows how to avoid reusing the same name.
That developer can test whether the name is already in use by calling the FindLabel() function first. If it returns a non-null pointer, then the specified label is already in use.

If the developer has a sorted array with all the names, it will be a lot faster to search than the tree of tags!

See also:
TagPlace::SetName(const char *name)

TagBase::FindLabel(const TagBase *p, const char *label)

TagBase::FindLabelledTag(const char *label) const

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

void TagBase::ShowFrame ( void   ) 

This function is automatically called each time a TagShowFrame is saved in the output movie. This is used to know the total number of frames saved in a movie and add that information to the TagHeader.

See also:
TagShowFrame::Save(Data& data)

TagBase::ResetFrames(void)

TagBase::FrameCount(void) const

References f_frames.

Referenced by sswf::TagSprite::Save(), sswf::TagShowFrame::Save(), sswf::TagHeader::Save(), and sswf::TagEnd::Save().

long TagBase::SIBitSize ( long  value  )  [static]

This function counts the number of bits necessary to save the specified signed value in a bit field.

This is used by many tags to know what size to use to save a set of values such as the coordinates of a rectangle.

The input value is expected to be signed and thus a value such as -1 will get a size of 1 and not 32.

Parameters:
value The signed value of which the number of bits is to be computed
Returns:
The number of bits required to save that value
See also:
TagBase::UIBitSize(unsigned long value)

Referenced by sswf::Matrix::Save(), sswf::ColorTransform::Save(), sswf::SRectangle::Save(), sswf::TagText::Save(), sswf::Edges::SaveEdge(), and sswf::TagShape::SaveSetup().

double TagBase::Signed162Double ( long  value  )  [static]

This function converts a 16 bits fixed point, defined as an 8 bits before and 8 bits after the decimal point, into a double floating point value.

Parameters:
value The 8.8 fixed point value to convert to a double
Returns:
A double number
See also:
TagBase::Double2Signed16(double value)

TagBase::Double2Signed(double value)

TagBase::Signed2Double(long value)

Referenced by sswf::ColorTransform::Parse().

double TagBase::Signed2Double ( long  value  )  [static]

This function converts a fixed number defined on 32 bits to a double.

Parameters:
value The fixed 32 bits fixed number to convert to a double
Returns:
The double representation
See also:
TagBase::Double2Signed16(long value)

TagBase::Double2Signed(long value)

TagBase::Signed162Double(double value)

Referenced by sswf::Matrix::UncomputeMatrix().

TagBase::TypeFlags ( void   )  const [pure virtual]

This function returns some flags that can be used to know where to place a tag in a movie, whether a tag is unique, etc.

If a tag has specifics which are not described here, it often can be checked using its name and special handling.

The existing flags are:

SWF_TYPE_DEFINE This is a definition tag (Sprite, Shape...)

SWF_TYPE_CONTROL This is a control tag (ShowFrame, PlaceObject...)

SWF_TYPE_UNIQUE This can be used once throughout the whole movie

SWF_TYPE_START This tag should be at the start of the movie

SWF_TYPE_ONE At most one per frame

SWF_TYPE_REFERENCE This tag references another

SWF_TYPE_HAS_ID This tag has an identifier

SWF_TYPE_SCRIPT This object can accept action scripts

SWF_TYPE_SPRITE This is a sprite (can include other tags)

SWF_TYPE_HEADER The header object

Note:
These flags are constant (actually hard coded!) and will not change between calls. They even rarely change between versions.
Returns:
The set of flags for the given tag
See also:
sswf::TagBase::Name(void) const

Implemented in sswf::TagHeader, sswf::TagDoAction, sswf::TagMetadata, sswf::TagPlace, sswf::TagRemove, sswf::TagSceneFrameData, sswf::TagScriptLimits, sswf::TagSetTabIndex, sswf::TagSetBackgroundColor, sswf::TagShowFrame, sswf::TagEnd, sswf::TagFrameLabel, sswf::TagExport, sswf::TagImport, sswf::TagProtect, sswf::TagProductInfo, sswf::TagInfo, sswf::TagStartSound, sswf::TagBinaryData, sswf::TagButton, sswf::TagFont, sswf::TagEditText, sswf::TagImage, sswf::TagShape, sswf::TagSound, sswf::TagSprite, and sswf::TagText.

Referenced by FindID(), and sswf::TagExport::PreSave().

long TagBase::UIBitSize ( unsigned long  value  )  [static]

This function counts the number of bits necessary to save the specified unsigned value in a bit field.

This is used by many tags to know what size to use to save a set of values such as the coordinates of a rectangle.

The input value is expected to not be signed and thus a value such as -1 will get a size of 32.

Parameters:
value The unsigned value of which the number of bits is to be computed
Returns:
The number of bits required to save that value
See also:
TagBase::SIBitSize(long value)

Referenced by sswf::TagText::Save(), and sswf::TagShape::SaveStyles().

unsigned char TagBase::Version ( void   )  const [virtual]

Whenever the movie is being saved, some tag need to know the exact version of the entire movie. This is checked using this function.

For instance, the TagImport needs to know whether you are saving a version 7 or earlier or a version 8 or newer to know whether to save the import information in an SWF_TAG_IMPORT or SWF_TAG_IMPORT2 respectively.

This function returns zero when the specified tag was not correctly initialized. Otherwise it queries the header for a version which should always be at least 1.

Returns:
The current movie version or zero if the header is not accessible

Reimplemented in sswf::TagHeader.

References Header(), and sswf::TagHeader::Version().

Referenced by sswf::TagFont::PreSave2ndPass(), sswf::TagProtect::Save(), sswf::TagPlace::Save(), sswf::TagImport::Save(), and sswf::TagFont::Save().

sswf_frame_t TagBase::WhichFrame ( void   )  const

All tags are saved between TagShowFrame tags. The number of TagShowFrame before a tag, not including the current tag, determines the frame number of that tag.

This function will count the number of TagShowFrame before 'this' tag. This number is used in different actions to be able to select the frame to go to, which needs to be loaded, etc.

The tag needs to have a Header or a Sprite as a parent for this function to work.

Returns:
The frame on which this tag is defined

References f_name, f_parent, and f_previous.

Referenced by sswf::ActionWaitForFrame::SaveData(), and sswf::ActionGoto::SaveData().


Member Data Documentation

char* sswf::TagBase::f_label [private]

Reimplemented in sswf::TagFrameLabel.

Referenced by FindLabel(), Label(), SetLabel(), TagBase(), and ~TagBase().

const char* sswf::TagBase::f_name [private]

Reimplemented in sswf::TagPlace.

Referenced by Name(), TagBase(), WhichFrame(), and ~TagBase().

This pointer is public and is provided so users of any one of the tag classes can save a pointer back to his/her own container.

The library initializes this pointer to NULL on construction and never touches it again until the object is deleted.

Referenced by TagBase().


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


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