com.flagstone.transform.movieclip
Class InitializeMovieClip

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

public final class InitializeMovieClip
extends Object
implements MovieTag

Initialize is used to specify a sequence of actions that are executed to initialise a movie clip before it is displayed.

Initialize implements the #initclip pragma defined in the ActionScript language.

Unlike the DoAction class which specifies the actions that are executed when a particular frame is displayed the actions contained in an Initialize object are executed only once, regardless of where the object is included in a movie. If a frame containing the Initialize object is played again the actions are skipped. Also there can only be one Initialize object for each movie clip defined in the movie.


Constructor Summary
InitializeMovieClip(InitializeMovieClip object)
          Creates and initialises an InitializeMovieClip object using the values copied from another InitializeMovieClip object.
InitializeMovieClip(int uid, List<Action> list)
          Creates a Initialize object that will initialise the movie clip with the specified identifier with the actions in the list.
InitializeMovieClip(SWFDecoder coder, Context context)
          Creates and initialises an InitializeMovieClip object using values encoded in the Flash binary format.
 
Method Summary
 InitializeMovieClip add(Action anAction)
          Adds the action object to the list of actions.
 InitializeMovieClip copy()
          Creates a complete copy of this object.
 void encode(SWFEncoder coder, Context context)
          Encode an object to the Flash binary format.
 List<Action> getActions()
          Get the list of actions that are used to initialise the movie clip.
 int getIdentifier()
          Get the identifier of the movie clip that will be initialised.
 int prepareToEncode(Context context)
          Prepare an object for encoding, returning the expected size of an object when it is encoded.
 void setActions(List<Action> list)
          Set the list of actions of the movie clip that will be initialised.
 void setIdentifier(int uid)
          Sets the identifier of the movie clip that will be initialised.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

InitializeMovieClip

public InitializeMovieClip(SWFDecoder coder,
                           Context context)
                    throws IOException
Creates and initialises an InitializeMovieClip object using values encoded in the Flash binary format.

Parameters:
coder - an SWFDecoder object that contains the encoded Flash data.
context - a Context object used to manage the decoders for different type of object and to pass information on how objects are decoded.
Throws:
IOException - if an error occurs while decoding the data.

InitializeMovieClip

public InitializeMovieClip(int uid,
                           List<Action> list)
Creates a Initialize object that will initialise the movie clip with the specified identifier with the actions in the list.

Parameters:
uid - the identifier of the movie clip to initialise. Must be in the range 1..65535.
list - the list of action objects. Must not be null.

InitializeMovieClip

public InitializeMovieClip(InitializeMovieClip object)
Creates and initialises an InitializeMovieClip object using the values copied from another InitializeMovieClip object.

Parameters:
object - an InitializeMovieClip object from which the values will be copied.
Method Detail

getIdentifier

public int getIdentifier()
Get the identifier of the movie clip that will be initialised.

Returns:
the movie clip identifier.

setIdentifier

public void setIdentifier(int uid)
Sets the identifier of the movie clip that will be initialised.

Parameters:
uid - the identifier of the movie clip. The value must be in the range 1..65535.

add

public InitializeMovieClip add(Action anAction)
Adds the action object to the list of actions.

Parameters:
anAction - an object belonging to a class derived from Action. Must not be null.
Returns:
this object.

getActions

public List<Action> getActions()
Get the list of actions that are used to initialise the movie clip.

Returns:
the actions to initialize the movie clip.

setActions

public void setActions(List<Action> list)
Set the list of actions of the movie clip that will be initialised.

Parameters:
list - the list of action objects. Must not be null.

copy

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