|
|||||||||
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.FSActionObject
com.flagstone.transform.FSIf
public class FSIf
The FSIf action is used to perform a conditional branch to control the actions executed by the Flash Player.
When executed, the FSIf action pops a value from the stack and evaluates it to see whether it evaluates as true or false. If the boolean value is true the offset attribute of the FSIf action is added to the Flash Player's instruction pointer and execution of the stream of actions continues from that location. If the boolean value is false then no branch is taken.
Although the Flash Player contains an instruction pointer it does not support an explicit address space. The instruction pointer is used to reference actions within the current stream of actions being executed whether they are associated with a given frame, button or movie clip. The value contained in the instruction pointer is the address relative to the start of the current stream.
Attributes | |
---|---|
type | Identifies the action when it is encoded. Read-only. |
offset | The offset, relative to the current instruction pointer, to jump to if the value on the Stack evaluates to true. |
The offset is a signed number, allowing branches up to -32768 to 32767 bytes. The instruction pointer points to the next instruction in the stream of actions being executed so specifying an offset of zero will have no effect on the sequence of instructions executed.
If the value popped off the stack is a number it is evaluated as true if it is non-zero. If the value is a string it is evaluated to true if it is not an empty string ("") or the strings "0" or "false".
FSDoAction actions = new FSDoAction(); actions.add(new FSPush("a")); actions.add(FSAction.GetVariable()); actions.add(new FSPush(3)); actions.add(FSAction.Equals()); actions.add(new FSIf(32));
The FSIf class represents the ActionIf action of the Macromedia Flash (SWF) File Format Specification. It was introduced in Flash 4.
Field Summary |
---|
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 | |
---|---|
FSIf(FSCoder coder)
Construct an FSIf object, initializing it with values decoded from an encoded object. |
|
FSIf(FSIf obj)
Constructs an FSIf object by copying values from an existing object. |
|
FSIf(int anOffset)
Constructs an if action with the specified offset. |
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 |
getOffset()
Gets the offset that will be added to the instruction pointer if the value at the top of the stack evaluates to true (non-zero). |
int |
length(FSCoder coder)
|
void |
setOffset(int aNumber)
Sets the offset to add to the instruction pointer if the value at the top of the stack evaluates to true (non-zero). |
Methods inherited from class com.flagstone.transform.FSActionObject |
---|
getType, length |
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 FSIf(FSCoder coder)
coder
- an FSCoder containing the binary data.public FSIf(int anOffset)
anOffset
- the number of bytes to add to the instruction pointer if the
value popped off the stack evaluates to true.public FSIf(FSIf obj)
obj
- an FSIf object.Method Detail |
---|
public int getOffset()
public void setOffset(int aNumber)
aNumber
- the number of bytes to add to the instruction pointer.public boolean equals(java.lang.Object anObject)
FSActionObject
equals
in class FSActionObject
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 FSActionObject
public void encode(FSCoder coder)
encode
in class FSActionObject
public void decode(FSCoder coder)
decode
in class FSActionObject
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |