com.flagstone.transform
Class FSPush

java.lang.Object
  extended by com.flagstone.transform.FSTransformObject
      extended by com.flagstone.transform.FSActionObject
          extended by com.flagstone.transform.FSPush
All Implemented Interfaces:
java.lang.Cloneable

public class FSPush
extends FSActionObject

FSPush is used to push values on the Flash Player's internal stack.

Attributes
type Identifies the action when it is encoded. Read-only.
values An array of values that will be pushed onto the Flash Player's Stack and used when executing actions.

The FSPush action supports the full range of data types supported by Flash:

Data Type Description
Boolean A boolean value, 1 (true) or 0 (false).
Integer A signed 32-bit integer, range -2,147,483,648 to 2,147,483,647.
Double A double-precision (64-bit) floating-point number, range approximately +/- 1.79769313486231570E+308.
String A String. The string is encoded as using the UTF-8 encoding which is backward compatible with ASCII encoding supported in Flash 5.
Register Index The number (0,..3) of one of the Flash player's internal registers.
Table Index An index into a table of string literals defined using the FSTable action.
Null A null value.
Void A void value.
Movie Clip Property A reserved number used to identify a specific property of a movie clip.
Player Property A reserved number used to identify a specific property of the Flash Player.

Movie Clip properties are used to access the attributes of the specified movie clip. To simplify using movie clip properties the values are defined as constants in the FSPush class:

Name Description
_x The x-coordinate of the current drawing point.
_y The y-coordinate of the current drawing point.
_xscale The scale of the player window in the x-axis.
_yscale The scale of the player window in the y-axis.
_currentframe The number of the frame currently being displayed
_totalframes The total number of frames in the current movie clip being played.
_alpha Whether the player supports alpha channel transparency in colours.
_visible Whether the player is currently visible.
_width The width of the player, in pixels, on the screen.
_height The height of the player, in pixels, on the screen.
_rotation The rotation of the movie clip in degrees
_target The current target or context for actions.
_framesloaded The number of frames from the movie clip that are currently loaded
_name The name of a movie clip.
_droptarget Then name of the movie clip currently being dragged.
_url The URL of the current movie clip being played.

Player properties are used to access the attributes of the Player showing the movie clips. To simplify using player properties the values are defined as constants in the FSPush class:

Name Description
_quality Whether the player is set to display movie clips at high quality.
_highquality Whether the player is set to display movie clips at high quality.
_focusrect Whether a bounding yellow rectangle is drawn around the current object (a sprite or button) has the keyboard and mouse focus.
_soundbuftime The number of seconds to buffer streaming sound before playing
_xmouse The current x-coordinate of the mouse location.
_ymouse The current y-coordinate of the mouse location.

The FSPush class maintains an array of values that will be pushed onto the stack. Any basic data types: boolean, int and double passed in the class constructors or using the add() methods are wrapped internally, in an Boolean, Integer and Double class respectively - simplifying how the class is used. Wrapper classes are only used explicitly when parsing a Flash files and manipulating the values stored in the array.

Examples

Push each of the different types value onto the stack:

  FSPush boolean        = new FSPush(true);
  FSPush integer        = new FSPush(123);
  FSPush double         = new FSPush(123.0);
  FSPush string         = new FSPush("123");
  FSPush null           = new FSPush(new FSNull());
  FSPush void           = new FSPush(new FSVoid());
  FSPush registerIndex  = new FSPush(new FSRegisterIndex(0));
  FSPush tableIndex     = new FSPush(new FSTableIndex(0));
  FSPush movieProperty  = new FSPush(FSPush._x);
  FSPush playerProperty = new FSPush(FSPush._xmouse);
 

For efficiency a single FSPush action can push several values onto the stack in a single operation. The order in which values are added to the FSPush action is the same order in which the values are pushed onto the stack.

 FSPush push = new FSPush();
 
 push.add(123);
 push.add(123.0);
 push.add("123");
 

If an array of values are added to a FSPush object then boolean, int and double values must be wrapped using the Boolean, Integer and Double classes respectively.

History

FSPush is a class for representing the Push action of the Macromedia Flash (SWF) File Format Specification. It was introduced in Flash 4 and contained either an integer or string argument. It was extended in Flash 5 to support a number of different data types and allow more than one value to be added in a single action.


Field Summary
static int _alpha
          The transparency of the movie clip.
static int _currentframe
          The number of the current frame playing in the movie clip.
static int _droptarget
          The name of the movie clip currently being dragged
static int _focusrect
          Identifies whether a yellow rectangle is drawn around a button or test field that has the current focus.
static int _framesloaded
          The number of frames form the movie clip loaded.
static int _height
          The height of the movie clip in pixels.
static int _highquality
          Identifies the level of aliasing being performed by the Player.
static int _name
          The name of movie clip.
static int _quality
          Identifies the level of rendering quality being performed by the Player.
static int _rotation
          The angle of rotation of the movie clip in degrees.
static int _soundbuftime
          The amount of time streaming sound is buffered by the Player before playing.
static int _target
          The path of the movie clip relative to the root movie in the Player.
static int _totalframes
          The total number of frames in the movie clip.
static int _url
          The URL from which the movie clip was loaded.
static int _visible
          Whether the movie clip is visible.
static int _width
          The width of the movie clip in pixels.
static int _x
          The x-origin of the movie clip relative to the parent clip.
static int _xmouse
          The current x-coordinate of the mouse pointer on the Player screen.
static int _xscale
          The scaling factor of the movie clip in the x direction.
static int _y
          The y-origin of the movie clip relative to the parent clip.
static int _ymouse
          The current y-coordinate of the mouse pointer on the Player screen.
static int _yscale
          The scaling factor of the movie clip in the x direction.
 
Fields inherited from class com.flagstone.transform.FSActionObject
Call, ExceptionHandler, GetUrl, GetUrl2, GotoFrame, GotoFrame2, GotoLabel, If, Jump, length, NewFunction, NewFunction2, Push, RegisterCopy, SetTarget, Table, type, WaitForFrame, WaitForFrame2, With
 
Constructor Summary
FSPush()
          Constructs an FSPush action object with no values added.
FSPush(java.util.ArrayList anArray)
          Constructs an FSPush action that will push the values in the array onto the stack.
FSPush(boolean aBoolean)
          Constructs an FSPush action that will place the specified boolean value on the stack.
FSPush(double aNumber)
          Constructs an FSPush action that will place the specified double value on the stack.
FSPush(FSCoder coder)
          Construct an FSPush object, initialising it with values decoded from an encoded object.
FSPush(FSNull nullValue)
          Constructs an FSPush action that will place a null value on the stack.
FSPush(FSPush obj)
          Constructs an FSPush object by copying values from an existing object.
FSPush(FSRegisterIndex anIndex)
          Constructs an FSPush action that references one of the players internal registers.
FSPush(FSTableIndex anIndex)
          Constructs an FSPush action that reference a variable in a table.
FSPush(FSVoid voidValue)
          Constructs an FSPush action that will place a void value on the stack.
FSPush(int aNumber)
          Constructs an FSPush action that will place the specified integer on the stack.
FSPush(java.lang.String aString)
          Constructs an FSPush action that will place the specified value on the stack.
 
Method Summary
 void add(boolean aBool)
          Adds a boolean value to the array of values that will be pushed onto the stack.
 void add(double aDouble)
          Adds a double value to the array of values that will be pushed onto the stack.
 void add(FSNull nullValue)
          Adds a null value to the array of values that will be pushed onto the stack.
 void add(FSRegisterIndex anIndex)
          Adds an FSRegisterIndex to the array of values that will be pushed onto the stack.
 void add(FSTableIndex anIndex)
          Adds an FSTableIndex to the array of values that will be pushed onto the stack.
 void add(FSVoid voidValue)
          Adds a void value to the array of values that will be pushed onto the stack.
 void add(int anInt)
          Adds an integer value to the array of values that will be pushed onto the stack.
 void add(java.lang.String aString)
          Adds a String to the array of values that will be pushed onto the stack.
 void appendDescription(java.lang.StringBuffer buffer, int depth)
          AppendDescription is used to present a string description of the object including all nested objects up to a specified depth.
 java.lang.Object clone()
          Creates a deep copy of the entire object.
 void decode(FSCoder coder)
           
 void encode(FSCoder coder)
           
 boolean equals(java.lang.Object anObject)
          Returns true if anObject is equal to this one.
 java.util.ArrayList getValues()
          Gets the array of values.
 int length(FSCoder coder)
           
static java.lang.Integer propertyWithName(java.lang.String propertyName)
          Translates the name of a property into the integer value used to identify the property by the Flash Player.
 void setValues(java.util.ArrayList anArray)
          Sets the array of values.
 
Methods inherited from class com.flagstone.transform.FSActionObject
getType, length
 
Methods inherited from class com.flagstone.transform.FSTransformObject
name, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_x

public static final int _x
The x-origin of the movie clip relative to the parent clip.

See Also:
Constant Field Values

_y

public static final int _y
The y-origin of the movie clip relative to the parent clip.

See Also:
Constant Field Values

_xscale

public static final int _xscale
The scaling factor of the movie clip in the x direction.

See Also:
Constant Field Values

_yscale

public static final int _yscale
The scaling factor of the movie clip in the x direction.

See Also:
Constant Field Values

_currentframe

public static final int _currentframe
The number of the current frame playing in the movie clip.

See Also:
Constant Field Values

_totalframes

public static final int _totalframes
The total number of frames in the movie clip.

See Also:
Constant Field Values

_alpha

public static final int _alpha
The transparency of the movie clip.

See Also:
Constant Field Values

_visible

public static final int _visible
Whether the movie clip is visible.

See Also:
Constant Field Values

_width

public static final int _width
The width of the movie clip in pixels.

See Also:
Constant Field Values

_height

public static final int _height
The height of the movie clip in pixels.

See Also:
Constant Field Values

_rotation

public static final int _rotation
The angle of rotation of the movie clip in degrees.

See Also:
Constant Field Values

_target

public static final int _target
The path of the movie clip relative to the root movie in the Player.

See Also:
Constant Field Values

_framesloaded

public static final int _framesloaded
The number of frames form the movie clip loaded.

See Also:
Constant Field Values

_name

public static final int _name
The name of movie clip.

See Also:
Constant Field Values

_droptarget

public static final int _droptarget
The name of the movie clip currently being dragged

See Also:
Constant Field Values

_url

public static final int _url
The URL from which the movie clip was loaded.

See Also:
Constant Field Values

_highquality

public static final int _highquality
Identifies the level of aliasing being performed by the Player.

See Also:
Constant Field Values

_focusrect

public static final int _focusrect
Identifies whether a yellow rectangle is drawn around a button or test field that has the current focus.

See Also:
Constant Field Values

_soundbuftime

public static final int _soundbuftime
The amount of time streaming sound is buffered by the Player before playing.

See Also:
Constant Field Values

_quality

public static final int _quality
Identifies the level of rendering quality being performed by the Player.

See Also:
Constant Field Values

_xmouse

public static final int _xmouse
The current x-coordinate of the mouse pointer on the Player screen.

See Also:
Constant Field Values

_ymouse

public static final int _ymouse
The current y-coordinate of the mouse pointer on the Player screen.

See Also:
Constant Field Values
Constructor Detail

FSPush

public FSPush(FSCoder coder)
Construct an FSPush object, initialising it with values decoded from an encoded object.

Parameters:
coder - an FSCoder containing the binary data.

FSPush

public FSPush()
Constructs an FSPush action object with no values added.


FSPush

public FSPush(boolean aBoolean)
Constructs an FSPush action that will place the specified boolean value on the stack.

Parameters:
aBoolean - boolean value to push onto the stack.

FSPush

public FSPush(int aNumber)
Constructs an FSPush action that will place the specified integer on the stack.

Parameters:
aNumber - integer value to push onto the stack.

FSPush

public FSPush(double aNumber)
Constructs an FSPush action that will place the specified double value on the stack.

Parameters:
aNumber - double-precision floating-point value to push onto the stack.

FSPush

public FSPush(FSNull nullValue)
Constructs an FSPush action that will place a null value on the stack.

Parameters:
nullValue - an instance of the simple FSNull class.

FSPush

public FSPush(FSVoid voidValue)
Constructs an FSPush action that will place a void value on the stack.

Parameters:
voidValue - an instance of the simple FSVoid class.

FSPush

public FSPush(java.lang.String aString)
Constructs an FSPush action that will place the specified value on the stack.

Parameters:
aString - string literal value to push onto the stack.

FSPush

public FSPush(FSTableIndex anIndex)
Constructs an FSPush action that reference a variable in a table.

