/*
 * FSAction.java
 * Transform
 * 
 * Copyright (c) 2001-2008 Flagstone Software Ltd. All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without modification, 
 * are permitted provided that the following conditions are met:
 *
 *  * Redistributions of source code must retain the above copyright notice, this
 *    list of conditions and the following disclaimer.
 *  * Redistributions in binary form must reproduce the above copyright notice, 
 *    this list of conditions and the following disclaimer in the documentation 
 *    and/or other materials provided with the distribution.
 *  * Neither the name of Flagstone Software Ltd. nor the names of its contributors 
 *    may be used to endorse or promote products derived from this software 
 *    without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
 * IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 
 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 
 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 
 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 
 * OF THE POSSIBILITY OF SUCH DAMAGE.
 */

package com.flagstone.transform;

/**
 * The FSAction class is used to represent stack-based actions, defined by
 * simple byte-codes, that are executed by the Flash Player.
 * 
 * <p>
 * The operations supported by the FSAction class are:
 * </p>
 * 
 * <h1 class="datasheet">Stack Manipulation</h1>
 * 
 * <table class="actions">
 * 
 * <tr>
 * <th>Action</th>
 * <th>Description</th>
 * <th>Stack Notation</th>
 * <th>Example</th>
 * </tr>
 * 
 * <tr valign="top">
 * <td>Pop</td>
 * <td>Pop value from the top of the stack.</td>
 * <td nowrap>(valueA -- )</td>
 * <td nowrap>(4 -- )</td>
 * </tr>
 * <tr valign="top">
 * <td>Duplicate</td>
 * <td>Duplicate the value at the top of the stack.</td>
 * <td nowrap>(valueA -- valueA valueA)</td>
 * <td nowrap>(4 -- 4 4)</td>
 * </tr>
 * <tr valign="top">
 * <td>Swap</td>
 * <td>Swap the top two values on the stack.</td>
 * <td nowrap>(valueA valueB -- valueB valueA)</td>
 * <td nowrap>(4 3 -- 3 4)</td>
 * </tr>
 * </table>
 * 
 * <p>
 * FSPush is used to push literals onto the Stack. See also FSRegisterCopy which
 * copies the value on top of the Stack to one of the Flash Player's internal
 * registers.
 * </p>
 * 
 * <h1 class="datasheet">Arithmetic</h1>
 * 
 * <table class="actions">
 * 
 * <tr>
 * <th>Action</th>
 * <th>Description</th>
 * <th>Stack Notation</th>
 * <th>Example</th>
 * </tr>
 * 
 * <tr valign="top">
 * <td>Add</td>
 * <td>Arithmetic Add: A + B</td>
 * <td nowrap>(numA numB -- num)</td>
 * <td nowrap>(4 3 -- 7)</td>
 * </tr>
 * <tr valign="top">
 * <td>Subtract</td>
 * <td>Arithmetic Subtract: A - B</td>
 * <td nowrap>(numA numB -- num)</td>
 * <td nowrap>(4 3 -- 1)</td>
 * </tr>
 * <tr valign="top">
 * <td>Multiply</td>
 * <td>Arithmetic Multiply: A * B</td>
 * <td nowrap>(numA numB -- num)</td>
 * <td nowrap>(4 3 -- 12)</td>
 * </tr>
 * <tr valign="top">
 * <td>Divide</td>
 * <td>Arithmetic Divide: A / B</td>
 * <td nowrap>(numA numB -- num)</td>
 * <td nowrap>(4 3 -- 1.333)</td>
 * </tr>
 * <tr valign="top">
 * <td>Modulo</td>
 * <td>Arithmetic Modulo: A % B</td>
 * <td nowrap>(numA numB -- num)</td>
 * <td nowrap>(4 3 -- 1)</td>
 * </tr>
 * <tr valign="top">
 * <td>Increment</td>
 * <td>Add 1 to the value on the stack.</td>
 * <td nowrap>(num -- num)</td>
 * <td nowrap>(3 -- 4)</td>
 * </tr>
 * <tr valign="top">
 * <td>Decrement</td>
 * <td>Subtracted 1 from the value on the stack.</td>
 * <td nowrap>(num -- num)</td>
 * <td nowrap>(4 -- 3)</td>
 * </tr>
 * </table>
 * 
 * <p>
 * Arithmetic add is supported by two actions. IntegerAdd was introduced in
 * Flash 4. It was replaced in Flash 5 by the more flexible Add action which is
 * able to add any two numbers and also concatenate strings. If a string and a
 * number are added then the number is converted to its string representation
 * before concatenation.
 * </p>
 * 
 * <h1 class="datasheet">Comparison</h1>
 * 
 * <table class="actions">
 * 
 * <tr>
 * <th>Action</th>
 * <th>Description</th>
 * <th>Stack Notation</th>
 * <th>Example</th>
 * </tr>
 * 
 * <tr valign="top">
 * <td>Less</td>
 * <td>LessThan: A &lt; B</td>
 * <td nowrap>(numA numB -- boolean)</td>
 * <td nowrap>(10 9 -- 0 )</tr>
 * <tr valign="top">
 * <td>StringLess</td>
 * <td>String compare: stringA &lt; stringB</td>
 * <td nowrap>(stringA stringB -- boolean)</td>
 * <td nowrap>("abc" "ab" -- 0)</td>
 * </tr>
 * <tr valign="top">
 * <td>Equals</td>
 * <td>Equals: A == B</td>
 * <td nowrap>(numA numB -- boolean)</td>
 * <td nowrap>(23 23 -- 1 )</tr>
 * <tr valign="top">
 * <td>StringEquals</td>
 * <td>String compare: stringA == stringB</td>
 * <td nowrap>(stringA stringB -- boolean)</td>
 * <td nowrap>("abc" "abc" -- 1)</td>
 * </tr>
 * <tr valign="top">
 * <td>StrictEquals</td>
 * <td>Equals: A === B, are the types as well as the values equal.</td>
 * <td nowrap>(valueA valueB -- boolean)</td>
 * <td nowrap>("23" 23 -- 0 )</tr>
 * <tr valign="top">
 * <td>Greater</td>
 * <td>Greater Than: A > B</td>
 * <td nowrap>(numA numB -- boolean)</td>
 * <td nowrap>(10 9 -- 0 )</tr>
 * <tr valign="top">
 * <td>StringGreater</td>
 * <td>String compare: stringA > stringB</td>
 * <td nowrap>(stringA stringB -- boolean)</td>
 * <td nowrap>("abc" "ab" -- 0)</td>
 * </tr>
 * </table>
 * 
 * <p>
 * The less than comparison is supported by IntegerLess introduced in Flash 4
 * and Less introduced in Flash 5. The Less action is more flexible allowing
 * comparison between any combination of two numbers and strings. In Flash 4
 * comparisons were only supported on values of the same type using either
 * IntegerLess or StringLess.
 * </p>
 * 
 * <p>
 * The equals comparison is supported by IntegerEquals introduced in Flash 4 and
 * Equals introduced in Flash 5. The Equals action is more flexible allowing
 * comparison between any combination of two numbers and strings. In Flash 4
 * comparisons were only supported on values of the same type using either
 * IntegerEquals or StringEquals.
 * </p>
 * 
 * <h1 class="datasheet">Logical</h1>
 * 
 * <table class="actions">
 * 
 * <tr>
 * <th>Action</th>
 * <th>Description</th>
 * <th>Stack Notation</th>
 * <th>Example</th>
 * </tr>
 * 
 * <tr valign="top">
 * <td>And</td>
 * <td>Logical And: A &amp;&amp; B</td>
 * <td nowrap>(numA numB -- boolean)</td>
 * <td nowrap>(3 0 -- 0)</td>
 * </tr>
 * <tr valign="top">
 * <td>Or</td>
 * <td>Logical Or: A || B</td>
 * <td nowrap>(numA numB -- boolean)</td>
 * <td nowrap>(3 0 -- 1)</td>
 * </tr>
 * <tr valign="top">
 * <td>Not</td>
 * <td>Logical Not: !A</td>
 * <td nowrap>(num -- boolean)</td>
 * <td nowrap>(3 -- 0)</td>
 * </tr>
 * </table>
 * 
 * <h1 class="datasheet">Bitwise</h1>
 * 
 * <table class="actions">
 * 
 * <tr>
 * <th>Action</th>
 * <th>Description</th>
 * <th>Stack Notation</th>
 * <th>Example</th>
 * </tr>
 * 
 * <tr valign="top">
 * <td>BitwiseAnd</td>
 * <td>Bitwise And: A &amp; B</td>
 * <td nowrap>(numA numB -- num)</td>
 * <td nowrap>(5 4 -- 4)</td>
 * </tr>
 * <tr valign="top">
 * <td>BitwiseOr</td>
 * <td>Bitwise Or: A | B</td>
 * <td nowrap>(numA numB -- num)</td>
 * <td nowrap>(5 4 -- 5)</td>
 * </tr>
 * <tr valign="top">
 * <td>BitwiseXOr</td>
 * <td>Bitwise Exclusive-Or: A ^ B</td>
 * <td nowrap>(numA numB -- num)</td>
 * <td nowrap>(5 4 -- 1)</td>
 * </tr>
 * <tr valign="top">
 * <td>LogicalShiftLeft</td>
 * <td>Logical Shift Left: A << B</td>
 * <td nowrap>(numA numB -- num)</td>
 * <td nowrap>(4 1 -- 8)</td>
 * </tr>
 * <tr valign="top">
 * <td>LogicalShiftRight</td>
 * <td>Logical Shift Right: A >>> B</td>
 * <td nowrap>(numA numB -- num)</td>
 * <td nowrap>(8 1 -- 4)</td>
 * </tr>
 * <tr valign="top">
 * <td>ArithmeticShiftRight</td>
 * <td>Arithmetic Shift Right (sign extension): A >> B</td>
 * <td nowrap>(numA numB -- num)</td>
 * <td nowrap>(-1 1 -- -1)</td>
 * </tr>
 * </table>
 * 
 * <h1 class="datasheet">String</h1>
 * 
 * <table class="actions">
 * 
 * <tr>
 * <th>Action</th>
 * <th>Description</th>
 * <th>Stack Notation</th>
 * <th>Example</th>
 * </tr>
 * 
 * <tr valign="top">
 * <td>StringAdd</td>
 * <td>Concatenate two strings</td>
 * <td nowrap>(string string -- string)</td>
 * <td nowrap>("ab" "cd" -- "abcd")</td>
 * </tr>
 * <tr valign="top">
 * <td>StringLength</td>
 * <td>Returns the length of a string</td>
 * <td nowrap>(string -- num)</td>
 * <td nowrap>("abc" -- 3)</td>
 * </tr>
 * <tr valign="top">
 * <td>MBStringLength</td>
 * <td>Returns the length of a string that contains characters from an extended
 * set such as Unicode.</td>
 * <td nowrap>(string -- num)</td>
 * <td nowrap>("abc" -- 3)</td>
 * </tr>
 * <tr valign="top">
 * <td>StringExtract</td>
 * <td>Substring. Extract <I>count</I> characters from string starting at
 * position <em>index</em>.</td>
 * <td nowrap>(count index string -- string)</td>
 * <td nowrap>(3 2 "abcde" -- "bcd")</td>
 * </tr>
 * <tr valign="top">
 * <td>MBStringExtract</td>
 * <td>Multi-byte Substring. Extract <I>count</I> characters from string
 * starting at position <em>index</em>.</td>
 * <td nowrap>(count index string -- string)</td>
 * <td nowrap>(3 2 "abcde" -- "bcd")</td>
 * </tr>
 * </table>
 * 
 * <h1 class="datasheet">Type Conversion</h1>
 * 
 * <table class="actions">
 * 
 * <tr>
 * <th>Action</th>
 * <th>Description</th>
 * <th>Stack Notation</th>
 * <th>Example</th>
 * </tr>
 * 
 * <tr valign="top">
 * <td>ToInteger</td>
 * <td>Converts the value to an integer</td>
 * <td nowrap> ( num -- num)</td>
 * <td nowrap> ( 3.2 -- 3 )</tr>
 * <tr valign="top">
 * <td>ToNumber</td>
 * <td>Converts the string value to a number.</td>
 * <td nowrap> ( string -- num)</td>
 * <td nowrap> ( "3.2" -- 3.2 )</tr>
 * <tr valign="top">
 * <td>ToString</td>
 * <td>Converts the value to a string.</td>
 * <td nowrap> ( num -- string)</td>
 * <td nowrap> ( 3.2 -- "3.2" )</tr>
 * <tr valign="top">
 * <td>CharToAscii</td>
 * <td>Convert the first character of a string to its ASCII value.</td>
 * <td nowrap>(string -- num)</td>
 * <td nowrap>("abc" -- 97)</td>
 * </tr>
 * <tr valign="top">
 * <td>MBCharToAscii</td>
 * <td>Convert the first character of string to its Unicode value.</td>
 * <td nowrap>(string -- num)</td>
 * <td nowrap>("abc" -- 61)</td>
 * </tr>
 * <tr valign="top">
 * <td>AsciiToChar</td>
 * <td>Convert the ASCII value to the equivalent character.</td>
 * <td nowrap>(num -- string)</td>
 * <td nowrap>(97 -- "a")</td>
 * </tr>
 * <tr valign="top">
 * <td>MBAsciiToChar</td>
 * <td>Convert a Unicode value to the equivalent character.</td>
 * <td nowrap>(num -- string)</td>
 * <td nowrap>(61 -- "a")</td>
 * </tr>
 * </table>
 * 
 * <h1 class="datasheet">Variables</h1>
 * 
 * <table class="actions">
 * 
 * <tr>
 * <th>Action</th>
 * <th>Description</th>
 * <th>Stack Notation</th>
 * <th>Example</th>
 * </tr>
 * 
 * <tr valign="top">
 * <td>GetVariable</td>
 * <td>Push the value for the specified variable on the stack</td>
 * <td nowrap>(variableName -- value)</td>
 * <td nowrap>("FlashVersion" -- 4)</td>
 * </tr>
 * <tr valign="top">
 * <td>SetVariable</td>
 * <td>Set the value of the specified variable</td>
 * <td nowrap>(variableName value --)</td>
 * <td nowrap>("Var1" 123 --)</td>
 * </tr>
 * <tr valign="top">
 * <td>GetType</td>
 * <td>Returns the type of the object or value at the top of the stack.</td>
 * <td nowrap>(value -- value type)</td>
 * <td nowrap>(--)</td>
 * </tr>
 * <tr valign="top">
 * <td>NewVariable</td>
 * <td>Create a new user-defined variable.</td>
 * <td nowrap>(name --)</td>
 * <td nowrap>("x" --)</td>
 * </tr>
 * <tr valign="top">
 * <td>InitVariable</td>
 * <td>Create and initialise a user-defined variable.</td>
 * <td nowrap>(value name --)</td>
 * <td nowrap>(1 "x" --)</td>
 * </tr>
 * <tr valign="top">
 * <td>NewArray</td>
 * <td>Create an array.</td>
 * <td nowrap>(value+ count -- array)</td>
 * <td nowrap>(1 2 3 4 4 -- array)</td>
 * </tr>
 * <tr valign="top">
 * <td>DeleteVariable</td>
 * <td>Deletes a variable, returning true if the variable was deleted, false
 * otherwise.</td>
 * <td nowrap>(name -- boolean)</td>
 * <td nowrap>("x" -- 1)</td>
 * </tr>
 * <tr valign="top">
 * <td>Delete</td>
 * <td>Deletes an object or variable, returning true if the object was deleted,
 * false otherwise.</td>
 * <td nowrap>(name -- boolean)</td>
 * <td nowrap>("x" -- 1)</td>
 * </tr>
 * </table>
 * 
 * <h1 class="datasheet">Functions</h1>
 * 
 * <table class="actions">
 * 
 * <tr>
 * <th>Action</th>
 * <th>Description</th>
 * <th>Stack Notation</th>
 * <th>Example</th>
 * </tr>
 * 
 * <tr valign="top">
 * <td>ExecuteFunction</td>
 * <td>Execute the built-in function.</td>
 * <td nowrap>(arg* functionName -- result*)</td>
 * <td nowrap>(12.3 "isFinite" -- "1")</td>
 * </tr>
 * <tr valign="top">
 * <td>Return</td>
 * <td>Return control from the function.</td>
 * <td nowrap>(--)</td>
 * <td nowrap>(--)</td>
 * </tr>
 * </table>
 * 
 * <h1 class="datasheet">Objects</h1>
 * 
 * <table class="actions">
 * 
 * <tr>
 * <th>Action</th>
 * <th>Description</th>
 * <th>Stack Notation</th>
 * <th>Example</th>
 * </tr>
 * 
 * <tr valign="top">
 * <td>GetAttribute</td>
 * <td>Push the value of an objects attribute on the stack</td>
 * <td nowrap>(string string -- value)</td>
 * <td nowrap>("Key" "SPACE" -- 32)</td>
 * </tr>
 * <tr valign="top">
 * <td>SetAttribute</td>
 * <td>Set the value of a attribute of an object</td>
 * <td nowrap>(variable string value --)</td>
 * <td nowrap>(&lt;_root&gt; "variable" 1 --)</td>
 * </tr>
 * <tr valign="top">
 * <td>ExecuteMethod</td>
 * <td>Execute a method of an object</td>
 * <td nowrap>(string string -- value)</td>
 * <td nowrap>("Key" "getCode" -- num)</td>
 * </tr>
 * <tr valign="top">
 * <td>NewMethod</td>
 * <td>Define a new method for an object</td>
 * <td nowrap>&nbsp;</td>
 * <td nowrap>&nbsp;</td>
 * </tr>
 * <tr valign="top">
 * <td>NamedObject</td>
 * <td>Construct an instance of a built-in object.</td>
 * <td nowrap>(arg* count className -- instance)</td>
 * <td nowrap>("My String" 1 "String" -- instance)</td>
 * </tr>
 * <tr valign="top">
 * <td>NewObject</td>
 * <td>Define a new class.</td>
 * <td nowrap>((name value)* count -- instance)</td>
 * <td nowrap>("Account" "123456" 1 -- value)</td>
 * </tr>
 * <tr valign="top">
 * <td>Enumerate</td>
 * <td>Enumerate through the attributes of the object referenced by the name of
 * the variable on the stack.</td>
 * <td nowrap>( "var" -- )</td>
 * <td nowrap>( -- )</td>
 * </tr>
 * <tr valign="top">
 * <td>EnumerateObject</td>
 * <td>Enumerate through the attributes of the object on the stack.</td>
 * <td nowrap>( "var" -- )</td>
 * <td nowrap>( -- )</td>
 * </tr>
 * </table>
 * 
 * <h1 class="datasheet">Movie Control</h1>
 * 
 * <table class="actions">
 * 
 * <tr>
 * <th>Action</th>
 * <th>Description</th>
 * <th>Stack Notation</th>
 * <th>Example</th>
 * </tr>
 * 
 * <tr valign="top">
 * <td>GetTarget</td>
 * <td>Returns a string representing the path to the movie clip in which the
 * current action is executed.</td>
 * <td nowrap>(-- clipName )</td>
 * <td nowrap>( -- "_root/MovieClip")</td>
 * </tr>
 * <tr valign="top">
 * <td>SetTarget2</td>
 * <td>Change the context of the Flash Player so subsequent actions are applied
 * to the movie clip, <i>clipName</i>.</td>
 * <td nowrap>(clipName -- )</td>
 * <td nowrap>("MovieClip" --)</td>
 * </tr>
 * <tr valign="top">
 * <td>GetProperty</td>
 * <td>Push the value of the specified property on the stack. Properties are
 * identified by reserved values, see the FSPush class for more details.</td>
 * <td nowrap>(value -- value)</td>
 * <td nowrap>( &lt;_totalframes&gt; -- 36 )</td>
 * </tr>
 * <tr valign="top">
 * <td>SetProperty</td>
 * <td>Set the value of a property</td>
 * <td nowrap>(value propertyName --)</td>
 * <td nowrap>( 8000 &lt;_width&gt; -- )</td>
 * </tr>
 * <tr valign="top">
 * <td>CloneSprite</td>
 * <td>Duplicate a movie clip <i>clipName</i>, on the display list layer
 * <i>depth</i> with the name <i>newName</i>.</td>
 * <td nowrap>( depth clipName newName --)</td>
 * <td nowrap>( 19 "_root/MovieClip" "newClip" -- )</td>
 * </tr>
 * <tr valign="top">
 * <td>RemoveSprite</td>
 * <td>Delete a movie clip</td>
 * <td nowrap>( clipName --)</td>
 * <td nowrap>( "_root/MovieClip" -- )</td>
 * </tr>
 * <tr valign="top">
 * <td>StartDrag</td>
 * <td>Starts dragging a movie clip with an optional constraining rectangle
 * defined by the corner points (x1,y1), (x2,y2).</td>
 * <td nowrap>( x1 y1 x2 y2 1 clipName --)<br>
 * <br>( 0 clipName --)</td>
 * <td nowrap>( 0 0 400 400 1 "movieClip" - )<br>
 * <br>( 0 "movieClip" - )</td>
 * </tr>
 * <tr valign="top">
 * <td>EndDrag</td>
 * <td>Stops dragging a movie clip</td>
 * <td nowrap>(--)</td>
 * <td nowrap>&nbsp;</td>
 * </tr>
 * <tr valign="top">
 * <td>NextFrame</td>
 * <td>Go to the next frame of the current movie</td>
 * <td nowrap>(--)</td>
 * <td nowrap>&nbsp;</td>
 * </tr>
 * <tr valign="top">
 * <td>PreviousFrame</td>
 * <td>Go to the previous frame of the current movie</td>
 * <td nowrap>(-- )</td&nbsp;>
 * <td nowrap>&nbsp;</td>
 * </tr>
 * <tr valign="top">
 * <td>Play</td>
 * <td>Start playing the current movie at the current frame</td>
 * <td nowrap>(--)</td>
 * <td nowrap>&nbsp;</td>
 * </tr>
 * <tr valign="top">
 * <td>Stop</td>
 * <td>Stop playing the current movie</td>
 * <td nowrap>(--)</td>
 * <td nowrap>&nbsp;</td>
 * </tr>
 * <tr valign="top">
 * <td>ToggleQuality</td>
 * <td>Toggle the movie between high and low quality</td>
 * <td nowrap>(--)</td>
 * <td nowrap>&nbsp;</td>
 * </tr>
 * <tr valign="top">
 * <td>StopSounds</td>
 * <td>Stop playing all sounds</td>
 * <td nowrap>(--)</td>
 * <td nowrap>&nbsp;</td>
 * </tr>
 * </table>
 * 
 * <h1 class="datasheet">ActionScript 2.0</h1>
 * 
 * <p>
 * Starting with Flash 6 Macromedia extended the syntax of ActionScript to make
 * it more object-oriented, moving the language closer to Java than JavaScript.
 * Several actions were added to support the new keywords introduced into
 * ActionScript 2.0.
 * </p>
 * 
 * <table class="actions">
 * 
 * <tr>
 * <th>Action</th>
 * <th>Description</th>
 * <th>Stack Notation</th>
 * <th>Example</th>
 * </tr>
 * 
 * <tr valign="top">
 * <td>InstanceOf</td>
 * <td>Return true or false to the stack if the object can be created using the
 * constructor function.</td>
 * <td nowrap>( object function -- true | false)</td>
 * <td nowrap>&nbsp;</td>
 * </tr>
 * <tr valign="top">
 * <td>Implements</td>
 * <td>Identifies a class implements a defined interface.</td>
 * <td nowrap>( (function) count function --)</td>
 * <td nowrap>&nbsp;</td>
 * </tr>
 * <tr valign="top">
 * <td>Extends</td>
 * <td>Identifies that a class inherits from a class - used to increase the
 * execution speed of ActionScript code.</td>
 * <td nowrap>( subclass superclass --)</td>
 * <td nowrap>&nbsp;</td>
 * </tr>
 * <tr valign="top">
 * <td>Cast</td>
 * <td>Casts the type of an object on the stack, returning the object if it is
 * the same type as the constructor function, null otherwise.</td>
 * <td nowrap>(function object -- object | null)</td>
 * <td nowrap>&nbsp;</td>
 * </tr>
 * <tr valign="top">
 * <td>Throw</td>
 * <td>Throw an exception.</td>
 * <td nowrap>(--)</td>
 * <td nowrap>&nbsp;</td>
 * </tr>
 * </table>
 * 
 * <h1 class="datasheet">Miscellaneous</h1>
 * 
 * <table class="actions">
 * 
 * <tr>
 * <th>Action</th>
 * <th>Description</th>
 * <th>Stack Notation</th>
 * <th>Example</th>
 * </tr>
 * 
 * <tr valign="top">
 * <td>Trace</td>
 * <td>Append value to debugging window</td>
 * <td nowrap>(value --)</td>
 * <td nowrap>("X = 3" --)</td>
 * </tr>
 * <tr valign="top">
 * <td>GetTime</td>
 * <td>Push the number of milliseconds that have elapsed since the player
 * started on the stack.</td>
 * <td nowrap>(-- num)</td>
 * <td nowrap>(-- 1274832)</td>
 * </tr>
 * <tr valign="top">
 * <td>RandomNumber</td>
 * <td>Push a random number on the stack.</td>
 * <td nowrap>(maximumValue -- num)</td>
 * <td nowrap>(10 -- 3)</td>
 * </tr>
 * </table>
 * 
 * <p>
 * <b>Notes</b>
 * </p>
 * 
 * <ul>
 * <li>The Add action was updated in Flash 5 so it can be used to perform
 * arithmetic add and string concatenation depending on whether the values on
 * the stack can be interpreted as numeric values or strings. The original add
 * action (Code = 10) should not be used.</li>
 * 
 * <li>For the division operation, if a divide by zero error occurs then the
 * string "#ERROR" is pushed onto the stack.</li>
 * 
 * <li>The Equals and Less actions were updated in Flash 5 so it can be used to
 * perform arithmetic and string comparison depending on whether the values on
 * the stack can be interpreted as numeric values or strings. The original Less
 * action (code = 15) and Equals action (code = 14) should not be used.</li>
 * 
 * <li>Type conversion of string characters is now handled by the String
 * object, introduced in Flash 5. The ToInteger action is now supported by the
 * Math object also introduced in Flash 5. The type conversion functions are
 * only included for completeness.</li>
 * 
 * <li>Flash version 5 supports built-in and user defined objects. For a full
 * description of the objects supported please consult an ActionScript 5
 * reference guide.</li>
 * </ul>
 * 
 * <h1 class="datasheet">Examples</h1>
 * 
 * <p>
 * The FSActionObject class defines a series of constants that lists the type of
 * actions supported in the current release. Actions may be created by
 * specifying the action type in the constructor:
 * </p>
 * 
 * <pre>
 * FSAction anAction = new FSAction(Add);
 * </pre>
 * 
 * <p>
 * The FSPush class is used to push values onto the Flash Player's stack before
 * an action is executed. For example to execute the expression (1+2)*3 when a
 * frame is displayed the following sequence of actions are created:
 * </p>
 * 
 * <pre>
 * FSDoAction frameAction = new FSDoAction();
 * 
 * frameAction.add(new FSPush(1));
 * frameAction.add(new FSPush(2));
 * frameAction.add(new FSAction(Add));
 * frameAction.add(new FSPush(3));
 * frameAction.add(new FSAction(Multiply));
 * </pre>
 * 
 * <p>
 * The Flash Player also supported classes and object that represent different
 * complex data types and system resources such as the mouse. These objects and
 * the functions they support are referenced by name. String containing the
 * names and the values (and number) of the arguments required are pushed onto
 * the stack:
 * </p>
 * 
 * <pre>
 * // Push the arguments followed by the number of arguments onto the stack
 * 
 * frameAction.add(new FSPush(aValue));
 * frameAction.add(new FSPush(aValue));
 * frameAction.add(new FSPush(2));
 * 
 * // Place the name on the stack then execute the function.
 * 
 * frameAction.add(new FSPush(&quot;FunctionName&quot;));
 * frameAction.add(new FSAction(ExecuteFunction));
 * </pre>
 * 
 * <p>
 * To execute a method on a given object a reference to the object is retrieved
 * and the name of the method and any arguments are specified. For example to
 * play a movie clip starting at a named frame:
 * </p>
 * 
 * <pre>
 * // Push the arguments followed by the number of arguments onto the stack
 * 
 * frameAction.add(new FSPush(&quot;frameName&quot;));
 * frameAction.add(new FSPush(1));
 * 
 * // Get a reference to the object.
 * 
 * frameAction.add(new FSPush(&quot;_root&quot;));
 * frameAction.add(new FSPush(&quot;movieClip&quot;));
 * frameAction.add(new FSAction(GetAttribute));
 * 
 * // Place the name of the method on the stack then execute it.
 * 
 * frameAction.add(new FSPush(&quot;gotoAndPlay&quot;));
 * frameAction.add(new FSAction(ExecuteMethod));
 * </pre>
 * 
 * <p>
 * Note: The FSPush class allows more than one value to be pushed onto the stack
 * at a time. In the above examples separate FSPush objects are created to make
 * the code a little more readable.
 * </p>
 * 
 */
public class FSAction extends FSActionObject
{
	/** Type identifying the end of a sequence of actions. */
	public static final int End = 0;

	/** Type identifying a NextFrame stack-based action. */
	public static final int NextFrame = 4;

	/** Type identifying a PrevFrame stack-based action. */
	public static final int PrevFrame = 5;

	/** Type identifying a Play stack-based action. */
	public static final int Play = 6;

	/** Type identifying a Stop stack-based action. */
	public static final int Stop = 7;

	/** Type identifying a ToggleQuality stack-based action. */
	public static final int ToggleQuality = 8;

	/** Type identifying a StopSounds stack-based action. */
	public static final int StopSounds = 9;

	// Flash 4
	// / Type identifying an IntegerAdd stack-based action.
	public static final int IntegerAdd = 10;

	// / Type identifying a Subtract stack-based action.
	public static final int Subtract = 11;

	// / Type identifying a Multiply stack-based action.
	public static final int Multiply = 12;

	// / Type identifying a Divide stack-based action.
	public static final int Divide = 13;

	// / Type identifying an IntegerEquals stack-based action.
	public static final int IntegerEquals = 14;

	// / Type identifying an IntegerLess stack-based action.
	public static final int IntegerLess = 15;

	// / Type identifying an And stack-based action.
	public static final int And = 16;

	// / Type identifying an Or stack-based action.
	public static final int Or = 17;

	// / Type identifying a Not stack-based action.
	public static final int Not = 18;

	// / Type identifying a StringEquals stack-based action.
	public static final int StringEquals = 19;

	// / Type identifying a StringLength stack-based action.
	public static final int StringLength = 20;

	// / Type identifying a StringExtract stack-based action.
	public static final int StringExtract = 21;

	// / Type identifying a Pop stack-based action.
	public static final int Pop = 23;

	// / Type identifying a ToInteger stack-based action.
	public static final int ToInteger = 24;

	// / Type identifying a GetVariable stack-based action.
	public static final int GetVariable = 28;

	// / Type identifying a SetVariable stack-based action.
	public static final int SetVariable = 29;

	// / Type identifying a SetTarget2 stack-based action.
	public static final int SetTarget2 = 32;

	// / Type identifying a StringAdd stack-based action.
	public static final int StringAdd = 33;

	// / Type identifying a GetProperty stack-based action.
	public static final int GetProperty = 34;

	// / Type identifying a SetProperty stack-based action.
	public static final int SetProperty = 35;

	// / Type identifying a CloneSprite stack-based action.
	public static final int CloneSprite = 36;

	// / Type identifying a RemoveSprite stack-based action.
	public static final int RemoveSprite = 37;

