com.flagstone.transform.action
Class Jump

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

public final class Jump
extends Object
implements Action

The Jump action performs an unconditional branch to control the actions executed by the Flash Player.

When executed the Jump action adds an offset to the instruction pointer and execution of the stream of actions continues from that address.

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.

The offset is a signed number allowing branches up to -32768 to 32767 bytes. The instruction pointer points to the next instruction so specifying an offset of zero will have no effect on the sequence of instructions executed.

See Also:
If

Constructor Summary
Jump(int anOffset)
          Creates a Jump action with the specified offset.
Jump(Jump object)
          Creates and initialises a Jump action using the values copied from another Jump action.
Jump(SWFDecoder coder)
          Creates and initialises a Jump action using values encoded in the Flash binary format.
 
Method Summary
 Jump copy()
          Creates a complete copy of this object.
 void encode(SWFEncoder coder, Context context)
          Encode an object to the Flash binary format.
 int getOffset()
          Get the offset that will be added to the instruction pointer.
 int prepareToEncode(Context context)
          Prepare an object for encoding, returning the expected size of an object when it is encoded.
 String toString()
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Jump

public Jump(SWFDecoder coder)
     throws IOException
Creates and initialises a Jump action using values encoded in the Flash binary format.

Parameters:
coder - an SWFDecoder object that contains the encoded Flash data.
Throws:
IOException - if an error occurs while decoding the data.

Jump

public Jump(int anOffset)
Creates a Jump action with the specified offset.

Parameters:
anOffset - the number of bytes to add to the instruction pointer. The offset must be in the range -32768..32767.

Jump

public Jump(Jump object)
Creates and initialises a Jump action using the values copied from another Jump action.

Parameters:
object - a Jump action from which the values will be copied.
Method Detail

getOffset

public int getOffset()
Get the offset that will be added to the instruction pointer.

Returns:
the offset to the next action.

copy

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

toString

public String toString()

Overrides:
toString in class Object

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.