Parameters:
anIndex - an index into a literal table to push onto the stack.

FSPush

public FSPush(FSRegisterIndex anIndex)
Constructs an FSPush action that references one of the players internal registers.

Parameters:
anIndex - a reference to one of the Flash Player's internal registers to push onto the stack.

FSPush

public FSPush(java.util.ArrayList anArray)
Constructs an FSPush action that will push the values in the array onto the stack.

Parameters:
anArray - an array of values to be pushed onto the stack. The values in the array must be one of the following classes: Boolean, Integer, Double, String, FSRegisterIndex or FSTableIndex.

FSPush

public FSPush(FSPush obj)
Constructs an FSPush object by copying values from an existing object.

Parameters:
obj - an FSPush object.
Method Detail

propertyWithName

public static java.lang.Integer propertyWithName(java.lang.String propertyName)
Translates the name of a property into the integer value used to identify the property by the Flash Player.

Parameters:
propertyName - a String representing the name of the property.
Returns:
the value of a property identifier.

add

public void add(boolean aBool)
Adds a boolean value to the array of values that will be pushed onto the stack.

Parameters:
aBool - a boolean value.

add

public void add(int anInt)
Adds an integer value to the array of values that will be pushed onto the stack.

Parameters:
anInt - an integer (int) value.

add

public void add(double aDouble)
Adds a double value to the array of values that will be pushed onto the stack.

Parameters:
aDouble - a double-precision floating-point value.

add

public void add(FSNull nullValue)
Adds a null value to the array of values that will be pushed onto the stack.

Parameters:
nullValue - a lightweight FSNull object.

add

public void add(FSVoid voidValue)
Adds a void value to the array of values that will be pushed onto the stack.

Parameters:
voidValue - a lightweight FSVoid object.

add

public void add(java.lang.String aString)
Adds a String to the array of values that will be pushed onto the stack.

Parameters:
aString - a String.

add

public void add(FSTableIndex anIndex)
Adds an FSTableIndex to the array of values that will be pushed onto the stack.

Parameters:
anIndex - a FSTableIndex referencing an entry in a table of literals.

add

public void add(FSRegisterIndex anIndex)
Adds an FSRegisterIndex to the array of values that will be pushed onto the stack.

Parameters:
anIndex - a FSRegisterIndex referencing one of the Flash Player's internal registers.

getValues

public java.util.ArrayList getValues()
Gets the array of values.

Returns:
the array of values that will be pushed onto the stack.

setValues

public void setValues(java.util.ArrayList anArray)
Sets the array of values.

Parameters:
anArray - replaces the existing array of value with anArray. The values in the array must be one of the following classes: Boolean, Integer, Double, String, FSNull, FSVoid, FSRegisterIndex or FSTableIndex.

clone

public java.lang.Object clone()
Description copied from class: FSTransformObject
Creates a deep copy of the entire object.

Overrides:
clone in class FSTransformObject
Returns:
a copy of the object.

equals

public boolean equals(java.lang.Object anObject)
Description copied from class: FSActionObject
Returns true if anObject is equal to this one. Objects are considered equal if they would generate identical binary data when they are encoded to a Flash file.

Overrides:
equals in class FSActionObject
Returns:
true if this object would be identical to anObject when encoded.

appendDescription

public void appendDescription(java.lang.StringBuffer buffer,
                              int depth)
Description copied from class: FSTransformObject
AppendDescription is used to present a string description of the object including all nested objects up to a specified depth. This method provide a more controlled way of creating a string representation of an object since large objects such as font or shape definitions can contain dozens of nested objects. The representation of the object is appended to the StringBuffer, showing the name of the class and values of the attributes it contains. If the object contains any attributes that are objects then the object graph will be traversed up to the specified depth. If objects are nested at a level less than specified depth then the full string representation of the object is displayed. For objects at the specified depth only the name of the class is displayed. Any objects below this depth are not displayed.

Specified by:
appendDescription in class FSTransformObject
Parameters:
buffer - a StringBuffer to which the description of each object is appended.
depth - the maximum level of nesting up to which objects will be displayed.

length

public int length(FSCoder coder)
Overrides:
length in class FSActionObject

encode

public void encode(FSCoder coder)
Overrides:
encode in class FSActionObject

decode

public void decode(FSCoder coder)
Overrides:
decode in class FSActionObject