com.flagstone.transform.movieclip
Class DefineMovieClip

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

public final class DefineMovieClip
extends Object
implements DefineTag

DefineMovieClip defines a movie clip that animates shapes within a movie. It contains an list of movie objects that define the placement of shapes, buttons, text and images and the order in which they are displayed through a time-line that is separate from the parent movie.

Although a movie clip contains the commands that instructs the Flash Player on how to animate the clip it cannot contain any new definitions of objects. All definitions must be in the main movie. All objects referred to by the movie clip must be also defined in the main movie before they can be used.

When using the DefineMovieClip object can only contain objects from the following classes: ShowFrame, Place, Place2, Place3, Remove, Remove2 DoAction, StartSound, StartSound2, FrameLabel, SoundStreamHead, SoundStreamHead2 or SoundStreamBlock. Other objects are not allowed.


Constructor Summary
DefineMovieClip(DefineMovieClip object)
          Creates and initialises a DefineMovieClip object using the values copied from another DefineMovieClip object.
DefineMovieClip(int uid, List<MovieTag> list)
          Creates a DefineMovieClip object with the unique identifier and list of movie objects.
DefineMovieClip(SWFDecoder coder, Context context)
          Creates and initialises a DefineMovieClip object using values encoded in the Flash binary format.
 
Method Summary
 DefineMovieClip add(MovieTag obj)
          Adds the movie object to the list of objects that update the display list.
 DefineMovieClip copy()
          Creates a complete copy of this object.
 void encode(SWFEncoder coder, Context context)
          Encode an object to the Flash binary format.
 int getIdentifier()
          Get the unique identifier assigned to this object.
 List<MovieTag> getObjects()
          Get the list of movie objects that describe how the movie clip is animated.
 int prepareToEncode(Context context)
          Prepare an object for encoding, returning the expected size of an object when it is encoded.
 void setIdentifier(int uid)
          Sets the unique identifier for an object within a given Movie.
 void setObjects(List<MovieTag> list)
          Sets the list of movie objects.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DefineMovieClip

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

DefineMovieClip

public DefineMovieClip(int uid,
                       List<MovieTag> list)
Creates a DefineMovieClip object with the unique identifier and list of movie objects.

Parameters:
uid - a unique identifier for the movie clip. Must be in the range 1..65535,
list - the list of movie objects. Must not be null.

DefineMovieClip

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

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

getIdentifier

public int getIdentifier()
Get the unique identifier assigned to this object.

Specified by:
getIdentifier in interface DefineTag
Returns:
the unique identifier used by the Flash Player to reference this definition.

setIdentifier

public void setIdentifier(int uid)
Sets the unique identifier for an object within a given Movie.

Specified by:
setIdentifier in interface DefineTag
Parameters:
uid - a unique identifier for the object. Must be in the range 1..65535.

add

public DefineMovieClip add(MovieTag obj)
Adds the movie object to the list of objects that update the display list. See description above for the list of acceptable types.

Parameters:
obj - a Movie object. Must not be null
Returns:
this object.

getObjects

public List<MovieTag> getObjects()
Get the list of movie objects that describe how the movie clip is animated.

Returns:
the list of objects for the movie clip.

setObjects

public void setObjects(List<MovieTag> list)
Sets the list of movie objects.

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

copy

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