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 FSPlaceObject

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

All Implemented Interfaces:
  java.lang.Cloneable

    public class FSPlaceObject

extends FSMovieObject

FSPlaceObject is used to add an object (shape, button, etc.) to the Flash Player's display list.

Attributes
type | Identifies the data structure when it is encoded. Read-only.
identifier | The unique identifier, in the range 1..65535, of the object to be displayed.
layer | The Display List layer on which the object is drawn.
coordTransform | An FSCoordTransform which defines the location and appearance of the object.
colorTransform | An FSColorTransform which defines any changes to be made to the object's original colour. Optional. May be set to null if an object's colour is not being changed.

Every class that defines a shape, button etc. is assigned a unique identifier. This is an integer in the range 1..65535 and is used to refer to objects when performing actions such as adding or removing them from the display list.

The display list contains all the objects that are currently visible on the Flash Player's screen. The display list is ordered in layers, with one (and only one) object displayed on each layer. The Layer defines the order in which objects are displayed. Objects with a higher layer number are displayed in front of objects on a lower layer.

The coordinate transform is principally used to specify the location of the object when it is drawn on the screen however more complex coordinate transforms can also be specified such as rotating or scaling the object without changing the original definition.

Similarly the color transform allows the color of the object to be changed when it is displayed without changing the original definition. The FSPlaceObject class only supports opaque colours so although the FSColorTransform supports transparent colours this information is ignored by the Flash Player. The colour transform is optional and may be set to the null object.

# Examples

The following simplified code fragments illustrate how the FSPlaceObject class can be used.

1. Display an object.
Display an object on layer 1 at (400, 400). FSPlaceObject provides a constructor which specifies just the x and y coordinates, the FSCoordTransform object is constructed internally.

      FSDefineShape shape = new FSDefineShape(movie.newIdentifier(), ......)

      movie.add(new FSPlaceObject(shape.getIdentifier(), 1, 400, 400));
      movie.add(new FSShowFrame());

2. Scale an object.
Scale an object to twice its original size by specifying a more complex coordinate transformation. Complex transforms can be created by compositing individual steps.

     FSCoordTransform location = FSCoordTransform.translate(200, 200);
     FSCoordTransform scale = FSCoordTransform.scale(2.0, 2.0);
     FSCoordTransform transform = FSCoordTransform.composite(location, scale);

     movie.add(new FSPlaceObject(shape.getIdentifier(), 1, transform));
     movie.add(new FSShowFrame());

3. Move an object.
To move an object the FSPlaceObject class must be used in conjunction with the FSRemoveObject class to first remove the object from its existing position before being placed at the new location.

     // Add the shape to the display list.
     movie.add(new FSPlaceObject(shape.getIdentifier(), 1, 400, 400));
     movie.add(new FSShowFrame());

     // Move shape to a new location, removing the original so it does not get displayed twice.
     movie.add(new FSRemoveObject(shape.getIdentifier(), 1));
     movie.add(new FSPlaceObject(shape.getIdentifier(), 1, 250, 300));
     movie.add(new FSShowFrame());

# History

The FSPlaceObject class represents the PlaceObject tag from the Macromedia Flash (SWF) File Format Specification. It was introduced in Flash 1 and is superseded by the PlaceObject2 tag which was added in Flash 3.

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
`FSPlaceObject(FSCoder coder)` Construct an FSPlaceObject object, initalising it with values decoded from an encoded object.
`FSPlaceObject(FSPlaceObject obj)` Constructs an FSPlaceObject object by copying values from an existing object.
`FSPlaceObject(int anIdentifier, int aLayer, FSCoordTransform aTransform)` Constructs an FSPlaceObject object that places the object with the identifier at the specified layer with the coordinate transform.
`FSPlaceObject(int anIdentifier, int aLayer, FSCoordTransform aTransform, FSColorTransform aColorTransform)` Constructs an FSPlaceObject object that places the the object with the identifier at the specified layer, coordinate transform and colour transform.
`FSPlaceObject(int anIdentifier, int aLayer, int xLocation, int yLocation)` Constructs an FSPlaceObject object that places an object with the identifier into the display list layer at the specified coordinates (x,y).

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.
`java.lang.Object` | `clone()` Creates a deep copy of the entire object.
`void` | `decode(FSCoder coder)`
`void` | `encode(FSCoder coder)`
`boolean` | `equals(java.lang.Object anObject)` Returns true if anObject is equal to this one.
`FSColorTransform` | `getColorTransform()` Gets the colour transform that defines any colour effects applied when the object is displayed.
`int` | `getIdentifier()` Gets the identifier of the object.
`int` | `getLayer()` Gets the layer that defines the order in which objects are displayed.
`FSCoordTransform` | `getTransform()` Gets the transform that defines the position where the object is displayed.
`int` | `length(FSCoder coder)`
`void` | `setColorTransform(FSColorTransform aColorTransform)` Sets the colour transform that defines any colour effects applied when the object is displayed.
`void` | `setIdentifier(int anIdentifier)` Sets the identifier of the object.
`void` | `setLayer(int aNumber)` Sets the layer that defines the order in which objects are displayed.
`void` | `setTransform(FSCoordTransform aTransform)` Sets the transform that defines the position where the object is displayed.

