Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.flagstone.transform
Class FSIf

    java.lang.Object
      com.flagstone.transform.FSTransformObject
          com.flagstone.transform.FSActionObject
              com.flagstone.transform.FSIf

All Implemented Interfaces:
  java.lang.Cloneable

    public class FSIf

extends FSActionObject

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));

# History

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

### FSIf

    public FSIf(FSCoder coder)

  Construct an FSIf object, initializing it with values decoded from an encoded object.

  Parameters:
    `coder` - an FSCoder containing the binary data.

### FSIf

    public FSIf(int anOffset)

  Constructs an if action with the specified offset. The offset must be in the range -32768..32767.

  Parameters:
    `anOffset` - the number of bytes to add to the instruction pointer if the value popped off the stack evaluates to true.

### FSIf

    public FSIf(FSIf obj)

  Constructs an FSIf object by copying values from an existing object.

  Parameters:
    `obj` - an FSIf object.

Method Detail

### getOffset

    public 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).

  Returns:
    the number of bytes representing the offset.

### setOffset

    public 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). The offset must be in the range -32768..32767.

  Parameters:
    `aNumber` - the number of bytes to add to the instruction pointer.

### 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`

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD