com.flagstone.transform.action
Class ActionObject

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

public final class ActionObject
extends Object
implements Action

ActionObject is a general-purpose class that can be used to represent any action. It allow actions not supported in the current version of Transform to be decoded and encoded from movies until direct support is provided in the framework.


Constructor Summary
ActionObject(ActionObject object)
          Creates an ActionObject by copying an existing one.
ActionObject(int actionType)
          Creates an ActionObject specifying only the type.
ActionObject(int actionType, byte[] bytes)
          Creates an ActionObject specifying the type and the data that represents the body of the action encoded in the Flash binary format.
ActionObject(int actionType, SWFDecoder coder)
          Creates and initialises an ActionObject using values encoded in the Flash binary format.
 
Method Summary
 ActionObject copy()
          Creates a complete copy of this object.
 void encode(SWFEncoder coder, Context context)
          Encode an object to the Flash binary format.
 byte[] getData()
          Returns the encoded data for the action.
 int getType()
          Returns the type that identifies the type of action when it is encoded in the Flash binary format.
 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

ActionObject

public ActionObject(int actionType,
                    SWFDecoder coder)
             throws IOException
Creates and initialises an ActionObject using values encoded in the Flash binary format.

Parameters:
actionType - the value that identifies the action when it is encoded.
coder - an SWFDecoder object that contains the encoded Flash data.
Throws:
IOException - if an error occurs while decoding the data.

ActionObject

public ActionObject(int actionType)
Creates an ActionObject specifying only the type.

Parameters:
actionType - the value identifying the action when it is encoded.

ActionObject

public ActionObject(int actionType,
                    byte[] bytes)
Creates an ActionObject specifying the type and the data that represents the body of the action encoded in the Flash binary format.

Parameters:
actionType - the value identifying the action when it is encoded.
bytes - the body of the action when it is encoded in the Flash format.

ActionObject

public ActionObject(ActionObject object)
Creates an ActionObject by copying an existing one.

Parameters:
object - an ActionObject.
Method Detail

getType

public int getType()
Returns the type that identifies the type of action when it is encoded in the Flash binary format.

Returns:
the value identifying the action when it is encoded.

getData

public byte[] getData()
Returns the encoded data for the action.

Returns:
the bytes representing the encoded arguments of the action.

copy

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