com.flagstone.transform.action
Enum BasicAction

java.lang.Object
  extended by java.lang.Enum<BasicAction>
      extended by com.flagstone.transform.action.BasicAction
All Implemented Interfaces:
Action, Copyable<Action>, SWFEncodeable, Serializable, Comparable<BasicAction>

public enum BasicAction
extends Enum<BasicAction>
implements Action

BasicAction represents all the actions that can be encoded using a single byte-code. Where appropriate the description for an action contains a simple example showing the order of arguments on the stack and any result: e.g. 3, 2 -> 1. Here 3 and 2 are the numbers on the stack with 2 being the top-most. When the action is executed the numbers are popped off and the result to the right of the arrow is the result is pushed onto the stack.

Notes:

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.

Arithmetic add is supported by two actions. INTEGER_ADD 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.

For comparison, Flash 4 introduced INTEGER_LESS and INTEGER_EQUALS for comparing numbers and STRING_LESS and STRING_EQUALS for comparing strings. They were superseded in Flash 5 by LESS and EQUALS which work with either strings or numbers.


Enum Constant Summary
ADD
          Add two numbers.
ARITH_SHIFT_RIGHT
          Arithmetically shift a number right.
ASCII_TO_CHAR
          Convert the ASCII value to the equivalent character.
BITWISE_AND
          Bitwise and tow numbers.
BITWISE_OR
          Bitwise or tow numbers.
BITWISE_XOR
          Bitwise exclusive-or two numbers.
CAST
          Casts the type of an object.
CHAR_TO_ASCII
          Convert the first character of a string to its ASCII value.
CLONE_SPRITE
          Duplicate a movie clip on the display list.
DECREMENT
          Decrement a number.
DELETE
          Delete an object or variable.
DELETE_VARIABLE
          Delete a variable.
DIVIDE
          Divide two numbers.
DUPLICATE
          Duplicate the value at the top of the stack.
END
          Signals the end of a list of actions.
END_DRAG
          Stop dragging the mouse.
ENUMERATE
          Enumerate through the attributes of an object.
ENUMERATE_OBJECT
          Enumerate through the attributes of an object.
EQUALS
          Test where one value is equal to another.
EXECUTE_FUNCTION
          Execute a function.
EXECUTE_METHOD
          Execute a method.
EXTENDS
          Identifies that a class inherits from a class.
FS_COMMAND2
          FSCommand2 function
GET_ATTRIBUTE
          Get the value of an object's attribute.
GET_PROPERTY
          Push the value of the specified property on the stack.
GET_TARGET
          Return the path to the current movie clip.
GET_TIME
          Return the elapsed time since the start of the movie.
GET_TYPE
          Return the type of an object or value.
GET_VARIABLE
          Get the value of a variable.
GREATER
          Test whether a number is greater than another.
IMPLEMENTS
          Identifies a class implements a defined interface.
INCREMENT
          Increment a number.
INIT_VARIABLE
          Create and set a variable.
INSTANCEOF
          Tests whether an object can be created using the constructor.
INTEGER_ADD
          Add two integers.
INTEGER_EQUALS
          Test whether two integers are equal.
INTEGER_LESS
          Test where one number is less than another.
LESS
          Test where one value is less than another.
LOGICAL_AND
          Logically and two values together.
LOGICAL_NOT
          Logically invert a value.
LOGICAL_OR
          Logically or two values together.
MB_ASCII_TO_CHAR
          Convert a Unicode value to the equivalent character.
MB_CHAR_TO_ASCII
          Convert the first character of string to its Unicode value.
MB_STRING_EXTRACT
          Substring of a multi-byte string.
MB_STRING_LENGTH
          Get the length of an multi-byte string.
MODULO
          Calculate the modulus of two numbers.
MULTIPLY
          Multiply two numbers.
NAMED_OBJECT
          Construct an instance of a built-in object.
NEW_ARRAY
          Create a new array.
NEW_METHOD
          Define a new method for an object.
NEW_OBJECT
          Define a new class.
NEW_VARIABLE
          Create a new variable.
NEXT_FRAME
          Move to the next frame.
PLAY
          Start playing the movie or movie clip.
POP
          Pop value from the top of the stack.
PREV_FRAME
          Move to the previous frame.
RANDOM_NUMBER
          Push a random number onto the stack.
REMOVE_SPRITE
          Delete a movie clip.
RETURN
          Return control from a function.
SET_ATTRIBUTE
          Set the value of an object's attribute.
SET_PROPERTY
          Set the value of a property.
SET_TARGET_2
          Execute the following actions with the named movie clip.
SET_VARIABLE
          Set the value of a variable.
SHIFT_LEFT
          Shift a number left.
SHIFT_RIGHT
          Shift a number right.
START_DRAG
          Start dragging the mouse.
STOP
          Stop playing the movie or movie clip.
STOP_SOUNDS
          Stop playing all sounds.
STRICT_EQUALS
          Test whether type and value of two objects are equal.
STRING_ADD
          Concatenate two strings.
STRING_EQUALS
          Test whether two strings are equal.
STRING_EXTRACT
          Substring.
STRING_GREATER
          Test whether a string is greater than another.
STRING_LENGTH
          Get the length of an ASCII string.
STRING_LESS
          Test where one string is less than another.
SUBTRACT
          Subtract two integers.
SWAP
          Swap the top two values on the stack.
THROW
          Throw an exception.
TO_INTEGER
          Convert a value to an integer.
TO_NUMBER
          Converts the string value to a number.
TO_STRING
          Converts the value to a string.
TOGGLE_QUALITY
          Toggle the movie between high and low quality.
TRACE
          Append value to debugging window.
 
Method Summary
 BasicAction copy()
          Creates a complete copy of this object.
 void encode(SWFEncoder coder, Context context)
          Encode an object to the Flash binary format.
static BasicAction fromInt(int actionType)
          Returns the BasicAction for a given type.
 int prepareToEncode(Context context)
          Prepare an object for encoding, returning the expected size of an object when it is encoded.
static BasicAction valueOf(String name)
          Returns the enum constant of this type with the specified name.
static BasicAction[] values()
          Returns an array containing the constants of this enum type, in the order they are declared.
 
Methods inherited from class java.lang.Enum
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Enum Constant Detail

END

public static final BasicAction END
Signals the end of a list of actions.


NEXT_FRAME

public static final BasicAction NEXT_FRAME
Move to the next frame.


PREV_FRAME

public static final BasicAction PREV_FRAME
Move to the previous frame.


PLAY

public static final BasicAction PLAY
Start playing the movie or movie clip.


STOP

public static final BasicAction STOP
Stop playing the movie or movie clip.


TOGGLE_QUALITY

public static final BasicAction TOGGLE_QUALITY
Toggle the movie between high and low quality.


STOP_SOUNDS

public static final BasicAction STOP_SOUNDS
Stop playing all sounds.


INTEGER_ADD

public static final BasicAction INTEGER_ADD
Add two integers.


SUBTRACT

public static final BasicAction SUBTRACT
Subtract two integers.


MULTIPLY

public static final BasicAction MULTIPLY
Multiply two numbers.


DIVIDE

public static final BasicAction DIVIDE
Divide two numbers.


INTEGER_EQUALS

public static final BasicAction INTEGER_EQUALS
Test whether two integers are equal.


INTEGER_LESS

public static final BasicAction INTEGER_LESS
Test where one number is less than another.


LOGICAL_AND

public static final BasicAction LOGICAL_AND
Logically and two values together.


LOGICAL_NOT

public static final BasicAction LOGICAL_NOT
Logically invert a value.


LOGICAL_OR

public static final BasicAction LOGICAL_OR
Logically or two values together.


STRING_EQUALS

public static final BasicAction STRING_EQUALS
Test whether two strings are equal.


STRING_LENGTH

public static final BasicAction STRING_LENGTH
Get the length of an ASCII string.


STRING_EXTRACT

public static final BasicAction STRING_EXTRACT
Substring.


POP

