com.flagstone.transform
Class ScenesAndLabels

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

public final class ScenesAndLabels
extends Object
implements MovieTag

ScenesAndLabels is used to list the scenes (main timeline only) and labelled frames for movies and movie clips.


Constructor Summary
ScenesAndLabels()
          Creates a ScenesAndLabels object with empty tables for the scenes and labels.
ScenesAndLabels(Map<Integer,String> sceneMap, Map<Integer,String> labelMap)
          Create a new ScenesAndLabels object with the specified list of scenes and labelled frames.
ScenesAndLabels(ScenesAndLabels object)
          Creates and initialises a ScenesAndLabels object using the values copied from another ScenesAndLabels object.
ScenesAndLabels(SWFDecoder coder)
          Creates and initialises a ScenesAndLabels object using values encoded in the Flash binary format.
 
Method Summary
 ScenesAndLabels addLabel(int offset, String name)
          Add an entry to the list of labelled frames with the frame number and frame label.
 ScenesAndLabels addScene(int offset, String name)
          Add an entry to the list of scenes with the frame number and scene name.
 ScenesAndLabels copy()
          Creates a complete copy of this object.
 void encode(SWFEncoder coder, Context context)
          Encode an object to the Flash binary format.
 Map<Integer,String> getLabels()
          Get the table of frame numbers and frame labels.
 Map<Integer,String> getScenes()
          Get the table of frame numbers and associated names.
 int prepareToEncode(Context context)
          Prepare an object for encoding, returning the expected size of an object when it is encoded.
 void setLabels(Map<Integer,String> map)
          Set the table of frame numbers and associated names.
 void setScenes(Map<Integer,String> map)
          Set the table of frame numbers and associated names.
 String toString()
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ScenesAndLabels

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

ScenesAndLabels

public ScenesAndLabels()
Creates a ScenesAndLabels object with empty tables for the scenes and labels.


ScenesAndLabels

public ScenesAndLabels(Map<Integer,String> sceneMap,
                       Map<Integer,String> labelMap)
Create a new ScenesAndLabels object with the specified list of scenes and labelled frames.

Parameters:
sceneMap - a table of frame numbers and the associated name for the scenes on the main timeline of a movie.
labelMap - a table of frame numbers and the associated name for the labelled frames in a movie or movie clip.

ScenesAndLabels

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

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

addScene

public ScenesAndLabels addScene(int offset,
                                String name)
Add an entry to the list of scenes with the frame number and scene name.

Parameters:
offset - the frame number.
name - the scene name.
Returns:
this object.

getScenes

public Map<Integer,String> getScenes()
Get the table of frame numbers and associated names.

Returns:
a map associating frame numbers to scene names.

setScenes

public void setScenes(Map<Integer,String> map)
Set the table of frame numbers and associated names.

Parameters:
map - a table associating frame numbers to scene names.

addLabel

public ScenesAndLabels addLabel(int offset,
                                String name)
Add an entry to the list of labelled frames with the frame number and frame label.

Parameters:
offset - the frame number.
name - the frame label.
Returns:
this object.

getLabels

public Map<Integer,String> getLabels()
Get the table of frame numbers and frame labels.

Returns:
a map associating frame numbers to frame labels.

setLabels

public void setLabels(Map<Integer,String> map)
Set the table of frame numbers and associated names.

Parameters:
map - a table associating frame numbers to frame labels.

copy

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