pt.tumba.parser.swf
Class Movie

java.lang.Object
  extended by pt.tumba.parser.swf.Movie
All Implemented Interfaces:
TimeLine

public class Movie
extends java.lang.Object
implements TimeLine

A Flash Movie

Author:
unknown

Field Summary
protected  Color backColor
          Description of the Field
protected  java.util.Map definedSymbols
          Description of the Field
protected  int depth
          Description of the Field
protected  java.util.List exportedSymbols
          Description of the Field
protected  int frameCount
          Description of the Field
protected  int frameRate
          Description of the Field
protected  java.util.SortedMap frames
          Description of the Field
protected  int height
          Description of the Field
protected  java.util.Map importLibraries
          Description of the Field
protected  boolean isProtected
          Description of the Field
protected  int maxId
          Description of the Field
protected  int version
          Description of the Field
protected  int width
          Description of the Field
 
Constructor Summary
Movie()
          Create a movie with the default values - (550x400), 12 frames/sec, white backcolor, Flash version 5.
Movie(int width, int height, int frameRate, int version, Color backColor)
          Create a movie with the given properties
 
Method Summary
 Frame appendFrame()
          Append a frame to the end of the timeline
 void clearExports()
          Clear all the symbol exports
 void clearImports()
          Clear all the defined library imports
 void exportSymbols(java.lang.String[] exportNames, Symbol[] symbols)
          Export a number of symbols with the given names so that other movies can import and use them.
 int getAvailableDepth()
          Get the next available depth in the timeline
 Color getBackColor()
          Gets the backColor attribute of the Movie object
 ExportedSymbol[] getExportedSymbols()
          Get the symbols exported from the movie
 Frame getFrame(int frameNumber)
          Get the Frame object for the given frame number - or create one if none exists.
 int getFrameCount()
          Get the current number of frames in the timeline.
 int getFrameRate()
          Gets the frameRate attribute of the Movie object
 int getHeight()
          Gets the height attribute of the Movie object
 ImportedSymbol[] getImportedSymbols()
          Access the imported symbols.
 int getVersion()
          Gets the version attribute of the Movie object
 int getWidth()
          Gets the width attribute of the Movie object
 ImportedSymbol[] importSymbols(java.lang.String libraryName, java.lang.String[] symbolNames)
          Import symbols from another movie (Flash 5 only)
 boolean isProtected()
          Return the protection flag.
 void protect(boolean isProtected)
          Description of the Method
 void setAvailableDepth(int depth)
          Set the next available depth in the timeline
 void setBackColor(Color color)
          Sets the backColor attribute of the Movie object
 void setFrameRate(int rate)
          Sets the frameRate attribute of the Movie object
 void setHeight(int height)
          Sets the height attribute of the Movie object
 void setVersion(int version)
          Sets the version attribute of the Movie object
 void setWidth(int width)
          Sets the width attribute of the Movie object
 void write(java.io.OutputStream out)
          Write the movie in SWF format to the given output stream.
 void write(java.lang.String filename)
          Write the movie in SWF format to the given file.
 void write(SWFTagTypes tagwriter)
          Write the movie in SWF format.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

width

protected int width
Description of the Field


height

protected int height
Description of the Field


frameRate

protected int frameRate
Description of the Field


backColor

protected Color backColor
Description of the Field


version

protected int version
Description of the Field


isProtected

protected boolean isProtected
Description of the Field


importLibraries

protected java.util.Map importLibraries
Description of the Field


exportedSymbols

protected java.util.List exportedSymbols
Description of the Field


frames

protected java.util.SortedMap frames
Description of the Field


frameCount

protected int frameCount
Description of the Field


definedSymbols

protected java.util.Map definedSymbols
Description of the Field


depth

protected int depth
Description of the Field


maxId

protected int maxId
Description of the Field

Constructor Detail

Movie

public Movie()
Create a movie with the default values - (550x400), 12 frames/sec, white backcolor, Flash version 5.


Movie

public Movie(int width,
             int height,
             int frameRate,
             int version,
             Color backColor)
Create a movie with the given properties

Parameters:
width - Description of the Parameter
height - Description of the Parameter
frameRate - Description of the Parameter
version - Description of the Parameter
backColor - Description of the Parameter
Method Detail

getWidth

public int getWidth()
Gets the width attribute of the Movie object

Returns:
The width value

getHeight

public int getHeight()
Gets the height attribute of the Movie object

Returns:
The height value

getFrameRate

public int getFrameRate()
Gets the frameRate attribute of the Movie object

Returns:
The frameRate value

getVersion

public int getVersion()
Gets the version attribute of the Movie object

Returns:
The version value

getBackColor

public Color getBackColor()
Gets the backColor attribute of the Movie object

Returns:
The backColor value

setWidth

public void setWidth(int width)
Sets the width attribute of the Movie object

Parameters:
width - The new width value

setHeight

public void setHeight(int height)
Sets the height attribute of the Movie object

Parameters:
height - The new height value

setFrameRate

public void setFrameRate(int rate)
Sets the frameRate attribute of the Movie object

Parameters:
rate - The new frameRate value

setVersion

public void setVersion(int version)
Sets the version attribute of the Movie object

Parameters:
version - The new version value

setBackColor

public void setBackColor(Color color)
Sets the backColor attribute of the Movie object

Parameters:
color - The new backColor value

isProtected

public boolean isProtected()
Return the protection flag. If true then the movie cannot be imported into the Flash Author. The existence of tools such as JavaSWF makes this kind of protection almost worthless.

Returns:
The protected value

protect

public void protect(boolean isProtected)
Description of the Method

Parameters:
isProtected - Description of the Parameter

getFrameCount

public int getFrameCount()
Get the current number of frames in the timeline.

Specified by:
getFrameCount in interface TimeLine
Returns:
The frameCount value

getFrame

public Frame getFrame(int frameNumber)
Get the Frame object for the given frame number - or create one if none exists. If the frame number is larger than the current frame count then the frame count is increased.

Specified by:
getFrame in interface TimeLine
Parameters:
frameNumber - must be 1 or larger
Returns:
The frame value

appendFrame

public Frame appendFrame()
Append a frame to the end of the timeline

Specified by:
appendFrame in interface TimeLine
Returns:
Description of the Return Value

getAvailableDepth

public int getAvailableDepth()
Get the next available depth in the timeline

Specified by:
getAvailableDepth in interface TimeLine
Returns:
The availableDepth value

setAvailableDepth

public void setAvailableDepth(int depth)
Set the next available depth in the timeline

Specified by:
setAvailableDepth in interface TimeLine
Parameters:
depth - must be >= 1

importSymbols

public ImportedSymbol[] importSymbols(java.lang.String libraryName,
                                      java.lang.String[] symbolNames)
Import symbols from another movie (Flash 5 only)

Parameters:
libraryName - Description of the Parameter
symbolNames - Description of the Parameter
Returns:
Symbols representing the imports

clearImports

public void clearImports()
Clear all the defined library imports


getImportedSymbols

public ImportedSymbol[] getImportedSymbols()
Access the imported symbols.

Returns:
an empty array if there are no imports

exportSymbols

public void exportSymbols(java.lang.String[] exportNames,
                          Symbol[] symbols)
Export a number of symbols with the given names so that other movies can import and use them. Flash version 5 only.

Parameters:
exportNames - Description of the Parameter
symbols - Description of the Parameter

getExportedSymbols

public ExportedSymbol[] getExportedSymbols()
Get the symbols exported from the movie

Returns:
an empty array if there are no exports

clearExports

public void clearExports()
Clear all the symbol exports


write

public void write(SWFTagTypes tagwriter)
           throws java.io.IOException
Write the movie in SWF format.

Parameters:
tagwriter - Description of the Parameter
Throws:
java.io.IOException - Description of the Exception

write

public void write(java.lang.String filename)
           throws java.io.IOException
Write the movie in SWF format to the given file.

Parameters:
filename - Description of the Parameter
Throws:
java.io.IOException - Description of the Exception

write

public void write(java.io.OutputStream out)
           throws java.io.IOException
Write the movie in SWF format to the given output stream.

Parameters:
out - Description of the Parameter
Throws:
java.io.IOException - Description of the Exception