com.flagstone.transform.action
Class GotoFrame2

java.lang.Object
  extended by com.flagstone.transform.action.GotoFrame2
All Implemented Interfaces:
Action, Copyable<Action>, SWFEncodeable

public final class GotoFrame2
extends Object
implements Action

The GotoFrame2 action instructs the player to go to the named or numbered frame in the current movie's main time-line. It extends the functionality provided by the GotoFrame action by allowing the name of a frame, previously assigned using the FrameLabel object, to be specified.

Up to Flash Version 4, movies contained a single sequence of 65536 frames. In Flash 5 the concept of Scenes was added which allowed movies to contain 'pages' of frames. GotoFrame2 contains a frameOffset attribute which allows the frames in each scene to be referenced by its 'logical' number. The frameOffset for a given scene is added to the frame number to generate the 'physical' page number.

GotoFrame2 is a stack-based action. The name or number of the frame is pushed onto the stack before the GotoFrame2 action is executed. If a frameOffset is specified it is added to the number of the frame identified by the stack arguments to give the final frame number. Whether the movie starts playing the frame is controlled by the boolean attribute, play. When set to true the movie starts playing the frame as soon as it has been loaded by the Flash Player.

GotoFrame2 is only used to control the main time-line of a movie. Controlling how an individual movie clip is played is handled by a different mechanism. From Flash 5 onward movie clips are defined as objects. The ExecuteMethod action is used to execute the gotoAndPlay() or gotoAndStop() methods that control a movie clip's time-line.

See Also:
GotoFrame

Constructor Summary
GotoFrame2(boolean aBool)
          Creates a GotoFrame2 object with the specified play flag setting.
GotoFrame2(GotoFrame2 object)
          Creates and initialises a GotoFrame2 action using the values copied from another GotoFrame2 action.
GotoFrame2(int offset, boolean aBool)
          Creates a GotoFrame2 object with the specified play flag setting and frame offset for a given scene.
GotoFrame2(SWFDecoder coder)
          Creates and initialises an GotoFrame2 action using values encoded in the Flash binary format.
 
Method Summary
 GotoFrame2 copy()
          Creates a complete copy of this object.
 void encode(SWFEncoder coder, Context context)
          Encode an object to the Flash binary format.
 int getFrameOffset()
          Returns the offset that will be added to the 'logical' frame number obtained from the stack to generate the 'physical' frame number.
 boolean isPlay()
          Returns the play flag.
 int prepareToEncode(Context context)
          Prepare an object for encoding, returning the expected size of an object when it is encoded.
 String toString()
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

GotoFrame2

public GotoFrame2(SWFDecoder coder)
           throws IOException
Creates and initialises an GotoFrame2 action 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.

GotoFrame2

public GotoFrame2(boolean aBool)
Creates a GotoFrame2 object with the specified play flag setting.

Parameters:
aBool - true if the player should being playing the movie at the specified frame. false if the player should stop playing the movie.

GotoFrame2

public GotoFrame2(int offset,
                  boolean aBool)
Creates a GotoFrame2 object with the specified play flag setting and frame offset for a given scene.

Parameters:
offset - a number which will be added to the number of the frame popped from the stack to give the final frame number. Must be in the range 1..65535.
aBool - true if the player should being playing the movie at the specified frame, false if the player should stop playing the movie.

GotoFrame2

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

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

getFrameOffset

public int getFrameOffset()
Returns the offset that will be added to the 'logical' frame number obtained from the stack to generate the 'physical' frame number.

Returns:
the offset to the next frame to be displayed.

isPlay

public boolean isPlay()
Returns the play flag.

Returns:
true if the player will being playing the movie at the specified frame, false otherwise.

copy

public GotoFrame2 copy()
Creates a complete copy of this object.

Specified by:
copy in interface Copyable<Action>
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.