Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.flagstone.transform
Class FSFrameLabel

    java.lang.Object
      com.flagstone.transform.FSTransformObject
          com.flagstone.transform.FSMovieObject
              com.flagstone.transform.FSFrameLabel

All Implemented Interfaces:
  java.lang.Cloneable

    public class FSFrameLabel

extends FSMovieObject

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.

# Examples

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.

# History

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

Fields inherited from class com.flagstone.transform.FSMovieObject
`ButtonColorTransform, ButtonSound, DefineBitsPtr, DefineButton, DefineButton2, DefineFont, DefineFont2, DefineImage, DefineImage2, DefineJPEGImage, DefineJPEGImage2, DefineJPEGImage3, DefineMorphShape, DefineMovieClip, DefineShape, DefineShape2, DefineShape3, DefineSound, DefineText, DefineText2, DefineTextField, DefineVideo, DoAction, EnableDebugger, EnableDebugger2, Export, extendLength, FontInfo, FontInfo2, FrameLabel, Free, Import, Initialize, JPEGTables, length, LimitScript, PathsArePostscript, PlaceObject, PlaceObject2, Protect, QuicktimeMovie, RemoveObject, RemoveObject2, SerialNumber, SetBackgroundColor, ShowFrame, SoundStreamBlock, SoundStreamHead, SoundStreamHead2, StartSound, TabOrder, type, VideoFrame`

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

### FSFrameLabel

    public FSFrameLabel(FSCoder coder)

  Construct an FSFrameLabel object, initialising it with values decoded from an encoded object.

  Parameters:
    `coder` - an FSCoder containing the binary data.

### FSFrameLabel

    public FSFrameLabel(java.lang.String aString)

  Constructs an FSFrameLabel object with the specified name.

  Parameters:
    `aString` - the string that defines the label that will be assigned to the current frame.

### FSFrameLabel

    public FSFrameLabel(java.lang.String aString,
                        boolean isAnchor)

  Constructs an FSFrameLabel object with the specified name. If the isAnchor flag is true then the frame will be directly selectable by a URL and the Flash Player will begin playing the movie at the specified frame.

  Parameters:
    `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.

### FSFrameLabel

    public FSFrameLabel(FSFrameLabel obj)

  Constructs an FSFrameLabel object by copying values from an existing object.

  Parameters:
    `obj` - an FSFrameLabel object.

Method Detail

### getLabel

    public java.lang.String getLabel()

  Gets the label.

  Returns:
    the string defining the label.

### setLabel

    public void setLabel(java.lang.String aString)

  Sets the label.

  Parameters:
    `aString` - the string that defines the label that will be assigned to the current frame.

### setLabel

    public void setLabel(java.lang.String aString,
                         boolean isAnchor)

  Sets the label defining whether it will be referenced as an anchor or not.

  Parameters:
    `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.

### getAnchor

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

  Returns:
    true if the frame is an anchor frame, false otherwise.

### setAnchor

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

  Parameters:
    `isAnchor` - true if the frame is an anchor frame, false otherwise.

### equals

    public boolean equals(java.lang.Object anObject)

  Description copied from class: `FSMovieObject`
  Returns true if anObject is equal to this one. Objects are considered equal if they would generate identical binary data when they are encoded to a Flash file.

  Overrides:
    `equals` in class `FSMovieObject`
  Returns:
    true if this object would be identical to anObject when encoded.

### appendDescription

    public void appendDescription(java.lang.StringBuffer buffer,
                                  int depth)

  Description copied from class: `FSTransformObject`
  AppendDescription is used to present a string description of the object including all nested objects up to a specified depth. This method provide a more controlled way of creating a string representation of an object since large objects such as font or shape definitions can contain dozens of nested objects. The representation of the object is appended to the StringBuffer, showing the name of the class and values of the attributes it contains. If the object contains any attributes that are objects then the object graph will be traversed up to the specified depth. If objects are nested at a level less than specified depth then the full string representation of the object is displayed. For objects at the specified depth only the name of the class is displayed. Any objects below this depth are not displayed.

  Overrides:
    `appendDescription` in class `FSMovieObject`
  Parameters:
    `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.

### length

    public int length(FSCoder coder)

  Overrides:
    `length` in class `FSMovieObject`

### encode

    public void encode(FSCoder coder)

  Overrides:
    `encode` in class `FSMovieObject`

### decode

    public void decode(FSCoder coder)

  Overrides:
    `decode` in class `FSMovieObject`

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD