com.flagstone.transform
Class DoABC

java.lang.Object
  extended by com.flagstone.transform.DoABC
All Implemented Interfaces:
Copyable<MovieTag>, SWFEncodeable, MovieTag

public final class DoABC
extends Object
implements MovieTag

DoABC is used to define scripts containing Actionscript 3.0 byte-codes.

Execution of the script may be deferred until it is explicitly called using the assigned name.


Constructor Summary
DoABC(DoABC object)
          Creates a DoABC initialised with a copy of the data from another object.
DoABC(String scriptName, boolean defer, byte[] script)
          Creates a DoABC object with the name and compiled Actionscript 3.0 byte-codes.
DoABC(SWFDecoder coder)
          Creates and initialises an DoABC using values encoded in the Flash binary format.
 
Method Summary
 DoABC copy()
          Creates a complete copy of this object.
 void encode(SWFEncoder coder, Context context)
          Encode an object to the Flash binary format.
 byte[] getData()
          Get a copy of the array containing the Actionscript byte-codes.
 String getName()
          Get the name of the script.
 boolean isDeferred()
          Is loading of the script deferred until it is called.
 int prepareToEncode(Context context)
          Prepare an object for encoding, returning the expected size of an object when it is encoded.
 void setData(byte[] bytes)
          Sets the script containing compiled Actionscript 3.0 byte-codes.
 void setDeferred(boolean defer)
          Sets whether execution of the script is deferred.
 void setName(String aString)
          Sets the name of the script.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DoABC

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

DoABC

public DoABC(String scriptName,
             boolean defer,
             byte[] script)
Creates a DoABC object with the name and compiled Actionscript 3.0 byte-codes.

Parameters:
scriptName - the name used to identify the script.
defer - whether execution of the script is deferred.
script - the compiled Actionscript 3.0 byte-codes.

DoABC

public DoABC(DoABC object)
Creates a DoABC initialised with a copy of the data from another object.

Parameters:
object - a DoABC object used to initialize this one.
Method Detail

getName

public String getName()
Get the name of the script.

Returns:
the name used to call the script.

setName

public void setName(String aString)
Sets the name of the script.

Parameters:
aString - the name assigned to the script so it can be referred to. Must not be null or an empty string.

isDeferred

public boolean isDeferred()
Is loading of the script deferred until it is called.

Returns:
true if loading of the script is deferred, false if it is loaded immediately.

setDeferred

public void setDeferred(boolean defer)
Sets whether execution of the script is deferred.

Parameters:
defer - execution of the script is deferred (true) or executed immediately (false).

getData

public byte[] getData()
Get a copy of the array containing the Actionscript byte-codes.

Returns:
a copy of the encoded actionscript.

setData

public void setData(byte[] bytes)
Sets the script containing compiled Actionscript 3.0 byte-codes.

Parameters:
bytes - a list of byte-codes. Must not be null.

copy

public DoABC copy()
Creates a complete copy of this object.

Specified by:
copy in interface Copyable<MovieTag>
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.