Yasuhiro Sasama > SWF-File-0.31 > SWF::Element

Download:
SWF-File-0.31.tar.gz

Dependencies

Annotate this POD

CPAN RT

New  2
Open  0
View/Report Bugs
Module Version: 0.31   Source   Latest Release: SWF-File-0.42

NAME ^

SWF::Element - Classes of SWF tags and elements.

SYNOPSIS ^

  use SWF::Element;
  use SWF::BinStream;

  $swf_stream=SWF::BinStream::Write;
  ....
  $rect=SWF::Element::RECT->new;
  $rect->configure(Xmin=>0, Ymin=>0, Xmax=>100, Ymax=>100);
  $rect->pack($swf_stream);
  ....

DESCRIPTION ^

SWF::Element module handles SWF tags and any other sub elements to create, configure, clone, pack to bit strings, and unpack from bit strings.

SWF::Element::*

SWF::Element class is a base class of SWF element, such as Tag, RECT, SHAPE, etc. Each SWF::Element object has one or more fields.

METHODS

$element=SWF::Element::* ->new([parameters]);

creates a new element. The new element is configured with parameters.

$element->clone;

duplicates the element.

$element->configure( [name[=>value, ...]] );

gets and sets fields of the element.

When calling without any parameter, the method returns all field names and values of the element as hash.

When calling with a field name, the method returns the field value of the element.

When calling with one or more pair of name and value, the method sets the field of the element and returns the element itself. If value is an array reference, recursively configure the field element.

$element->defined;

returns whether $element is defined or not. The $element is NOT defined if all of its field are not defined.

$element->dumper([\&outputsub, $indent]);

dumps the element as a perl script which can re-create the element. It can take the subroutine reference and initial indent width for output. The subroutine is called with the script string and the indent width. In default, prints the script to the selected filehandle (usually STDOUT).

$element->pack($stream);

writes the element to $stream as bit string SWF format. $stream should be SWF::BinStream::Write object.

$element->unpack($stream);

reads the bit string data from $stream and unpack the element. $stream should be SWF::BinStream::Read object.

$element->FieldName([configure parameters...]);

Each field of $element can access by field name. When calling without parameter, it returns the field object or value. when calling with parameters, it calls configure method to set the field with the parameters and returns the field object or value.

$element->FlagName([value]);

Some fields are sets of flags. A flag is not an object but a simple scalar value, and is accessed by flag accessor method. When calling without value, it returns the flag value. When calilng with the value, it sets proper bit(s) of the Flags field with the value and returns the flag value. Some flags are read only.

SWF::Element::Scalar derivatives

SWF::Element::Scalar derivatives represent a scalar field which have their own pack/unpack method.

  SWF::Element::STRING    - null-terminated string.
  SWF::Element::PSTRING   - pascal type string (string with its length).
  SWF::Element::ID        - 16bit ID of SWF characters (shapes, bitmaps, sounds, etc.)
  SWF::Element::Depth     - 16bit Depth of SWF characters.
  SWF::Element::BinData   - Binary Data (described later).

METHODS

SWF::Element::Scalar inherits all methods of SWF::Element except any field/flag accessors. Here described the difference.

$scalar->configure([value])

When calling without any parameter, the method returns the value of the object. When calling with a value, the method sets the value to the object and returns the value.

$scalar->value

returns the value of the object.

SWF::Element::BinData

represents a binary data.

METHODS

It has the same methods as SWF::Element::Scalar. The other methods are described here.

$bindata->Length

returns the length of the data.

$bindata->add( string )

adds a string to the data.

$bindata->substr( offset [, length , [replace]] )

Extracts a substring out of the data. It behaves similar to CORE::substr.

$bindata->save( file )

saves the data to the file. It takes a file name or a file handle.

$bindata->load( file )

loads the data from the file. It takes a file name or a file handle.

SWF::Element::Array::*

SWF::Element::Array is a base class which represents an array of the SWF element. The SWF::Element::Array object is an array reference.

METHODS

SWF::Element::Array has all methods of SWF::Element except any field/flag accessors. Here described the difference.

$array->configure( list... )

adds list to the array. Each element of the list must be a proper element object or an array reference.

$array->new_element

creates a proper new element for the array. The new element is not add the array automatically. You should do 'push @$array, $new' if you want to add the new element.

SUBCLASSES

Here is the list of all subclasses representing the SWF element. 'SWF::Element::' is omitted from each class name. ex. RECT means SWF::Element::RECT class. '$' represents a simple scalar. The field whose class is '(Flags)' is a flag accessor handling bits in the Flags. '-' indicates it is read only. See 'Macromedia Flash (SWF) File Format Specifications' for further information about SWF elements and fields. You can get the document from http://www.macromedia.com/software/flash/open/licensing/fileformat/ .

Basic Types

RGB / RGBA

represents a color without/with alpha channel.

  field    class
  Red      $
  Green    $
  Blue     $
  Alpha    $  - RGBA only 
RECT

represents a rectanglular region.

  field    class
  Xmin     $
  Ymin     $
  Xmax     $
  Ymax     $
MATRIX

represents a matrix for scale, rotation, and translation.

 field        class
 ScaleX       $
 ScaleY       $
 RotateSkew0  $
 RotateSkew1  $
 TranslateX   $
 TranslateY   $

There are three methods.

$matrix->scale([xscale, [yscale]]);

scales up and down by xscale and yscale for X-axis and Y-axis, respectively. If omitting yscale, xscale is used for both axis.

$matrix->moveto(x,y);

moves to (x, y).

$matrix->rotate(degree);

rotates degree degree.

CXFORM / CXFORMWITHALPHA

represents a color transform value.

 field          class
 RedMultTerm    $
 GreenMultTerm  $
 BlueMultTerm   $
 AlphaMultTerm  $  - CXFORMWITHALPHA only.
 RedAddTerm     $
 GreenAddTerm   $
 BlueAddTerm    $
 AlphaAddTerm   $  - CXFORMWITHALPHA only.

SWF Tags

Tag

A base class of all SWF tags. When it is unpacked from SWF stream, it is re-blessed the proper tag class.

$tag->lookahead_FieldName($stream)

You can read some field from the stream before unpacking the tag by lookahead_FieldName method. The field for which a lookahead method is prepared is marked with '*' in the lookahead column of the following tables. It should be run subsequently to parsing the tag header and before unpacking the tag data.

$tag->tag_number

returns the tag ID number.

$tag->tag_name

returns the tag name.

Tag::Unknown

represents the unknown tags.

 field  class
 Tag    $
 Data   BinData

Display List

Tag::PlaceObject

places the object.

 field           class   lookahead
 CharacterID     ID          *
 Depth           $           *
 Matrix          MATRIX
 ColorTransform  CXFORM
Tag::PlaceObject2

places the object.

 field                     class    lookahead
 Flags                     $           *
   PlaceFlagMove           (Flags)
 - PlaceFlagHasCharacter   (Flags)
 - PlaceFlagHasMatrix      (Flags)
 - PlaceFlagColorTransform (Flags)
 - PlaceFlagHasRatio       (Flags)
 - PlaceFlagHasName        (Flags)
 - PlaceFlagClipDepth      (Flags)
 - PlaceFlagClipActions    (Flags)
 Depth                     $           *
 CharacterID               ID          *
 Matrix                    MATRIX
 ColorTramsform            CXFORMWITHALPHA
 Ratio                     $
 Name                      STRING
 ClipDepth                 $
 ClipActions               Array::CLIPACTIONRECORDARRAY
Array::CLIPACTIONRECORDARRAY

An array of CLIPACTIONRECORD.

CLIPACTIONRECORD

represents a clip action triggered by clip event.

 field                     class
 EventFlags                $
   ClipEventKeyPress       (EventFlags) - SWF6 only
   ClipEventDragOut        (EventFlags) - SWF6 only
   ClipEventDragOver       (EventFlags) - SWF6 only
   ClipEventRollOut        (EventFlags) - SWF6 only
   ClipEventRollOver       (EventFlags) - SWF6 only
   ClipEventReleaseOutside (EventFlags) - SWF6 only
   ClipEventRelease        (EventFlags) - SWF6 only
   ClipEventPress          (EventFlags) - SWF6 only
   ClipEventInitialize     (EventFlags) - SWF6 only
   ClipEventData           (EventFlags)
   ClipEventKeyUp          (EventFlags)
   ClipEventKeyDown        (EventFlags)
   ClipEventMouseUp        (EventFlags)
   ClipEventMouseDown      (EventFlags)
   ClipEventMouseMove      (EventFlags)
   ClipEventUnload         (EventFlags)
   ClipEventEnterFrame     (EventFlags)
   ClipEventLoad           (EventFlags)
 KeyCode                   $
 Actions                   Array::ACTIONRECORDARRAY
Tag::RemoveObject / Tag::RemoveObject2

removes the object.

 field        class  lookahead
 CharacterID  ID         *        - RemoveObject only
 Depth        $          *
Tag::ShowFrame

shows current frame.

Controls

Tag::SetBackgroundColor

sets the background color.

 field            class
 BackgroundColor  RGB
Tag::FrameLabel

sets the frame label.

 field          class
 Name           STRING
 NameAnchorFlag $
Tag::Protect

prevents the file from editing in the authoring tool.

 field     class  lookahead
 Reserved  $          *      always 0 (?)
 Password  STRING
Tag::End

marks the end of the file.

Tag::ExportAssets

exports SWF characters to use in other SWFs.

 field   class
 Assets  Array::ASSETARRAY
Tag::ImportAssets

imports SWF characters from another SWF.

 field   class
 URL     STRING
 Assets  Array::ASSETARRAY
Array::ASSETARRAY

An array of ASSET.

ASSET

An ID and name pair of SWF character for export/import.

 field   class
 ID      ID
 Name    STRING
Tag::EnableDebugger / 2

enables debugging. EnableDebugger is for SWF 5, and EnableDebugger2 is for SWF 6.

 field     class  lookahead
 Reserved  $          *      always 0 (?)
 Password  STRING

Actions

Tag::DoAction

sets the frame action.

 field    class
 Actions  Array::ACTIONRECORDARRAY
Tag::DoInitAction

performs the actions to initialize a sprite.

 field    class      lookahead
 SpriteID ID             *
 Actions  Array::ACTIONRECORDARRAY
Array::ACTIONRECORDARRAY

An array of ACTIONRECORD

ACTIONRECORD

Base class of action tags. Action tags without any parameter belongs this class.

 field  class
 Tag    ACTIONTagNumber

And it has a pseudo-field, 'LocalLabel', which can be used as destination of ActionIf, ActionJump, and ActionWaitForFrame/2, and CodeSize of DefineFunction. Label string must not start with digits and not contain '#'.

ACTIONTagNumber

represents an action tag number or name.

ACTIONRECORD::ActionUnknown

represents an undefined actiontag.

 field  class
 Tag    ACTIONTagNumber
 Data   BinData
ACTIONRECORD::ActionGotoFrame

goes to the specified frame.

 field  class
 Tag    ACTIONTagNumber
 Frame  $
ACTIONRECORD::ActionGetURL

directs the player to get the specified URL.

 field         class
 Tag           ACTIONTagNumber
 UrlString     STRING
 TargetString  STRING
ACTIONRECORD::ActionWaitForFrame

waits until the specified frame otherwise skip the specified number of actions.

 field      class
 Tag        ACTIONTagNumber
 Frame      $
 SkipCount  $[label]

unpack method calculate the destination of SkipCount, insert LocalLabel into the destination action, and set the SkipCount value to 'label#original value' such as 'A#45'. When the action is packed to SWF stream, '#' and the following letters are ignored.

ACTIONRECORD::ActionSetTarget

sets context of action.

 field       class
 Tag         ACTIONTagNumber
 TargetName  STRING
ACTIONRECORD::ActionGotoLabel

goes to frame associated with the specified label.

 field  class
 Tag    ACTIONTagNumber
 Label  STRING
ACTIONRECORD::ActionWaitForFrame2

waits until the frame specified in the stack otherwise skip the specified number of actions.

 field      class
 Tag        ACTIONTagNumber
 SkipCount  $[label]

See also the note of WaitForFrame about the label.

ACTIONRECORD::ActionPush

pushes data on the stack.

 field     class
 Tag       ACTIONTagNumber
 DataList  Array::ACTIONDATAARRAY
Array::ACTIONDATAARRAY

An array of ACTIONDATA

ACTIONDATA

A base class of data for action script. If you configure this element, the element is re-blessed with proper subclass.

$actiondata->configure([type => data])

sets the data and re-blessed itself to the type. Types are String, Property (FLASH 4 only), Register, Boolean, Double, Integer, Lookup.

ACTIONRECORD::ActionJump / ActionIf

branches action script always / if stack top is true.

 field         class
 BranchOffset  $[label]

unpack method calculate the destination of BranchOffset, insert LocalLabel into the destination action, and set the BranchOffset value to 'label#original value' such as 'A#45'. When the action is packed to SWF stream, '#' and the following letters are ignored.

ACTIONRECORD::ActionGetURL2

directs the player to get the URL specified in the stack.

 field   class
 Tag     ACTIONTagNumber
 Method  $
ACTIONRECORD::ActionGotoFrame2

goes to the frame specified in the stack.

 field    class
 Tag      ACTIONTagNumber
 PlayFlag $
ACTIONRECORD::ActionConstantPool

defines word set which can be referred by index.

 field  class
 Tag    ActionTagNumber
 ConstantPool  Array::STRINGARRAY
Array::STRINGARRAY

an array of STRING.

ACTIONRECORD::ActionDefineFunction

defines a function.

 field     class
 Tag       ActionTagNumber
 FunctionName  STRING
 Params        Array::STRINGARRAY
 CodeSize      $[label]

CodeSize can take the label which indicates the action next to the function definition.

ACTIONRECORD::ActionStoreRegister

stores the stack top to the register.

 field     class
 Tag       ActionTagNumber
 Register  $
ACTIONRECORD::ActionWith

refers to the object on the top of stack for the script written in the CodeSize.

 field      class
 CodeSize   $[label]

CodeSize can take the label which indicates the action next to the end of the block.

Shapes

Array::FILLSTYLEARRAY1 / 2 / 3

An array of fill styles. FILLSTYLEARRAY1 and 2 have FILLSTYLE1, and FILLSTYLEARRAY3 has FILLSTYLE3.

FILLSTYLE1 / 3

represents fill style of shapes. FILLSTYLE3 has alpha channels in its field elements.

 field           class
 FillStyleType   $
 Color           RGB / RGBA
 GradientMatrix  MATRIX
 Gradient        Array::GRADIENT1 / 3
 BitmapID        ID
 BitmapMatrix    MATRIX
Array::LINESTYLEARRAY1 / 2 / 3

An array of line styles. LINESTYLEARRAY1 and 2 have LINESTYLE1, and LINESTYLEARRAY3 has LINESTYLE3.

LINESTYLE1 / 3

represents a line style of shapes. LINESTYLE3 has an alpha channel.

 field  class
 Width  $
 Color  RGB / RGBA
SHAPE

represents a shape without styles for DefineFont/2, and DefineMorphShape.

 field         class
 ShapeRecords  Array::SHAPERECARRAY1
SHAPEWITHSTYLE1 / 2 / 3

represents a shape with styles. SHAPEWITHSTYLE3 has alpha channels.

 field         class
 FillStyles    Array::FILLSTYLEARRAY1 / 2 / 3
 LineStyles    Array::LINESTYLEARRAY1 / 2 / 3
 ShapeRecords  Array::SHAPERECARRAY1 / 2 / 3 
Array::SHAPERECORDARRAY1 / 2 / 3

An array of SHAPERECORD1 / 2 / 3.

SHAPERECORD1 / 2 / 3

is a base class of the edges of a shape. If you configure this element, the element is re-blessed with proper subclass.

SHAPERECORD1/2/3::STYLECHANGERECORD

represents a start point and style of new edge.

 field       class
 MoveDeltaX  $
 MoveDeltaY  $
 FillStyle0  $
 FillStyle1  $
 LineStyle   $
 FillStyles  Array::FILLSTYLEARRAY2 / 3  - SHAPERECORD2/3 only
 LineStyles  Array::LINESTYLEARRAY2 / 3  - SHAPERECORD2/3 only
SHAPERECORDn::STRAIGHTEDGERECORD

represents a straight edge. This is common subclass of SHAPERECORD1/2/3.

 field   class
 DeltaX  $
 DeltaY  $
SHAPERECn::CURVEDEDGERECORD

represents a curved edge. This is common subclass of SHAPEREC1/2/3.

 field          class
 ControlDeltaX  $
 ControlDeltaY  $
 AnchorDeltaX   $
 AnchorDeltaY   $
Tag::DefineShape / Tag::DefineShape2 / Tag::DefineShape3

defines shape. DefineShape2/3 can have more than 255 styles. DefineShape3 contains alpha channels.

 field        class     lookahead
 ShapeID      ID            *
 ShapeBounds  RECT
 Shapes       SHAPEWITHSTYLE1 / 2 / 3

Gradients

Array::GRADIENT1 / 3

represents a gradient information. Each of them is an array of GRADRECORD1 / 3.

GRADRECORD1 / 3

represents one of the colors making gradient. GRADRECORD3 has an alpha channel.

 field  class
 Ratio  $
 Color  RGB / RGBA

Bitmaps

Tag::DefineBits

defines JPEG image data.

 field        class    lookahead
 CharacterID  ID           *
 JPEGImage    BinData
Tag::JPEGTable

defines JPEG encoding table.

 field     class
 JPEGData  BinData
Tag::DefineBitsJPEG2 / 3

defines JPEG data including both the encoding table and the image data. DefineBitsJPEG3 has an alpha data table.

 field            class    lookahead
 CharacterID      ID           *
 JPEGData         BinData
 BitmapAlphaData  BinData             - JPEG3 only.
Tag::DefineBitsLossless / Tag::DefineBitsLossless2

defines a loss-less bitmap. DefineBitsLossless2 contains alpha channels.

 field                 class   lookahead
 CharacterID           ID          *
 BitmapFormat          $           *
 BitmapWidth           $           *
 BitmapHeight          $           *
 BitmapColorTableSize  $           *
 ZlibBitmapData        BinData

Morphing

Tag::DefineMorphShape

defines the start and end states of a morph sequence.

 field            class  lookahead
 CharacterID      ID         *
 StartBounds      RECT
 EndBounds        RECT
 MorphFillStyles  Array::MORPHFILLSTYLEARRAY
 MorphLineStyles  Array::MORPHLINESTYLEARRAY
 StartEdges       SHAPE
 EndEdges         SHAPE
Array::MORPHFILLSTYLEARRAY

An array of MORPHFILLSTYLE.

MORPHFILLSTYLE

represents fill styles at start and end.

 field                class
 FillStyleType        $
 StartColor           RGBA     (FillStyleType == 0x00)
 EndColor             RGBA     (FillStyleType == 0x00)
 StartGradientMatrix  MATRIX   (FillStyleType == 0x10[linear] or 0x12[radial])
 EndGradientMatrix    MATRIX   (FillStyleType == 0x10[linear] or 0x12[radial])
 Gradient             Array::MORPHGRADIENT
                               (FillStyleType == 0x10[linear] or 0x12[radial])
 BitmapID             ID       (FillStyleType == 0x40[tiled] or 0x41[clipped])
 StartBitmapMatrix    MATRIX   (FillStyleType == 0x40[tiled] or 0x41[clipped])
 EndBitmapMatrix      MATRIX   (FillStyleType == 0x40[tiled] or 0x41[clipped])
Array::MORPHGRADIENT

An array of MORPHGRADRECORD.

MORPHGRADRECORD

represents one of the colors making gradient at start and end.

 field      class
 StartRatio $
 StartColor RGBA
 EndRatio   $
 EndColor   RGBA
Array::MORPHLINESTYLEARRAY

An array of MORPHLINESTYLE.

MORPHLINESTYLE

represents a line style of shapes at start and end.

 field      class
 StartWidth $
 StartColor RGBA
 EndWidth   $
 EndColor   RGBA

Fonts and Text

Tag::DefineFont

defines font glyphs.

 field            class        lookahead
 FontID           ID               *
 GlyphShapeTable  GLYPHSHAPEARRAY1
Array::GLYPHSHAPEARRAY1 / 2

An array of SHAPE.

Tag::DefineFontInfo

defines font information.

 field                class    lookahead
 FontID               ID           *
 FontName             PSTRING
 FontFlags            $
   FontFlagsShiftJIS  (FontFlags)
   FontFlagsANSI      (FontFlags)
   FontFlagsItalic    (FontFlags)
   FontFlagsBold      (FontFlags)
 - FontFlagsWideCodes (FontFlags)
 LanguageCode         $                 - DefineFontInfo2 only
 CodeTable            Array::FONTCODETABLE
Tag::DefineFont2

defines font glyphs and other information.

 field                  class       lookahead
 FontID                 ID              *
 FontFlags              $               *
 - FontFlagsHasLayout   (FontFlags)
   FontFlagsShiftJIS    (FontFlags)
   FontFlagsANSI        (FontFlags)
 - FontFlagsWideOffsets (FontFlags)
 - FontFlagsWideCodes   (FontFlags)
   FontFlagsItalic      (FontFlags)
   FontFlagsBold        (FontFlags)
 LanguageCode           $               *
 FontName               PSTRING
 GlyphShapeTable        Array::GLYPHSHAPEARRAY2
 CodeTable              Array::FONTCODETABLE
 FontAscent             $
 FontDescent            $
 FontLeading            $
 FontAdvanceTable       Array::FONTADVANCETABLE
 FontBoundsTable        Array::FONTBOUNDSTABLE
 FontKerningTable       FONTKERNINGTABLE