	// / Type identifying a Trace stack-based action.
	public static final int Trace = 38;

	// / Type identifying a StartDrag stack-based action.
	public static final int StartDrag = 39;

	// / Type identifying a EndDrag stack-based action.
	public static final int EndDrag = 40;

	// / Type identifying a StringLess stack-based action.
	public static final int StringLess = 41;

	// / Type identifying a RandomNumber stack-based action.
	public static final int RandomNumber = 48;

	// / Type identifying a MBStringLength stack-based action.
	public static final int MBStringLength = 49;

	// / Type identifying a CharToAscii stack-based action.
	public static final int CharToAscii = 50;

	// / Type identifying a AsciiToChar stack-based action.
	public static final int AsciiToChar = 51;

	// / Type identifying a GetTime stack-based action.
	public static final int GetTime = 52;

	// / Type identifying an MBStringExtract stack-based action.
	public static final int MBStringExtract = 53;

	// / Type identifying an MBCharToAscii stack-based action.
	public static final int MBCharToAscii = 54;

	// / Type identifying an MBAsciiToChar stack-based action.
	public static final int MBAsciiToChar = 55;

	// Flash 5
	// / Type identifying a DeleteVariable stack-based action.
	public static final int DeleteVariable = 58;

	// / Type identifying a Delete stack-based action.
	public static final int Delete = 59;

	// / Type identifying a InitVariable stack-based action.
	public static final int InitVariable = 60;

	// / Type identifying a ExecuteFunction stack-based action.
	public static final int ExecuteFunction = 61;

	// / Type identifying a Return stack-based action.
	public static final int Return = 62;

	// / Type identifying a Modulo stack-based action.
	public static final int Modulo = 63;

	// / Type identifying a NamedObject stack-based action.
	public static final int NamedObject = 64;

	// / Type identifying a NewVariable stack-based action.
	public static final int NewVariable = 65;

	// / Type identifying a NewArray stack-based action.
	public static final int NewArray = 66;

	// / Type identifying a NewObject stack-based action.
	public static final int NewObject = 67;

	// / Type identifying a GetType stack-based action.
	public static final int GetType = 68;

	// / Type identifying a GetTarget stack-based action.
	public static final int GetTarget = 69;

	// / Type identifying an Enumerate stack-based action.
	public static final int Enumerate = 70;

	// / Type identifying an Add stack-based action.
	public static final int Add = 71;

	// / Type identifying a Less stack-based action.
	public static final int Less = 72;

	// / Type identifying an Equals stack-based action.
	public static final int Equals = 73;

	// / Type identifying a ToNumber stack-based action.
	public static final int ToNumber = 74;

	// / Type identifying a ToString stack-based action.
	public static final int ToString = 75;

	// / Type identifying a Duplicate stack-based action.
	public static final int Duplicate = 76;

	// / Type identifying a Swap stack-based action.
	public static final int Swap = 77;

	// / Type identifying a GetAttribute stack-based action.
	public static final int GetAttribute = 78;

	// / Type identifying a SetAttribute stack-based action.
	public static final int SetAttribute = 79;

	// / Type identifying an Increment stack-based action.
	public static final int Increment = 80;

	// / Type identifying a Decrement stack-based action.
	public static final int Decrement = 81;

	// / Type identifying an ExecuteMethod stack-based action.
	public static final int ExecuteMethod = 82;

	// / Type identifying a NewMethod stack-based action.
	public static final int NewMethod = 83;

	// / Type identifying a BitwiseAnd stack-based action.
	public static final int BitwiseAnd = 96;

	// / Type identifying a BitwiseOr stack-based action.
	public static final int BitwiseOr = 97;

	// / Type identifying a BitwiseXOr stack-based action.
	public static final int BitwiseXOr = 98;

	// / Type identifying a LogicalShiftLeft stack-based action.
	public static final int LogicalShiftLeft = 99;

	// / Type identifying an ArithmeticShiftRight stack-based action.
	public static final int ArithmeticShiftRight = 100;

	// / Type identifying a LogicalShiftRight stack-based action.
	public static final int LogicalShiftRight = 101;

	// Flash 6
	// / Type identifying an InstanceOf stack-based action.
	public static final int InstanceOf = 84;

	// / Type identifying an EnumerateObject stack-based action.
	public static final int EnumerateObject = 85;

	// / Type identifying a StrictEquals stack-based action.
	public static final int StrictEquals = 102;

	// / Type identifying a Greater stack-based action.
	public static final int Greater = 103;

	// / Type identifying a StringGreater stack-based action.
	public static final int StringGreater = 104;

	// Flash 7
	// / Type identifying a Throw stack-based action.
	public static final int Throw = 42;

	// / Type identifying a Cast stack-based action.
	public static final int Cast = 43;

	// / Type identifying an Implements stack-based action.
	public static final int Implements = 44;

	// / Type identifying an Extends stack-based action.
	public static final int Extends = 105;

	static String[] names =
	{
		"End", // 0
		"", "", "",
		"NextFrame", // 4;
		"PrevFrame", // 5;
		"Play", // 6;
		"Stop", // 7;
		"ToggleQuality", // 8;
		"StopSounds", // 9;
		"IntegerAdd", // 10;
		"Subtract", // 11;
		"Multiply", // 12;
		"Divide", // 13;
		"IntegerEquals", // 14;
		"IntegerLess", // 15;
		"And", // 16;
		"Or", // 17;
		"Not", // 18;
		"StringEquals", // 19;
		"StringLength", // 20;
		"StringExtract", // 21;
		"",
		"Pop", // 23;
		"ToInteger", // 24;
		"", "", "",
		"GetVariable", // 28;
		"SetVariable", // 29;
		"", "",
		"SetTarget2", // 32;
		"StringAdd", // 33;
		"GetProperty", // 34;
		"SetProperty", // 35;
		"CloneSprite", // 36;
		"RemoveSprite", // 37;
		"Trace", // 38;
		"StartDrag", // 39;
		"EndDrag", // 40;
		"StringLess", // 41;
		"Throw", // 42;
		"Cast", // 43;
		"Implements", // 44;
		"", "", "",
		"RandomNumber", // 48;
		"MBStringLength", // 49;
		"CharToAscii", // 50;
		"AsciiToChar", // 51;
		"GetTime", // 52;
		"MBStringExtract", // 53;
		"MBCharToAscii", // 54;
		"MBAsciiToChar", // 55;
		"", "",
		"DeleteVariable", // 58;
		"Delete", // 59;
		"InitVariable", // 60;
		"ExecuteFunction", // 61;
		"Return", // 62;
		"Modulo", // 63;
		"NamedObject", // 64;
		"NewVariable", // 65;
		"NewArray", // 66;
		"NewObject", // 67;
		"GetType", // 68;
		"GetTarget", // 69;
		"Enumerate", // 70;
		"Add", // 71;
		"Less", // 72;
		"Equals", // 73;
		"ToNumber", // 74;
		"ToString", // 75;
		"Duplicate", // 76;
		"Swap", // 77;
		"GetAttribute", // 78;
		"SetAttribute", // 79;
		"Increment", // 80;
		"Decrement", // 81;
		"ExecuteMethod", // 82;
		"NewMethod", // 83;
		"InstanceOf", // 84;
		"EnumerateObject", // 85;
		"", "", "", "", "", "", "", "", "", "",
		"BitwiseAnd", // 96;
		"BitwiseOr", // 97;
		"BitwiseXOr", // 98;
		"LogicalShiftLeft", // 99;
		"ArithmeticShiftRight", // 100;
		"LogicalShiftRight", // 101;
		"StrictEquals", // 102;
		"Greater", // 103;
		"StringGreater", // 104;
		"Extends", // 105;
		"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
		"", "", "", "", // 127
	};

	private static final FSAction[] actions =
	{
		new FSAction(End), // 0;
		new FSAction(1),
		new FSAction(2),
		new FSAction(3),
		new FSAction(NextFrame), // 4;
		new FSAction(PrevFrame), // 5;
		new FSAction(Play), // 6;
		new FSAction(Stop), // 7;
		new FSAction(ToggleQuality), // 8;
		new FSAction(StopSounds), // 9;
		new FSAction(IntegerAdd), // 10;
		new FSAction(Subtract), // 11;
		new FSAction(Multiply), // 12;
		new FSAction(Divide), // 13;
		new FSAction(IntegerEquals), // 14;
		new FSAction(IntegerLess), // 15;
		new FSAction(And), // 16;
		new FSAction(Or), // 17;
		new FSAction(Not), // 18;
		new FSAction(StringEquals), // 19;
		new FSAction(StringLength), // 20;
		new FSAction(StringExtract), // 21;
		new FSAction(22),
		new FSAction(Pop), // 23;
		new FSAction(ToInteger), // 24;
		new FSAction(25),
		new FSAction(26),
		new FSAction(27),
		new FSAction(GetVariable), // 28;
		new FSAction(SetVariable), // 29;
		new FSAction(30),
		new FSAction(31),
		new FSAction(SetTarget2), // 32;
		new FSAction(StringAdd), // 33;
		new FSAction(GetProperty), // 34;
		new FSAction(SetProperty), // 35;
		new FSAction(CloneSprite), // 36;
		new FSAction(RemoveSprite), // 37;
		new FSAction(Trace), // 38;
		new FSAction(StartDrag), // 39;
		new FSAction(EndDrag), // 40;
		new FSAction(StringLess), // 41;
		new FSAction(Throw), // 42;
		new FSAction(Cast), // 43;
		new FSAction(Implements), // 44;
		new FSAction(45),
		new FSAction(46),
		new FSAction(47),
		new FSAction(RandomNumber), // 48;
		new FSAction(MBStringLength), // 49;
		new FSAction(CharToAscii), // 50;
		new FSAction(AsciiToChar), // 51;
		new FSAction(GetTime), // 52;
		new FSAction(MBStringExtract), // 53;
		new FSAction(MBCharToAscii), // 54;
		new FSAction(MBAsciiToChar), // 55;
		new FSAction(56),
		new FSAction(57),
		new FSAction(DeleteVariable), // 58;
		new FSAction(Delete), // 59;
		new FSAction(InitVariable), // 60;
		new FSAction(ExecuteFunction), // 61;
		new FSAction(Return), // 62;
		new FSAction(Modulo), // 63;
		new FSAction(NamedObject), // 64;
		new FSAction(NewVariable), // 65;
		new FSAction(NewArray), // 66;
		new FSAction(NewObject), // 67;
		new FSAction(GetType), // 68;
		new FSAction(GetTarget), // 69;
		new FSAction(Enumerate), // 70;
		new FSAction(Add), // 71;
		new FSAction(Less), // 72;
		new FSAction(Equals), // 73;
		new FSAction(ToNumber), // 74;
		new FSAction(ToString), // 75;
		new FSAction(Duplicate), // 76;
		new FSAction(Swap), // 77;
		new FSAction(GetAttribute), // 78;
		new FSAction(SetAttribute), // 79;
		new FSAction(Increment), // 80;
		new FSAction(Decrement), // 81;
		new FSAction(ExecuteMethod), // 82;
		new FSAction(NewMethod), // 83;
		new FSAction(InstanceOf), // 84;
		new FSAction(EnumerateObject), // 85;
		new FSAction(86),
		new FSAction(87),
		new FSAction(88),
		new FSAction(89),
		new FSAction(90),
		new FSAction(91),
		new FSAction(92),
		new FSAction(93),
		new FSAction(94),
		new FSAction(95),
		new FSAction(BitwiseAnd), // 96;
		new FSAction(BitwiseOr), // 97;
		new FSAction(BitwiseXOr), // 98;
		new FSAction(LogicalShiftLeft), // 99;
		new FSAction(ArithmeticShiftRight), // 100;
		new FSAction(LogicalShiftRight), // 101;
		new FSAction(StrictEquals), // 102;
		new FSAction(Greater), // 103;
		new FSAction(StringGreater), // 104;
		new FSAction(Extends), // 105;
		new FSAction(106), new FSAction(107), new FSAction(108),
		new FSAction(109), new FSAction(110), new FSAction(111),
		new FSAction(112), new FSAction(113), new FSAction(114),
		new FSAction(115), new FSAction(116), new FSAction(117),
		new FSAction(118), new FSAction(119), new FSAction(120),
		new FSAction(121), new FSAction(122), new FSAction(123),
		new FSAction(124), new FSAction(125), new FSAction(126),
		new FSAction(127), // 127
	};

	static FSAction getInstance(int type)
	{
		return actions[type];
	}

	/**
	 * Factory method for generating an FSAction object representing the end of
	 * a sequence of actions.
	 */
	public static FSAction End()
	{
		return actions[End];
	}

	/**
	 * Factory method for generating an FSAction object representing a NextFrame
	 * action.
	 */
	public static FSAction NextFrame()
	{
		return actions[NextFrame];
	}

	/**
	 * Factory method for generating an FSAction object representing a PrevFrame
	 * action.
	 */
	public static FSAction PrevFrame()
	{
		return actions[PrevFrame];
	}

	/**
	 * Factory method for generating an FSAction object representing a Play
	 * action.
	 */
	public static FSAction Play()
	{
		return actions[Play];
	}

	/**
	 * Factory method for generating an FSAction object representing a Stop
	 * action.
	 */
	public static FSAction Stop()
	{
		return actions[Stop];
	}

	/**
	 * Factory method for generating an FSAction object representing a
	 * ToggleQuality action.
	 */
	public static FSAction ToggleQuality()
	{
		return actions[ToggleQuality];
	}

	/**
	 * Factory method for generating an FSAction object representing a
	 * StopSounds action.
	 */
	public static FSAction StopSounds()
	{
		return actions[StopSounds];
	}

	// Flash 4
	/** 
	 * Factory method for generating an FSAction object representing a
	 * Subtract action. 
	 */
	public static FSAction Subtract()
	{
		return actions[Subtract];
	}

	/** 
	 * Factory method for generating an FSAction object representing a
	 * Multiply action. 
	 * */
	public static FSAction Multiply()
	{
		return actions[Multiply];
	}

	/** 
	 * Factory method for generating an FSAction object representing a Divide 
	 * action. 
	 */
	public static FSAction Divide()
	{
		return actions[Divide];
	}

	/** 
	 * Factory method for generating an FSAction object representing a And
	 * action. 
	 */
	public static FSAction And()
	{
		return actions[And];
	}

	/** 
	 * Factory method for generating an FSAction object representing a Or 
	 * action. 
	 */
	public static FSAction Or()
	{
		return actions[Or];
	}

	/** 
	 * Factory method for generating an FSAction object representing a Not 
	 * action. 
	 */
	public static FSAction Not()
	{
		return actions[Not];
	}

	/** 
	 * Factory method for generating an FSAction object representing a
	 * StringEquals action. 
	 */
	public static FSAction StringEquals()
	{
		return actions[StringEquals];
	}

	/** 
	 * Factory method for generating an FSAction object representing a 
	 * StringLength action. 
	 */
	public static FSAction StringLength()
	{
		return actions[StringLength];
	}

	/** 
	 * Factory method for generating an FSAction object representing a
	 * StringExtract action. 
	 */
	public static FSAction StringExtract()
	{
		return actions[StringExtract];
	}

	/**
	 * Factory method for generating an FSAction object representing a Pop
	 * action. 
	 */
	public static FSAction Pop()
	{
		return actions[Pop];
	}

	/** 
	 * Factory method for generating an FSAction object representing a 
	 * ToInteger action. 
	 */
	public static FSAction ToInteger()
	{
		return actions[ToInteger];
	}

	/** 
	 * Factory method for generating an FSAction object representing a
	 * GetVariable action. 
	 */
	public static FSAction GetVariable()
	{
		return actions[GetVariable];
	}

	/** 
	 * Factory method for generating an FSAction object representing a
	 * SetVariable action. 
	 */
	public static FSAction SetVariable()
	{
		return actions[SetVariable];
	}

	/** 
	 * Factory method for generating an FSAction object representing a
	 * SetTarget2 action. 
	 */
	public static FSAction SetTarget2()
	{
		return actions[SetTarget2];
	}

	/** 
	 * Factory method for generating an FSAction object representing a
	 * StringAdd action. 
	 */
	public static FSAction StringAdd()
	{
		return actions[StringAdd];
	}

	/** 
	 * Factory method for generating an FSAction object representing a
	 * GetProperty action. 
	 */
	public static FSAction GetProperty()
	{
		return actions[GetProperty];
	}

	/** 
	 * Factory method for generating an FSAction object representing a 
	 * SetProperty action. 
	 */
	public static FSAction SetProperty()
	{
		return actions[SetProperty];
	}

	/** 
	 * Factory method for generating an FSAction object representing a
	 * CloneSprite action. 
	 */
	public static FSAction CloneSprite()
	{
		return actions[CloneSprite];
	}

	/** 
	 * Factory method for generating an FSAction object representing a
	 * RemoveSprite action. 
	 */
	public static FSAction RemoveSprite()
	{
		return actions[RemoveSprite];
	}

	/** Factory method for generating an FSAction object representing a Trace
	 * action. 
	 */
	public static FSAction Trace()
	{
		return actions[Trace];
	}

	/** 
	 * Factory method for generating an FSAction object representing a
	 * StartDrag action. 
	 */
	public static FSAction StartDrag()
	{
		return actions[StartDrag];
	}

	/** 
	 * Factory method for generating an FSAction object representing a EndDrag
	 * action. 
	 */
	public static FSAction EndDrag()
	{
		return actions[EndDrag];
	}

	/** 
	 * Factory method for generating an FSAction object representing a
	 * StringLess action. 
	 */
	public static FSAction StringLess()
	{
		return actions[StringLess];
	}

	/** 
	 * Factory method for generating an FSAction object representing a
	 * RandomNumber action.
	 */
	public static FSAction RandomNumber()
	{
		return actions[RandomNumber];
	}

	/** 
	 * Factory method for generating an FSAction object representing a
	 * MBStringLength action. 
	 */
	public static FSAction MBStringLength()
	{
		return actions[MBStringLength];
	}

	/** 
	 * Factory method for generating an FSAction object representing a
	 * CharToAscii action.
	 */
	public static FSAction CharToAscii()
	{
		return actions[CharToAscii];
	}

	/** 
	 * Factory method for generating an FSAction object representing a
	 * AsciiToChar action. 
	 */
	public static FSAction AsciiToChar()
	{
		return actions[AsciiToChar];
	}

	/** 
	 * Factory method for generating an FSAction object representing a GetTime
	 * action. 
	 */
	public static FSAction GetTime()
	{
		return actions[GetTime];
	}

	/** 
	 * Factory method for generating an FSAction object representing a
	 * MBStringExtract action. 
	 */
	public static FSAction MBStringExtract()
	{
		return actions[MBStringExtract];
	}

	/** 
	 * Factory method for generating an FSAction object representing a
	 * MBCharToAscii action. 
	 */
	public static FSAction MBCharToAscii()
	{
		return actions[MBCharToAscii];
	}

	/**
	 * Factory method for generating an FSAction object representing a
	 * MBAsciiToChar action. 
	 */
	public static FSAction MBAsciiToChar()
	{
		return actions[MBAsciiToChar];
	}

	// Flash 5
	/** 
	 * Factory method for generating an FSAction object representing a
	 * DeleteVariable action. 
	 */
	public static FSAction DeleteVariable()
	{
		return actions[DeleteVariable];
	}

	/** 
	 * Factory method for generating an FSAction object representing a Delete
	 *  action. 
	 */
	public static FSAction Delete()
	{
		return actions[Delete];
	}

	/** 
	 * Factory method for generating an FSAction object representing a
	 * InitVariable action. 
	 */
	public static FSAction InitVariable()
	{
		return actions[InitVariable];
	}

	/** 
	 * Factory method for generating an FSAction object representing a
	 * ExecuteFunction action. 
	 */
	public static FSAction ExecuteFunction()
	{
		return actions[ExecuteFunction];
	}

	/** 
	 * Factory method for generating an FSAction object representing a Return
	 * action. 
	 */
	public static FSAction Return()
	{
		return actions[Return];
	}

	/**
	 * Factory method for generating an FSAction object representing a Modulo
	 * action. 
	 */
	public static FSAction Modulo()
	{
		return actions[Modulo];
	}

