|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.flagstone.transform.FSTransformObject
com.flagstone.transform.FSMovieObject
com.flagstone.transform.FSFrameLabel
public class FSFrameLabel
FSFrameLabel defines a name for the current frame in a movie or movie clip.
The name can be referenced from other objects such as FSGotoFrame2 to simplify the creation of scripts to control movies by using a predefined name rather than the frame number. The label assigned to a particular frame should be unique. Frames may also be reference externally when specifying the movie to play using a URL - similar to the way names links are used in HTML. When the Flash Player loaded a movie it will begin playing at the frame specified in the URL.
Attributes | |
---|---|
type | Identifies the data structure when it is encoded. Read-only. |
label | The name that will be assigned to the current frame. |
isAnchor | Will the label be used as an anchor. |
The name is assigned to a particular frame when the FSFrameLabel object is defined prior to the FSShowFrame object that displays all the objects on the display list. The frame can then be referenced by its name once it has been defined. A frame cannot be referenced before the Player has loaded and displayed the frame that contains the corresponding FSFrameLabel object.
The following simplified code samples illustrate how to use the FSFrameLabel class to refer to a frame by its name rather than a number.
1. Using the FSFrameLabel object.
This examples uses the FSFrameLabel
object to allow the movie to loop back and replay an animation starting at a
named frame.
movie.add(new FSFrameLabel("Frame Name")); ... movie.add(new FSShowFrame()); ... FSDoAction frameAction = new FSDoAction(); frameAction.add(new FSPush("FirstFrame")); frameAction.add(new FSGotoFrame2(false)); movie.add(frameAction);
2. Controlling a movie clip.
The FSFrameLabel object can also be used
to control the time-line of a movie clip. In this case though the mechanism
is slightly different. 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:
// First define the commands that animate the movie clip. ArrayList commands = new ArrayList(); ... commands.add(new FSFrameLabel("Frame Name")); commands.add(new FSShowFrame()); FSDefineMovieClip movieClip = new FSDefineMovieClip(movie.newIdentifier(), commands); // Add the movie clip to the display list on layer 1 at (400, 400). Give it the name // "movieClip" to allow it to be referenced later. movie.add(movieClip); movie.add(new FSPlaceObject2(movieClip.getIdentifier(), 1, events, "movieClip", 400, 400)); // Create the FSDoAction object that will start the movie clip playing. FSDoAction clipActions = new FSDoAction(); // Movie clips objects can be controlled by executing pre-defined methods. // Define the arguments followed by their number for the gotoAndPlay method. clipActions.add(new FSPush("Frame Name")); clipActions.add(new FSPush(1)); // Get the movie clip object using its name. It's location is specified relative to the "_root" // level which represents the main time-line of the movie. clipActions.add(new FSPush("_root")); clipActions.add(new FSPush("movieClip")); clipActions.add(FSAction.GetAttribute()); actions.add(new FSPush("gotoAndPlay")); actions.add(FSAction.ExecuteMethod()); movie.add(clipActions); movie.add(new FSShowFrame());
3. Defining an anchored frame.
Specifying a frame name as an anchor
allows a movie start playing from any frame.
// Define the anchored frame in a movie. movie.add(new FSFrameLabel("StartHere", true)); movie.add(new FSShowFrame()); .... movie.encodeToFile("movie.swf");
To start playing the movie at the frame labeled "StartHere" specify the label using the same format a HTML anchors:
http://www.flagstonesoftware.com/flash/movie.swf#StartHere
This may be used either in a browser window to load a file or form within a movie using the FSGetUrl or FSGetUrl2 actions.
The FSFrameLabel class represents the FrameLabel tag from the Macromedia Flash (SWF) File Format Specification. It was introduced in Flash 3. In Flash 6 the label can support named anchors which allows a frame to be specified as the starting point when displaying a Flash movie in a web browser.
Field Summary |
---|
Constructor Summary | |
---|---|
FSFrameLabel(FSCoder coder)
Construct an FSFrameLabel object, initialising it with values decoded from an encoded object. |
|
FSFrameLabel(FSFrameLabel obj)
Constructs an FSFrameLabel object by copying values from an existing object. |
|
FSFrameLabel(java.lang.String aString)
Constructs an FSFrameLabel object with the specified name. |
|
FSFrameLabel(java.lang.String aString,
boolean isAnchor)
Constructs an FSFrameLabel object with the specified name. |
Method Summary | |
---|---|
void |
appendDescription(java.lang.StringBuffer buffer,
int depth)
AppendDescription is used to present a string description of the object including all nested objects up to a specified depth. |
void |
decode(FSCoder coder)
|
void |
encode(FSCoder coder)
|
boolean |
equals(java.lang.Object anObject)
Returns true if anObject is equal to this one. |
boolean |
getAnchor()
Gets the flag indicating whether the frame name is also used as an anchor so the frame can be referenced from outside of the movie. |
java.lang.String |
getLabel()
Gets the label. |
int |
length(FSCoder coder)
|
void |
setAnchor(boolean isAnchor)
Sets the flag indicating whether the frame name is also used as an anchor so the frame can be referenced from outside of the movie. |
void |
setLabel(java.lang.String aString)
Sets the label. |
void |
setLabel(java.lang.String aString,
boolean isAnchor)
Sets the label defining whether it will be referenced as an anchor or not. |
Methods inherited from class com.flagstone.transform.FSMovieObject |
---|
getType |
Methods inherited from class com.flagstone.transform.FSTransformObject |
---|
clone, name, toString |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public FSFrameLabel(FSCoder coder)
coder
- an FSCoder containing the binary data.public FSFrameLabel(java.lang.String aString)
aString
- the string that defines the label that will be assigned to the
current frame.public FSFrameLabel(java.lang.String aString, boolean isAnchor)
aString
- the string that defines the label that will be assigned to the
current frame.isAnchor
- if true the name will be used as an anchor when referencing
the frame in a URL.public FSFrameLabel(FSFrameLabel obj)
obj
- an FSFrameLabel object.Method Detail |
---|
public java.lang.String getLabel()
public void setLabel(java.lang.String aString)
aString
- the string that defines the label that will be assigned to the
current frame.public void setLabel(java.lang.String aString, boolean isAnchor)
aString
- the string that defines the label that will be assigned to the
current frame.isAnchor
- if true the name will be used as an anchor when referencing
the frame in a URL.public boolean getAnchor()
public void setAnchor(boolean isAnchor)
isAnchor
- true if the frame is an anchor frame, false otherwise.public boolean equals(java.lang.Object anObject)
FSMovieObject
equals
in class FSMovieObject
public void appendDescription(java.lang.StringBuffer buffer, int depth)
FSTransformObject
appendDescription
in class FSMovieObject
buffer
- a StringBuffer to which the description of each object is
appended.depth
- the maximum level of nesting up to which objects will be
displayed.public int length(FSCoder coder)
length
in class FSMovieObject
public void encode(FSCoder coder)
encode
in class FSMovieObject
public void decode(FSCoder coder)
decode
in class FSMovieObject
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |