com.flagstone.transform.util.movie
Class Frame

java.lang.Object
  extended by com.flagstone.transform.util.movie.Frame

public final class Frame
extends Object

The Frame class is used to provide a higher level view of a movie. Rather than viewing movies as a sequence of individual objects each representing a given data structure in the encoded Flash file, objects can be grouped together in frames which presents a more logical view of a movie and makes movie manipulation and search for specific objects easier to handle.

Each Frame object has the following attributes:
number - The position in the movie when the frame will be displayed.
label - An optional name assigned to a frame. The GotoFrame2 object can be used to move to a named frame when playing a movie or movie clip.
definitions - A list containing objects that define items for display in a movie. Definitions are sub-classes of the Definition class and define shapes, fonts, images and sounds that are displayed or played by the Flash Player.
commands - A list containing objects that define commands that affect the display list or the Flash Player directly.
actions - A list that define actions that are executed when a frame is displayed.

Frame objects simplify the handling of movies. DoAction, FrameLabel and ShowFrame classes can now "hidden" from view. They are generated automatically by the Frame object when it is added to an Movie object.

The framesFromMovie(Movie aMovie) method allows an existing movie to be viewed as a list of Frame objects. Objects from the movie are copied into each frame so changes made to the attributes of each object are reflected in the movie. The frame objects are not synchronised with the movie, so any objects added to a frame are not added to the Movie. The easiest way to do this is to remove the existing objects from the movie and add all the frames.

 ArrayList frames = Frame.framesFromMovie(aMovie);
 ...
 ...
 aMovie.getObjects().clear();

 for (Iterator i = frames.iterator(); i.hasNext();) {
     ((Frame)i.next()).addToMovie(aMovie);
 }

When the contents of an Frame object is added to a movie if a label defined then an FrameLabel object will be added. Similarly if actions are defined then an DoAction object will be added. An ShowFrame object which instructs the Flash Player to update the display list with all the changes is added.


Constructor Summary
Frame()
          Creates a empty frame with no label defined and the definitions, commands and actions lists empty.
Frame(int frame)
          Creates a empty frame with no label defined and the definitions, commands and actions lists empty.
 
Method Summary
 void addAction(Action anObject)
          Adds the action object to the frame.
 void addCommand(MovieTag anObject)
          Adds the display list command to the frame.
 void addDefinition(MovieTag anObject)
          Adds an object to the frame that defines an object to be displayed in the movie.
 void addToMovie(Movie aMovie)
          Add the objects in the frame to the movie.
 List<Action> getActions()
          Returns the array of action objects that will be execute when the frame is displayed.
 List<MovieTag> getCommands()
          Returns the list of commands that update the display list.
 List<MovieTag> getDefinitions()
          Returns the list of definition objects contained in the frame.
 String getLabel()
          Returns the label assigned to the frame.
 int getNumber()
          Get the number of the frame.
 void setActions(List<Action> list)
          Sets the list of action objects for the frame.
 void setCommands(List<MovieTag> list)
          Sets the list of commands that updated the display list for the frame.
 void setDefinitions(List<MovieTag> list)
          Sets the list of action objects for the frame.
 void setLabel(String aString)
          Sets the label for the frame.
 void setNumber(int frameNumber)
          Sets the number for the frame.
static List<Frame> split(Movie aMovie)
          Create a frame based view of a movie.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Frame

public Frame()
Creates a empty frame with no label defined and the definitions, commands and actions lists empty.


Frame

public Frame(int frame)
Creates a empty frame with no label defined and the definitions, commands and actions lists empty.

Parameters:
frame - the frame number.
Method Detail

split

public static List<Frame> split(Movie aMovie)
Create a frame based view of a movie. Objects from the movie are grouped into Frame objects. Objects from the movie are added to the frame so any changes made are reflected in the movie. However objects added or removed from a frame are not reflected in the movie.

Parameters:
aMovie - an Movie object.
Returns:
a list of Frame objects.

addAction

public void addAction(Action anObject)
Adds the action object to the frame.

Parameters:
anObject - the action object to be added to the frame. Must not be null.

addDefinition

public void addDefinition(MovieTag anObject)
Adds an object to the frame that defines an object to be displayed in the movie.

Parameters:
anObject - a sub-class of Definition. Must not be null.

addCommand

public void addCommand(MovieTag anObject)
Adds the display list command to the frame.

Parameters:
anObject - an MovieTag the manipulates the display list. Must not be null.

getNumber

public int getNumber()
Get the number of the frame.

Returns:
the frame number.

getLabel

public String getLabel()
Returns the label assigned to the frame.

Returns:
the label. The string will be empty if no label is defined.

getDefinitions

public List<MovieTag> getDefinitions()
Returns the list of definition objects contained in the frame.

Returns:
the list of definitions.

getCommands

public List<MovieTag> getCommands()
Returns the list of commands that update the display list.

Returns:
the list of commands objects.

getActions

public List<Action> getActions()
Returns the array of action objects that will be execute when the frame is displayed.

Returns:
the array of actions defined for the frame.

setNumber

public void setNumber(int frameNumber)
Sets the number for the frame.

Parameters:
frameNumber - the frame number.

setLabel

public void setLabel(String aString)
Sets the label for the frame.

Parameters:
aString - the label.

setDefinitions

public void setDefinitions(List<MovieTag> list)
Sets the list of action objects for the frame.

Parameters:
list - the list of actions. Must not be null.

setCommands

public void setCommands(List<MovieTag> list)
Sets the list of commands that updated the display list for the frame. The changes are visible when the frame is displayed.

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

setActions

public void setActions(List<Action> list)
Sets the list of action objects for the frame.

Parameters:
list - the list of actions. Must not be null.

addToMovie

public void addToMovie(Movie aMovie)
Add the objects in the frame to the movie. The contents of the definitions and commands lists are added to the movie. If a label is assigned to the frame then an FrameLabel object is added to the movie. If actions are defined then an DoAction object is added containing the actions defined in the frame.

Parameters:
aMovie - an Movie object. Must not be null.


Copyright © 2002-2010 Flagstone Software Ltd.. All Rights Reserved.