	/** 
	 * Factory method for generating an FSAction object representing a
	 * NamedObject action. 
	 */
	public static FSAction NamedObject()
	{
		return actions[NamedObject];
	}

	/** 
	 * Factory method for generating an FSAction object representing a
	 * NewVariable action. 
	 */
	public static FSAction NewVariable()
	{
		return actions[NewVariable];
	}

	/** 
	 * Factory method for generating an FSAction object representing a
	 * NewArray action. 
	 */
	public static FSAction NewArray()
	{
		return actions[NewArray];
	}

	/** 
	 * Factory method for generating an FSAction object representing a
	 * NewObject action. 
	 */
	public static FSAction NewObject()
	{
		return actions[NewObject];
	}

	/** 
	 * Factory method for generating an FSAction object representing a GetType
	 * action. 
	 */
	public static FSAction GetType()
	{
		return actions[GetType];
	}

	/** 
	 * Factory method for generating an FSAction object representing a
	 * GetTarget action. 
	 */
	public static FSAction GetTarget()
	{
		return actions[GetTarget];
	}

	/** 
	 * Factory method for generating an FSAction object representing a
	 * Enumerate action. 
	 */
	public static FSAction Enumerate()
	{
		return actions[Enumerate];
	}

	/** 
	 * Factory method for generating an FSAction object representing a Add
	 * action. 
	 */
	public static FSAction Add()
	{
		return actions[Add];
	}

	/** 
	 * Factory method for generating an FSAction object representing a Less
	 * action. 
	 */
	public static FSAction Less()
	{
		return actions[Less];
	}

	/** 
	 * Factory method for generating an FSAction object representing a Equals
	 * action. 
	 */
	public static FSAction Equals()
	{
		return actions[Equals];
	}

	/** 
	 * Factory method for generating an FSAction object representing a
	 * ToNumber action. 
	 */
	public static FSAction ToNumber()
	{
		return actions[ToNumber];
	}

	/** 
	 * Factory method for generating an FSAction object representing a
	 * ToString action. 
	 */
	public static FSAction ToString()
	{
		return actions[ToString];
	}

	/** 
	 * Factory method for generating an FSAction object representing a
	 * Duplicate action. 
	 */
	public static FSAction Duplicate()
	{
		return actions[Duplicate];
	}

	/** 
	 * Factory method for generating an FSAction object representing a Swap
	 * action. 
	 */
	public static FSAction Swap()
	{
		return actions[Swap];
	}

	/** 
	 * Factory method for generating an FSAction object representing a
	 * GetAttribute action. 
	 */
	public static FSAction GetAttribute()
	{
		return actions[GetAttribute];
	}

	/** 
	 * Factory method for generating an FSAction object representing a
	 * SetAttribute action. 
	 */
	public static FSAction SetAttribute()
	{
		return actions[SetAttribute];
	}

	/** 
	 * Factory method for generating an FSAction object representing a
	 * Increment action. 
	 */
	public static FSAction Increment()
	{
		return actions[Increment];
	}

	/** 
	 * Factory method for generating an FSAction object representing a
	 * Decrement action. 
	 */
	public static FSAction Decrement()
	{
		return actions[Decrement];
	}

	/** 
	 * Factory method for generating an FSAction object representing a
	 * ExecuteMethod action. 
	 */
	public static FSAction ExecuteMethod()
	{
		return actions[ExecuteMethod];
	}

	/** 
	 * Factory method for generating an FSAction object representing a
	 * NewMethod action. 
	 */
	public static FSAction NewMethod()
	{
		return actions[NewMethod];
	}

	/** 
	 * Factory method for generating an FSAction object representing a
	 * BitwiseAnd action. 
	 */
	public static FSAction BitwiseAnd()
	{
		return actions[BitwiseAnd];
	}

	/** 
	 * Factory method for generating an FSAction object representing a
	 * BitwiseOr action. 
	 */
	public static FSAction BitwiseOr()
	{
		return actions[BitwiseOr];
	}

	/** 
	 * Factory method for generating an FSAction object representing a
	 * BitwiseXOr action. 
	 */
	public static FSAction BitwiseXOr()
	{
		return actions[BitwiseXOr];
	}

	/** 
	 * Factory method for generating an FSAction object representing a
	 * LogicalShiftLeft action. 
	 */
	public static FSAction LogicalShiftLeft()
	{
		return actions[LogicalShiftLeft];
	}

	/** 
	 * Factory method for generating an FSAction object representing a
	 * ArithmeticShiftRight action. 
	 */
	public static FSAction ArithmeticShiftRight()
	{
		return actions[ArithmeticShiftRight];
	}

	/** 
	 * Factory method for generating an FSAction object representing a
	 * LogicalShiftRight action. 
	 */
	public static FSAction LogicalShiftRight()
	{
		return actions[LogicalShiftRight];
	}

	// Flash 6
	/** 
	 * Factory method for generating an FSAction object representing a
	 * InstanceOf action. 
	 */
	public static FSAction InstanceOf()
	{
		return actions[InstanceOf];
	}

	/** 
	 * Factory method for generating an FSAction object representing a
	 * EnumerateObject action. 
	 */
	public static FSAction EnumerateObject()
	{
		return actions[EnumerateObject];
	}

	/** 
	 * Factory method for generating an FSAction object representing a Greater
	 * action. 
	 */
	public static FSAction Greater()
	{
		return actions[Greater];
	}

	/** 
	 * Factory method for generating an FSAction object representing a
	 * StringGreater action. 
	 */
	public static FSAction StringGreater()
	{
		return actions[StringGreater];
	}

	/** 
	 * Factory method for generating an FSAction object representing a
	 * StrictEquals action. 
	 */
	public static FSAction StrictEquals()
	{
		return actions[StrictEquals];
	}

	// Flash 7
	/** 
	 * Factory method for generating an FSAction object representing a Cast 
	 * action. 
	 */
	public static FSAction Cast()
	{
		return actions[Cast];
	}

	/** 
	 * Factory method for generating an FSAction object representing an 
	 * Implements action. 
	 */
	public static FSAction Implements()
	{
		return actions[Implements];
	}

	/** 
	 * Factory method for generating an FSAction object representing a Throw
	 * action. 
	 */
	public static FSAction Throw()
	{
		return actions[Throw];
	}

	/** 
	 * Factory method for generating an FSAction object representing a Extends
	 * action. 
	 */
	public static FSAction Extends()
	{
		return actions[Extends];
	}

	/**
	 * Construct an FSAction object, initalizing it with values decoded from an
	 * encoded object.
	 * 
	 * @param coder
	 *            an FSCoder containing the binary data.
	 */
	public FSAction(FSCoder coder)
	{
		super(0);
		decode(coder);
	}

	/**
	 * Constructs a stack-based action with the specified type.
	 * 
	 * @param aType
	 *            the code used to denote the type of action performed.
	 */
	public FSAction(int aType)
	{
		super(aType);
	}

	/**
	 * Constructs an FSAction object by copying values from an existing object.
	 * 
	 * @param obj
	 *            an FSAction object.
	 */
	public FSAction(FSAction obj)
	{
		super(obj);
	}

	/**
	 * Returns a string identifying the type of stack-based action that the
	 * object represents.
	 * 
	 * @return a string containing the name of the action.
	 */
	public String name()
	{
		return names[type];
	}

	public void appendDescription(StringBuffer buffer, int depth)
	{
		buffer.append(name());
	}

	public void encode(FSCoder coder)
	{
		super.encode(coder);
		coder.endObject(name());
	}

	public void decode(FSCoder coder)
	{
		super.decode(coder);
		coder.endObject(name());
	}
}