com.flagstone.transform.action
Class WaitForFrame

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

public final class WaitForFrame
extends Object
implements Action

The WaitForFrame action instructs the player to wait until the specified frame number has been loaded.

If the frame has been loaded then the actions in the following n actions are executed. This action is most often used to execute a short animation loop that plays until the main part of a movie has been loaded.

This method of waiting until a frame has been loaded is considered obsolete. Determining the number of frames loaded using the FramesLoaded property of the Flash player in combination with an If action is now the preferred mechanism.

See Also:
Push, If

Constructor Summary
WaitForFrame(int frame, int count)
          Creates a WaitForFrame object with the specified frame number and the number of actions that will be executed when the frame is loaded.
WaitForFrame(SWFDecoder coder)
          Creates and initialises a WaitForFrame action using values encoded in the Flash binary format.
WaitForFrame(WaitForFrame object)
          Creates and initialises a WaitForFrame action using the values copied from another WaitForFrame action.
 
Method Summary
 WaitForFrame copy()
          Creates a complete copy of this object.
 void encode(SWFEncoder coder, Context context)
          Encode an object to the Flash binary format.
 int getActionCount()
          Get the number of actions that will be executed when the specified frame is loaded.
 int getFrameNumber()
          Get the frame number to test to see if has been loaded.
 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

WaitForFrame

public WaitForFrame(SWFDecoder coder)
             throws IOException
Creates and initialises a WaitForFrame 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.

WaitForFrame

public WaitForFrame(int frame,
                    int count)
Creates a WaitForFrame object with the specified frame number and the number of actions that will be executed when the frame is loaded.

Parameters:
frame - the number of the frame to wait for. Must be in the range 1..65535.
count - the number (not bytes) of actions to execute. Must be in the range 0..255.

WaitForFrame

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

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

getFrameNumber

public int getFrameNumber()
Get the frame number to test to see if has been loaded.

Returns:
the frame number to test.

getActionCount

public int getActionCount()
Get the number of actions that will be executed when the specified frame is loaded.

Returns:
the number of actions to execute.

copy

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