Array::FONTCODETABLE / FONTADVANCETABLE / FONTBOUNDSTABLE

are arrays of a code, an advance value, and a bounding box of each glyph corresponding to the shape table, respectively. A code and an advance value are scalar, and a bounding box is a RECT.

FONTKERNINGTABLE

represents a table of kerning pairs of the font. Each kerning pair is described as 'code1-code2'. For example, a pair of 'T'(code 84) and 'o'(111) is '84-111'.

$kern->configure([ pair [=> adjustment, ...]])

When calling without any parameter, it returns all kerning pair and its adjustment. When calling with a kerning pair, it returns the adjustment of the pair. When calling with the list of a kerning pair and its adjustment, it adds the kerning data to the table.

Tag::DefineText / Tag::DefineText2

defines text.

 field         class   lookahead
 CharacterID   ID          *
 TextBounds    RECT
 TextMatrix    MATRIX
 TextRecords   Array::TEXTRECORDARRAY1 / 2
Array::TEXTRECORDARRAY1 / 2

An array of TEXTRECORD1 / 2

TEXTRECORD1 / 2

A base class of text records. If you configure this element, the element is re-blessed with proper subclass.

TEXTRECORD1/2::TYPE1

represents a text style.

 field       class
 FontID      ID
 TextColor   RGB / RGBA
 XOffset     $
 YOffset     $
 TextHeight  $
TEXTRECORD::TYPE0

represents a text string.

 field         class
 GlyphEntries  Array:GLYPHENTRYARRAY
Array::GLYPHENTRYARRAY

An array of GLYPHENTRY.

GLYPHENTRY

represents a glyph entry for a letter of the text.

 field         class
 GlyphIndex    $
 GlyphAdvance  $ 
Tag::DefineEditText

defines an edit box.

 field          class   lookahead
 CharacterID    ID          *
 Bounds         RECT
 Flags          $
   WordWrap     (Flags)
   Multiline    (Flags)
   Password     (Flags)
   ReadOnly     (Flags)
 - HasTextColor (Flags)
 - HasMaxLength (Flags)
 - HasFont      (Flags)
   AutoSize     (Flags)
 - HasLayout    (Flags)
   NoSelect     (Flags)
   Border       (Flags)
   HTML         (Flags)
   UseOutlines  (Flags)
 FontID         ID
 FontHeight     $
 TextColor      RGBA
 MaxLength      $
 Align          $
 LeftMargin     $
 RightMargin    $
 Indent         $
 Leading        $
 VariableName   STRING
 InitialText    STRING

Sounds

Tag::DefineSound

defines sound.

 field             class    lookahead
 SoundID           ID           *
 Flags             $            *
   SoundFormat     (Flags)
   SoundRate       (Flags)
   SoundSize       (Flags)
   SoundType       (Flags)
 SoundSampleCount  $            *
 SoundData         BinData
Tag::StartSound

starts playing sound.

 field      class      lookahead
 SoundID    ID             *
 SoundInfo  SOUNDINFO
SOUNDINFO

represents sound information.

 field            class
 SyncFlags        $
 - HasInPoint     (SyncFlags)
 - HasOutPoint    (SyncFlags)
 - HasLoops       (SyncFlags)
 - HasEnvelope    (SyncFlags)
   SyncNoMultiple (SyncFlags)
   SyncStop       (SyncFlags)
 InPoint          $
 OutPoint         $
 LoopCount        $
 EnvelopeRecords  Array::SOUNDENVELOPEARRAY
Array::SOUNDENVELOPEARRAY

An array of SOUNDENVELOPE.

SOUNDENVELOPE

represents sound envelope information.

 field       class
 Pos44       $
 LeftLevel   $
 RightLevel  $
Tag::SoundStreamHead / Tag::SoundStreamHead2

defines the format of streaming sound.

 field                    class   lookahead
 Flags                    $           *
   PlaybackSoundRate      (Flags)
   PlaybackSoundSize      (Flags)
   PlaybackSoundType      (Flags)
   StreamSoundCompression (Flags)
   StreamSoundRate        (Flags)
   StreamSoundSize        (Flags)
   StreamSoundType        (Flags)
 StreamSoundSampleCount   $           *
 LatencySeek              $           *      - SoundStreamHead2 only