public static final BasicAction POP
Pop value from the top of the stack.


TO_INTEGER

public static final BasicAction TO_INTEGER
Convert a value to an integer.


GET_VARIABLE

public static final BasicAction GET_VARIABLE
Get the value of a variable.


SET_VARIABLE

public static final BasicAction SET_VARIABLE
Set the value of a variable. "x", 3 ->


SET_TARGET_2

public static final BasicAction SET_TARGET_2
Execute the following actions with the named movie clip.


STRING_ADD

public static final BasicAction STRING_ADD
Concatenate two strings.


GET_PROPERTY

public static final BasicAction GET_PROPERTY
Push the value of the specified property on the stack.


SET_PROPERTY

public static final BasicAction SET_PROPERTY
Set the value of a property.


CLONE_SPRITE

public static final BasicAction CLONE_SPRITE
Duplicate a movie clip on the display list.


REMOVE_SPRITE

public static final BasicAction REMOVE_SPRITE
Delete a movie clip.


TRACE

public static final BasicAction TRACE
Append value to debugging window.


START_DRAG

public static final BasicAction START_DRAG
Start dragging the mouse.


END_DRAG

public static final BasicAction END_DRAG
Stop dragging the mouse.


STRING_LESS

public static final BasicAction STRING_LESS
Test where one string is less than another.


THROW

public static final BasicAction THROW
Throw an exception.


CAST

public static final BasicAction CAST
Casts the type of an object.


IMPLEMENTS

public static final BasicAction IMPLEMENTS
Identifies a class implements a defined interface.


FS_COMMAND2

public static final BasicAction FS_COMMAND2
FSCommand2 function


RANDOM_NUMBER

public static final BasicAction RANDOM_NUMBER
Push a random number onto the stack.


MB_STRING_LENGTH

public static final BasicAction MB_STRING_LENGTH
Get the length of an multi-byte string.


CHAR_TO_ASCII

public static final BasicAction CHAR_TO_ASCII
Convert the first character of a string to its ASCII value.


ASCII_TO_CHAR

public static final BasicAction ASCII_TO_CHAR
Convert the ASCII value to the equivalent character.


GET_TIME

public static final BasicAction GET_TIME
Return the elapsed time since the start of the movie.


MB_STRING_EXTRACT

public static final BasicAction MB_STRING_EXTRACT
Substring of a multi-byte string.


MB_CHAR_TO_ASCII

public static final BasicAction MB_CHAR_TO_ASCII
Convert the first character of string to its Unicode value.


MB_ASCII_TO_CHAR

public static final BasicAction MB_ASCII_TO_CHAR
Convert a Unicode value to the equivalent character.


DELETE_VARIABLE

public static final BasicAction DELETE_VARIABLE
Delete a variable.


DELETE

public static final BasicAction DELETE
Delete an object or variable.


INIT_VARIABLE

public static final BasicAction INIT_VARIABLE
Create and set a variable.


EXECUTE_FUNCTION

public static final BasicAction EXECUTE_FUNCTION
Execute a function.


RETURN

public static final BasicAction RETURN
Return control from a function.


MODULO

public static final BasicAction MODULO
Calculate the modulus of two numbers.


NAMED_OBJECT

public static final BasicAction NAMED_OBJECT
Construct an instance of a built-in object.


NEW_VARIABLE

public static final BasicAction NEW_VARIABLE
Create a new variable.


NEW_ARRAY

public static final BasicAction NEW_ARRAY
Create a new array.


NEW_OBJECT

public static final BasicAction NEW_OBJECT
Define a new class.


GET_TYPE

public static final BasicAction GET_TYPE
Return the type of an object or value.


GET_TARGET

public static final BasicAction GET_TARGET
Return the path to the current movie clip.


ENUMERATE

public static final BasicAction ENUMERATE
Enumerate through the attributes of an object.


ADD

public static final BasicAction ADD
Add two numbers.


LESS

public static final BasicAction LESS
Test where one value is less than another.


EQUALS

public static final BasicAction EQUALS
Test where one value is equal to another.


TO_NUMBER

public static final BasicAction TO_NUMBER
Converts the string value to a number.


TO_STRING

public static final BasicAction TO_STRING
Converts the value to a string.


DUPLICATE

public static final BasicAction DUPLICATE
Duplicate the value at the top of the stack.


SWAP

public static final BasicAction SWAP
Swap the top two values on the stack.


GET_ATTRIBUTE

public static final BasicAction GET_ATTRIBUTE
Get the value of an object's attribute.


SET_ATTRIBUTE

public static final BasicAction SET_ATTRIBUTE
Set the value of an object's attribute.


INCREMENT

public static final BasicAction INCREMENT
Increment a number.


DECREMENT

public static final BasicAction DECREMENT
Decrement a number.


EXECUTE_METHOD

public static final BasicAction EXECUTE_METHOD
Execute a method.


NEW_METHOD

public static final BasicAction NEW_METHOD
Define a new method for an object.


INSTANCEOF

public static final BasicAction INSTANCEOF
Tests whether an object can be created using the constructor.


ENUMERATE_OBJECT

public static final BasicAction ENUMERATE_OBJECT
Enumerate through the attributes of an object.


BITWISE_AND

public static final BasicAction BITWISE_AND
Bitwise and tow numbers.


BITWISE_OR

public static final BasicAction BITWISE_OR
Bitwise or tow numbers.


BITWISE_XOR

public static final BasicAction BITWISE_XOR
Bitwise exclusive-or two numbers.


SHIFT_LEFT

public static final BasicAction SHIFT_LEFT
Shift a number left.


ARITH_SHIFT_RIGHT

public static final BasicAction ARITH_SHIFT_RIGHT
Arithmetically shift a number right.


SHIFT_RIGHT

public static final BasicAction SHIFT_RIGHT
Shift a number right. -1, 30 -> 3


STRICT_EQUALS

public static final BasicAction STRICT_EQUALS
Test whether type and value of two objects are equal.


GREATER

public static final BasicAction GREATER
Test whether a number is greater than another.


STRING_GREATER

public static final BasicAction STRING_GREATER
Test whether a string is greater than another.


EXTENDS

public static final BasicAction EXTENDS
Identifies that a class inherits from a class.

Method Detail

values

public static BasicAction[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
for (BasicAction c : BasicAction.values())
    System.out.println(c);

Returns:
an array containing the constants of this enum type, in the order they are declared

valueOf

public static BasicAction valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Parameters:
name - the name of the enum constant to be returned.
Returns:
the enum constant with the specified name
Throws:
IllegalArgumentException - if this enum type has no constant with the specified name
NullPointerException - if the argument is null

fromInt

public static BasicAction fromInt(int actionType)
Returns the BasicAction for a given type.

Parameters:
actionType - the type that identifies the action when it is encoded.
Returns:
a shared instance of the object representing a given action type.

copy

public BasicAction copy()
Creates a complete copy of this object.

Specified by:
copy in interface Copyable<Action>
Returns:
a deep-copy of this object. New instances of mutable objects are copied and immutable instances are shared.

prepareToEncode

public int prepareToEncode(Context context)
Prepare an object for encoding, returning the expected size of an object when it is encoded. This method also used to initialise variables, such as offsets and flags that will be used when the object is encoded. Generally the method returns the size in bytes, however when called on objects that use bit fields such as shapes the methods will return the size in bits.

Specified by:
prepareToEncode in interface SWFEncodeable
Parameters:
context - an Context that allows information to be passed between objects to control how they are initialised for encoding.
Returns:
the size of the object when it is encoded.

encode

public void encode(SWFEncoder coder,
                   Context context)
            throws IOException
Encode an object to the Flash binary format.

Specified by:
encode in interface SWFEncodeable
Parameters:
coder - an SWFEncoder object.
context - an Context that allows information to be passed between objects to control how they are initialised for encoding.
Throws:
IOException - if an error occurs while encoding the object.


Copyright © 2002-2010 Flagstone Software Ltd.. All Rights Reserved.