Methods inherited from class com.flagstone.transform.FSMovieObject
`getType`

Methods inherited from class com.flagstone.transform.FSTransformObject
`name, toString`

Methods inherited from class java.lang.Object
`finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### FSPlaceObject

    public FSPlaceObject(FSCoder coder)

  Construct an FSPlaceObject object, initalising it with values decoded from an encoded object.

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

### FSPlaceObject

    public FSPlaceObject(int anIdentifier,
                         int aLayer,
                         int xLocation,
                         int yLocation)

  Constructs an FSPlaceObject object that places an object with the identifier into the display list layer at the specified coordinates (x,y).

  Parameters:
    `anIdentifier` - the unique identifier for the object to the placed on the display list.
    `aLayer` - the layer in the display list where the object will be placed.
    `xLocation` - the x-coordinate where the object will be drawn.
    `yLocation` - the y-coordinate where the object will be drawn.

### FSPlaceObject

    public FSPlaceObject(int anIdentifier,
                         int aLayer,
                         FSCoordTransform aTransform)

  Constructs an FSPlaceObject object that places the object with the identifier at the specified layer with the coordinate transform.

  Parameters:
    `anIdentifier` - the unique identifier for the object to the placed on the display list.
    `aLayer` - the layer in the display list where the object will be placed.
    `aTransform` - an FSCoordTransform object that defines the orientation, size and location of the object when it is drawn.

### FSPlaceObject

    public FSPlaceObject(int anIdentifier,
                         int aLayer,
                         FSCoordTransform aTransform,
                         FSColorTransform aColorTransform)

  Constructs an FSPlaceObject object that places the the object with the identifier at the specified layer, coordinate transform and colour transform.

  Parameters:
    `anIdentifier` - the unique identifier for the object to the placed on the display list.
    `aLayer` - the layer in the display list where the object will be placed.
    `aTransform` - an FSCoordTransform object that defines the orientation, size and location of the object when it is drawn.
    `aColorTransform` - an FSColorTransform object that defines the colour of the object when it is drawn.

### FSPlaceObject

    public FSPlaceObject(FSPlaceObject obj)

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

  Parameters:
    `obj` - an FSPlaceObject object.

Method Detail

### getIdentifier

    public int getIdentifier()

  Gets the identifier of the object.

  Returns:
    the identifier of the object being placed.

### getLayer

    public int getLayer()

  Gets the layer that defines the order in which objects are displayed.

  Returns:
    the layer on which the object will be displayed.

### getTransform

    public FSCoordTransform getTransform()

  Gets the transform that defines the position where the object is displayed.

  Returns:
    the FSCoordTransform applied to the object when it is drawn.

### getColorTransform

    public FSColorTransform getColorTransform()

  Gets the colour transform that defines any colour effects applied when the object is displayed.

  Returns:
    the FSColorTransform applied to the object when it is drawn.

### setIdentifier

    public void setIdentifier(int anIdentifier)

  Sets the identifier of the object.

  Parameters:
    `anIdentifier` - the unique identifier for the object to the placed on the display list.

### setLayer

    public void setLayer(int aNumber)

  Sets the layer that defines the order in which objects are displayed.

  Parameters:
    `aNumber` - the layer in the display list where the object will be placed.

### setTransform

    public void setTransform(FSCoordTransform aTransform)

  Sets the transform that defines the position where the object is displayed.

  Parameters:
    `aTransform` - an FSCoordTransform object that defines the orientation, size and location of the object when it is drawn.

### setColorTransform

    public void setColorTransform(FSColorTransform aColorTransform)

  Sets the colour transform that defines any colour effects applied when the object is displayed.

  Parameters:
    `aColorTransform` - an FSColorTransform object that defines the colour of the object when it is drawn.

### clone

    public java.lang.Object clone()

  Description copied from class: `FSTransformObject`
  Creates a deep copy of the entire object.

  Overrides:
    `clone` in class `FSTransformObject`
  Returns:
    a copy of the object.

### 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