Tag::SoundStreamBlock

defines the sound data which is interleaved with the frame.

 field            class
 StreamSoundData  BinData

Buttons

Array::BUTTONRECORDARRAY1 / 2

An array of BUTTONRECORD1 / 2.

BUTTONRECORD1 / 2

represents a button character and associated button states.

 field                 class
 field                 class
 ButtonStates          $
   ButtonStateHitTest  (ButtonStates)
   ButtonStateDown     (ButtonStates)
   ButtonStateOver     (ButtonStates)
   ButtonStateUp       (ButtonStates)
 CharacterID           ID
 PlaceDepth            $
 PlaceMatrix           MATRIX
 ColorTransform        CXFORMWITHALPHA - BUTTONRECORD2 only
Tag::Definebutton

defines a button character.

 field       class                      lookahead
 ButtonID    ID                             *
 Characters  Array::BUTTONRECORDARRAY1
 Actions     Array::ACTIONRECORDARRAY
Tag::DefineButton2

defines a button character which has the actions triggered by any state stansition.

 field         class                      lookahead
 ButtonID      ID                             *
 Flags         $                              *
   TrackAsMenu (Flags)
 Characters    Array::BUTTONRECORDARRAY2
 Actions       Array::BUTTONCONDACTIONARRAY
Array::BUTTONCONDACTIONARRAY

An array of BUTTONCONDACTION.

BUTTONCONDACTION

represents actions and a button states condition which triggers off the actions.

 field                    class
 Condition                $
   CondKeyPress           (Condition)
   CondOverDownToIdle     (Condition)
   CondIdleToOverDown     (Condition)
   CondOutDownToIdle      (Condition)
   CondOutDownToOverDown  (Condition)
   CondOverDownToOutDown  (Condition)
   CondOverDownToOverUp   (Condition)
   CondOverUpToOverDown   (Condition)
   CondOverUpToIdle       (Condition)
   CondIdleToOverUp       (Condition)
 Actions                  Array::ACTIONRECORDARRAY
Tag::DefineButtonCxform

defines the color transform for each shape and text character in a button.

 field                 class  lookahead
 ButtonID              ID         *
 ButtonColorTransform  CXFORM
Tag::DefineButtonSound

defines the sound data for a button.

 field             class      lookahead
 ButtonID          ID             *
 ButtonSoundChar0  ID             *
 ButtonSoundInfo0  SOUNDINFO
 ButtonSoundChar1  ID
 ButtonSoundInfo1  SOUNDINFO
 ButtonSoundChar2  ID
 ButtonSoundInfo2  SOUNDINFO
 ButtonSoundChar3  ID
 ButtonSoundInfo3  SOUNDINFO

Sprites

Tag::DefineSprite

defines a sprite.

 field              class           lookahead
 SpriteID           ID                  *
 FrameCount         $                   *
 ControlTags        Array::TAGARRAY
 (TagStream)        TAGSTREAM
$sprite->shallow_unpack($stream)

unpacks SpriteID and FrameCount from the stream, and prepare TagStream to parse later instead of unpacking all ControlTags.

Array::TAGARRAY

An array of SWF tags.

TAGSTREAM

A stream of the tags.

$tagstream->parse( \&callback )

parses the tag stream and calls &callback sub. See SWF::Parser for details of the tag callback sub.

Video

Tag::DefineVideoStream

defines a video character.

  field        class  lookahead
  CharacterID  ID         *
  NumFrames    $          *
  Width        $          *
  Height       $          *
  VideoFlags   $          *
  CodecID      $          *
Tag::VideoFrame

provides a single frame of video data for a video character.

  field      class   lookahead
  StreamID   ID          *
  FrameNum   $           *
  VideoData  BinData

LIMITATIONS ^

Not all tags have been tested yet.

No support of the SWF version control for the tags unless the version affects the tag structure.

Binary block data, such as bitmaps, sounds, and video, are neither decoded nor encoded.

COPYRIGHT ^

Copyright 2000 Yasuhiro Sasama (ySas), <ysas@nmt.ne.jp>

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

SEE ALSO ^

SWF::BinStream, SWF::Parser

SWF file format specification from Macromedia.

syntax highlighting: