# swfml basic profile

by Daniel Fischer <dan[at]subsignal.org>

## Table of Contents

## Introduction

This is the reference to the swfml basic profile XML dialect. swfmill can convert from binary SWF to and from this dialect. It is very closely modeled after the SWF file format, which means that you can produce all kinds of illegal SWFs with it, so be careful.

### About this Document

This reference lists all types, tags and actions available in swfml basic. It is organized into chapters, first listing basic types, then Tags and Actions. All tables are in alphabetical order. The difference of internal and basic types should be irrelevant to the swfml user.

### Example entry

Let's look at the Import tag as an example. It's entry looks like this:

Tag Name | ID | Attributes
--- | --- | ---
Import | 0x39 | url (string) symbols (List of Symbols)

This tells us that there is a swfml tag called "Import" which has two parameters: url and symbols. You can safely ignore the ID, it is given for reference purposes only. Note, though, that "Symbol" is a link to a type definition, which looks like this:

Type Name | Attributes
--- | ---
Symbol | objectID (word) name (string)

We now have enough information to construct an Import tag, it could look like this:

    <Import url="http://foo.com/mylibrary.swf">
      <symbols>
        <Symbol objectID="1" name="myFoo"/>
        <Symbol objectID="2" name="myBar"/>
      </symbols>
    </Import>

Note that, while primitive types like string must be given as Attributes, Lists and Object parameters become Child Elements of our tag instance.

## Basic Types

Type Name | Attributes
--- | ---
Button | hitTest (bit) down (bit) over (bit) up (bit)
Color | red (byte) green (byte) blue (byte)
ColorTransform2 |
Condition | next (word) key (integer) menuLeave (bit) menuEnter (bit) pointerReleaseOutside (bit) pointerDragEnter (bit) pointerDragLeave (bit) pointerReleaseInside (bit) pointerPush (bit) pointerLeave (bit) pointerEnter (bit) actions (List of Actions)
CurveTo | x1 (integer) y1 (integer) x2 (integer) y2 (integer)
Event | flags1 (word)
GlyphShape | edges (List of ShapeItems)
GradientItem | position (byte) color (Object of type Color)
Header | size (Object of type Rectangle) framerate (integer) frames (word) tags (List of Tags)
Kerning | a (byte) b (byte) adjustment (integer)
LineStyle | width (word) color (Object of type Color)
Parameter | reg (byte) name (string)
Rectangle | left (integer) right (integer) top (integer) bottom (integer)
Shape | edges (List of ShapeItems)
ShapeSetup |
Short | value (word)
String | value (string)
StyleList | fillStyles (List of Styles) lineStyles (List of LineStyles)
Symbol | objectID (word) name (string)
TextEntry | glyph (integer) advance (integer)
TextRecord |
TextRecord6 |
TextRecord7 |
Transform | transX (integer) transY (integer)
UChar | value (byte)
ULong | value (integer)
UShort | value (word)
WideKerning | a (word) b (word) adjustment (word)

## Tags

Tag Name | ID | Attributes
--- | --- | ---
DefineBits | 0x06 | objectID (word) data (Object of type Rest)
DefineBitsJPEG2 | 0x15 | objectID (word) data (Object of type Rest)
DefineBitsJPEG3 | 0x23 | objectID (word) offset_to_alpha (uint32) data (Object of type Rest)
DefineBitsLossless | 0x14 | objectID (word) format (byte) width (word) height (word) data (Object of type Rest)
DefineBitsLossless2 | 0x24 | objectID (word) format (byte) width (word) height (word) data (Object of type Rest)
DefineButton2 | 0x22 | objectID (word) menu (bit) buttonsSize (word) buttons (List of Buttons) conditions (List of Conditions)
DefineEditText | 0x25 | objectID (word) size (Object of type Rectangle) wordWrap (bit) multiLine (bit) password (bit) readOnly (bit) autoSize (bit) hasLayout (bit) notSelectable (bit) hasBorder (bit) isHTML (bit) useOutlines (bit) variableName (string)
DefineFont | 0x0A | objectID (word) data (Object of type Rest)
DefineFont2 | 0x30 | objectID (word) isShiftJIS (bit) isUnicode (bit) isANSII (bit) wideGlyphOffsets (bit) italic (bit) bold (bit) language (byte) name (string) glyphs (Object of type GlyphList)
DefineFontInfo | 0x0D | objectID (word) smallTextOrUnicode (bit) isShiftJIS (bit) isANSII (bit) isItalic (bit) isBold (bit) isWide (bit) map (Object of type Rest)
DefineFontInfo2 | 0x3E | objectID (word) smallTextOrUnicode (bit) isShiftJIS (bit) isANSII (bit) isItalic (bit) isBold (bit) isWide (bit) map (Object of type Rest)
DefineMorphShape | 0x2E | objectID (word) data (Object of type Rest)
DefineShape | 0x02 | objectID (word) bounds (Object of type Rectangle) styles (Object of type StyleList) shapes (Object of type Shape)
DefineShape2 | 0x16 | objectID (word) bounds (Object of type Rectangle) styles (Object of type StyleList) shapes (Object of type Shape)
DefineShape3 | 0x20 | objectID (word) bounds (Object of type Rectangle) styles (Object of type StyleList) shapes (Object of type Shape)
DefineSound | 0x0E | objectID (word) format (integer) rate (integer) is16bit (bit) stereo (bit) samples (uint32) data (Object of type Rest)
DefineSprite | 0x27 | objectID (word) frames (word) tags (List of Tags)
DefineText | 0x0B | objectID (word) bounds (Object of type Rectangle) transform (Object of type Transform) records (List of TextRecords)
DefineVideoStream | 0x3C | objectID (word) frames (word) width (word) height (word) deblocking (integer) smoothing (bit) codec (byte)
DoAction | 0x0C | actions (List of Actions)
DoInitAction | 0x3B | sprite (word) actions (List of Actions)
End | 0x00 |
Export | 0x38 | symbols (List of Symbols)
FrameLabel | 0x2B | label (string) flags (Object of type Rest)
Import | 0x39 | url (string) symbols (List of Symbols)
PlaceObject2 | 0x1A | replace (bit) depth (word)
RemoveObject | 0x05 | objectID (word) depth (word)
RemoveObject2 | 0x1C | depth (word)
ScriptLimits | 0x41 | maxRecursionDepth (word) timeout (word)
SetBackgroundColor | 0x09 | color (Object of type Color)
SetTabIndex | 0x42 | depth (word) tabIndex (word)
ShowFrame | 0x01 |
SoundStreamBlock | 0x13 | data (data)
SoundStreamHead | 0x12 | playbackRate (integer) playbackSize (bit) playbackStereo (bit) compression (integer) soundRate (integer) soundSize (bit) soundStereo (bit) sampleSize (word)
SoundStreamHead2 | 0x2D | playbackRate (integer) playbackSize (bit) playbackStereo (bit) compression (integer) soundRate (integer) soundSize (bit) soundStereo (bit) sampleSize (word)
StartSound | 0x0F | objectID (word) stopPlayback (bit) noMultiple (bit) hasEnvelope (bit) hasLoop (bit) hasOutPoint (bit) hasInPoint (bit)
UnknownTag | -1 | data (data)
VideoFrame | 0x3D | objectID (word) frame (word) data (Object of type Rest)

## Actions

Action Name | ID | Attributes
--- | --- | ---
AND | 0x60 |
AddCast | 0x0A |
AddTyped | 0x47 |
BranchAlways | 0x99 | byteOffset (word)
BranchIfTrue | 0x9D | byteOffset (word)
CHR | 0x33 |
CallFrame | 0x9E |
CallFunction | 0x3D |
CallMethod | 0x52 |
CastObject | 0x2B |
ConcatenateString | 0x21 |
DeclareArray | 0x42 |
DeclareFunction | 0x9B | name (string) argc (word) args (List of Strings) length (word)
DeclareFunction2 | 0x8E | name (string) argc (word) regc (byte) preloadThis (bit) suppressThis (bit) preloadArguments (bit) suppressArguments (bit) preloadSuper (bit) suppressSuper (bit) preloadRoot (bit) preloadParent (bit) preloadGlobal (bit) reserved (integer) args (List of Parameters) actions (List of Actions)
DeclareLocalVariable | 0x41 |
DeclareObject | 0x43 |
Decrement | 0x51 |
DefineNumber | 0x4A |
DefineString | 0x4B |
Delete | 0x3A |
DeleteAll | 0x3B |
Dictionary | 0x88 | strings (List of Strings)
Divide | 0x0D |
Duplicate | 0x4C |
DuplicateSprite | 0x24 |
EndAction | 0x00 |
Enumerate | 0x46 |
EnumerateObject | 0x55 |
EqualCast | 0x0E |
EqualTyped | 0x49 |
Extends | 0x69 |
GetMember | 0x4E |
GetProperty | 0x22 |
GetTarget | 0x45 |
GetTimer | 0x34 |
GetURL | 0x83 | url (string) target (string)
GetURL2 | 0x9A | method (byte)
GetVariable | 0x1C |
GotoExpression | 0x9F | play (byte)
GotoFrame | 0x81 | frame (word)
GotoLabel | 0x8C | label (string)
GreaterThanTyped | 0x67 |
Implements | 0x2C |
Increment | 0x50 |
InstanceOf | 0x54 |
IntegralPart | 0x18 |
LessThanCast | 0x0F |
LessThanTyped | 0x48 |
LogicalAND | 0x10 |
LogicalNOT | 0x12 |
LogicalOR | 0x11 |
Modulo | 0x3F |
Mulitply | 0x0C |
MultibyteCHR | 0x37 |
MultibyteORD | 0x36 |
MultibyteStringLength | 0x31 |
MultibyteSubString | 0x35 |
New | 0x40 |
NewMethod | 0x53 |
NextFrame | 0x04 |
OR | 0x61 |
ORD | 0x32 |
Play | 0x06 |
Pop | 0x17 |
PreviousFrame | 0x05 |
PushData | 0x96 | items (List of StackItems)
Random | 0x30 |
RemoveSprite | 0x25 |
Return | 0x3E |
SetLocalVariable | 0x3C |
SetMember | 0x4F |
SetProperty | 0x23 |
SetTarget | 0x8B | label (string)
SetTargetDynamic | 0x20 |
SetVariable | 0x1D |
ShiftLeft | 0x63 |
ShiftRight | 0x64 |
ShiftRightUnsigned | 0x65 |
StartDrag | 0x27 |
Stop | 0x07 |
StopDrag | 0x28 |
StopSound | 0x09 |
StoreRegister | 0x87 | reg (byte)
StrictEqual | 0x66 |
StringEqual | 0x13 |
StringGreaterThan | 0x68 |
StringLength | 0x14 |
StringLessThan | 0x29 |
SubString | 0x15 |
Substract | 0x0B |
Swap | 0x4D |
Throw | 0x2A |
ToggleQuality | 0x08 |
Trace | 0x26 |
Try | 0x8F | doFinally (bit) doCatch (bit) trySize (word) catchSize (word) finallySize (word)
TypeOf | 0x44 |
UnknownAction | -1 | data (data)
WaitForFrame | 0x8A | frame (word) skip (byte)
WaitForFrameDynamic | 0x8D | frame (word) skip (byte)
With | 0x94 | size (word)
XOR | 0x62 |

Version: $Id: reference.xsl,v 1.1 2005/05/30 12:48:38 dan Exp $
Copyright 2005 Daniel Fischer
Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the distribution in doc/licenses/fdl.txt, or can be obtained from http://www.fsf.org/licenses/fdl.html.
The author shall not be held responsible for content of other websites linked from here.