|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.flagstone.transform.FSTransformObject
com.flagstone.transform.FSRegisterIndex
public class FSRegisterIndex
FSRegisterIndex is used with an FSPush action to refer to one of the Flash Player's internal registers that contains a value to be used in a calculation.
The number of registers in the Flash Player was increased in Flash 7 to 256.
The Flash Player uses a stack to store values when executing the actions associated with a button being pushed, frame being played, etc. If a value is used repeatedly in a calculation, it must be pushed onto the stack each time using an FSPush action. To speed up the execution of the calculation and reduce the amount of code required the value can be saved to one of the internal registers of the Flash Player using the FSRegisterCopy action (which copies the value currently at the top of the stack into the specified register). An FSRegisterIndex creates a reference to the register so the Flash Player uses the value directly rather than popping it from the stack.
To copy a value from the top of the stack to one of the Flash Player's internal registers specify the register number in the constructor for the FSRegisterCopy class:
ArrayList actions = new ArrayList(); ... actions.add(new FSRegisterCopy(0)); ...
References to one of the Flash Player's internal registers are created using the FSRegisterIndex class and pushing it onto the stack using the FSPush class. When the value is used in a calculation then the value will be retrieved from the specified register.
FSPush push = new FSPush(); push.add(new FSRegisterIndex(0)); ... actions.add(push); ...
The RegisterCopy action and access to the Flash Player's internal registers was introduced in Flash 5. The number of registers supported was expanded in Flash 7 to 256.
Constructor Summary | |
---|---|
FSRegisterIndex(FSCoder coder)
Construct an FSRegisterIndex object, initalizing it with values decoded from an encoded object. |
|
FSRegisterIndex(FSRegisterIndex obj)
Constructs an FSRegisterIndex object by copying values from an existing object. |
|
FSRegisterIndex(int anIndex)
Constructs an FSRegisterIndex object referencing the value stored in one of the Flash Player's internal registers. |
Method Summary | |
---|---|
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. |
void |
decode(FSCoder coder)
|
void |
encode(FSCoder coder)
|
boolean |
equals(java.lang.Object anObject)
Returns true if anObject is equal to this one. |
int |
getIndex()
Gets the number of the Flash Player's internal register. |
int |
length(FSCoder coder)
|
void |
setIndex(int anIndex)
Sets the number of the Flash Player's internal register. |
Methods inherited from class com.flagstone.transform.FSTransformObject |
---|
clone, name, toString |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public FSRegisterIndex(FSCoder coder)
coder
- an FSCoder containing the binary data.public FSRegisterIndex(int anIndex)
anIndex
- the register number.public FSRegisterIndex(FSRegisterIndex obj)
obj
- an FSRegisterIndex object.Method Detail |
---|
public int getIndex()
public void setIndex(int anIndex)
anIndex
- the register number.public boolean equals(java.lang.Object anObject)
FSTransformObject
equals
in class FSTransformObject
public void appendDescription(java.lang.StringBuffer buffer, int depth)
FSTransformObject
appendDescription
in class FSTransformObject
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.public int length(FSCoder coder)
length
in class FSTransformObject
public void encode(FSCoder coder)
encode
in class FSTransformObject
public void decode(FSCoder coder)
decode
in class FSTransformObject
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |