com.flagstone.transform
Class Place3

java.lang.Object
  extended by com.flagstone.transform.Place3
All Implemented Interfaces:
Copyable<MovieTag>, SWFEncodeable, MovieTag

public final class Place3
extends Object
implements MovieTag

Place3 is used to update the display list. It extends Place2 by specifying a Blend which controls how an object is composited with its background and also Filters which can be used to create special effects such as drop shadows etc.

See Also:
Place2

Constructor Summary
Place3()
          Creates an uninitialised Place3 object.
Place3(Place3 object)
          Creates and initialises a Place3 object using the values copied from another Place3 object.
Place3(SWFDecoder coder, Context context)
          Creates and initialises a Place3 object using values encoded in the Flash binary format.
 
Method Summary
 Place3 add(EventHandler aClipEvent)
          Adds a clip event to the list of clip events.
 Place3 add(Filter filter)
          Adds a Filter to the list of filters.
 Place3 copy()
          Creates a complete copy of this object.
 void encode(SWFEncoder coder, Context context)
          Encode an object to the Flash binary format.
 Integer getBitmapCache()
          Get the value indicating whether the display object will be cached as a bitmap (non-zero) or not cached (zero).
 Blend getBlend()
          Get the blend that describes how the object will be rendered in relation to the background.
 String getClassName()
          Get the name of the Actionscript 3 class which will be used to render the object to be displayed.
 ColorTransform getColorTransform()
          Get the colour transform.
 Integer getDepth()
          Get the number of layers that will be clipped by the object placed on the layer specified in this object.
 List<EventHandler> getEvents()
          Get the list of event handlers that define the actions that will be executed in response to events that occur in the movie clip being placed.
 List<Filter> getFilters()
          Get the list of filters that will be applied to the object when it is displayed as a bitmap.
 int getIdentifier()
          Get the identifier of the object to be placed.
 int getLayer()
          Get the Layer on which the object will be displayed in the display list.
 String getName()
          Get the name of the object.
 Integer getRatio()
          Get the morph ratio, in the range 0..65535 that defines the progress in the morphing process performed by the Flash Player from the defined start and end shapes.
 CoordTransform getTransform()
          Get the coordinate transform.
 PlaceType getType()
          Get the type of place operation being performed, either adding a new object, replacing an existing one with another or modifying an existing object.
static Place3 move(int layer, int xCoord, int yCoord)
          Change the position of a displayed object.
 int prepareToEncode(Context context)
          Prepare an object for encoding, returning the expected size of an object when it is encoded.
static Place3 replace(int identifier, int layer)
          Replace an existing object with another.
static Place3 replace(int identifier, int layer, int xCoord, int yCoord)
          Replace an existing object with another.
 Place3 setBitmapCache(Integer cache)
          Set whether the displayed object should be cached as a bitmap.
 Place3 setBlend(Blend mode)
          Set the blend that describes how the object will be rendered in relation to the background.
 Place3 setClassName(String aName)
          Set the name of the Actionscript 3 class which will be used to render the object to be displayed.
 Place3 setColorTransform(ColorTransform cxform)
          Sets the colour transform that defines the colour effects applied to the object.
 Place3 setDepth(Integer aNumber)
          Sets the number of layers that this object will mask.
 void setEvents(List<EventHandler> list)
          Set the list of Clip events.
 void setFilters(List<Filter> list)
          Set the list of filters that will be applied to the object when it is displayed as a bitmap.
 Place3 setIdentifier(int uid)
          Sets the identifier of the object.
 Place3 setLayer(int aLayer)
          Sets the layer at which the object will be placed.
 Place3 setName(String aString)
          Set the name of an object to be displayed.
 Place3 setRatio(Integer aNumber)
          Sets point of the morphing process for a morph shape in the range 0..65535.
 Place3 setTransform(CoordTransform matrix)
          Sets the coordinate transform that defines the position where the object will be displayed.
 Place3 setType(PlaceType aType)
          Sets the type of placement.
static Place3 show(int identifier, int layer, int xCoord, int yCoord)
          Place a new object on the display list.
 String toString()
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Place3

public Place3(SWFDecoder coder,
              Context context)
       throws IOException
Creates and initialises a Place3 object using values encoded in the Flash binary format.

Parameters:
coder - an SWFDecoder object that contains the encoded Flash data.
context - a Context object used to manage the decoders for different type of object and to pass information on how objects are decoded.
Throws:
IOException - if an error occurs while decoding the data.

Place3

public Place3()
Creates an uninitialised Place3 object.


Place3

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

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

show

public static Place3 show(int identifier,
                          int layer,
                          int xCoord,
                          int yCoord)
Place a new object on the display list.

Parameters:
identifier - the unique identifier for the object.
layer - the layer where it will be displayed.
xCoord - the x-coordinate where the object's origin will be.
yCoord - the y-coordinate where the object's origin will be.
Returns:
the Place3 object to update the display list.

move

public static Place3 move(int layer,
                          int xCoord,
                          int yCoord)
Change the position of a displayed object.

Parameters:
layer - the display list layer where the object is displayed.
xCoord - the x-coordinate where the object's origin will be moved.
yCoord - the y-coordinate where the object's origin will be moved.
Returns:
the Place3 object to change the position of the object.

replace

public static Place3 replace(int identifier,
                             int layer)
Replace an existing object with another.

Parameters:
identifier - the unique identifier of the new object.
layer - the display list layer of the existing object.
Returns:
the Place3 object to update the display list.

replace

public static Place3 replace(int identifier,
                             int layer,
                             int xCoord,
                             int yCoord)
Replace an existing object with another.

Parameters:
identifier - the unique identifier of the new object.
layer - the display list layer of the existing object.
xCoord - the x-coordinate where the new object's origin will be.
yCoord - the y-coordinate where the new object's origin will be.
Returns:
the Place3 object to update the display list.

getType

public PlaceType getType()
Get the type of place operation being performed, either adding a new object, replacing an existing one with another or modifying an existing object.

Returns:
the way the object will be placed.

setType

public Place3 setType(PlaceType aType)
Sets the type of placement.

Parameters:
aType - the type of operation to be performed, either New, Modify or Replace.
Returns:
this object.

getLayer

public int getLayer()
Get the Layer on which the object will be displayed in the display list.

Returns:
the layer where the object will be displayed.

setLayer

public Place3 setLayer(int aLayer)
Sets the layer at which the object will be placed.

Parameters:
aLayer - the layer number on which the object is being displayed. Must be in the range 1..65535.
Returns:
this object.

getIdentifier

public int getIdentifier()
Get the identifier of the object to be placed. This is only required when placing an object for the first time. Subsequent references to the object on this layer can simply use the layer number.

Returns:
the unique identifier of the object to be displayed.

setIdentifier

public Place3 setIdentifier(int uid)
Sets the identifier of the object.

Parameters:
uid - the identifier of a new object to be displayed. Must be in the range 1..65535.
Returns:
this object.

getTransform

public CoordTransform getTransform()
Get the coordinate transform. May be null if no coordinate transform was defined.

Returns:
the coordinate transform that will be applied to the displayed object.

setTransform

public Place3 setTransform(CoordTransform matrix)
Sets the coordinate transform that defines the position where the object will be displayed. The argument may be null if the location of the object is not being changed.

Parameters:
matrix - an CoordTransform object that will be applied to the object displayed.
Returns:
this object.

getColorTransform

public ColorTransform getColorTransform()
Get the colour transform. May be null if no colour transform was defined.

Returns:
the colour transform that will be applied to the displayed object.

setColorTransform

public Place3 setColorTransform(ColorTransform cxform)
Sets the colour transform that defines the colour effects applied to the object. The argument may be null if the color of the object is not being changed.

Parameters:
cxform - an ColorTransform object that will be applied to the object displayed.
Returns:
this object.

getRatio

public Integer getRatio()
Get the morph ratio, in the range 0..65535 that defines the progress in the morphing process performed by the Flash Player from the defined start and end shapes. A value of 0 indicates the start of the process and 65535 the end. Returns null if no ratio was specified.

Returns:
the morphing ratio.

setRatio

public Place3 setRatio(Integer aNumber)
Sets point of the morphing process for a morph shape in the range 0..65535. May be set to null if the shape being placed is not being morphed.

Parameters:
aNumber - the progress in the morphing process.
Returns:
this object.

getDepth

public Integer getDepth()
Get the number of layers that will be clipped by the object placed on the layer specified in this object.

Returns:
the number of layers to be clipped.

setDepth

public Place3 setDepth(Integer aNumber)
Sets the number of layers that this object will mask. May be set to zero if the shape being placed does not define a clipping area.

Parameters:
aNumber - the number of layers clipped.
Returns:
this object.

getName

public String getName()
Get the name of the object. May be null if a name was not assigned to the object.

Returns:
the name of the object.

setName

public Place3 setName(String aString)
Set the name of an object to be displayed. If a shape is not being assigned a name then setting the argument to null will omit the attribute when the object is encoded.

Parameters:
aString - the name assigned to the object.
Returns:
this object.

getBitmapCache

public Integer getBitmapCache()
Get the value indicating whether the display object will be cached as a bitmap (non-zero) or not cached (zero).

Returns:
a non-zero value if the object is cached or zer oif not cached.

setBitmapCache

public Place3 setBitmapCache(Integer cache)
Set whether the displayed object should be cached as a bitmap.

Parameters:
cache - set to a non-zero value if the object should be cached as a bitmap or to zero to disable caching.
Returns:
this object.

getClassName

public String getClassName()
Get the name of the Actionscript 3 class which will be used to render the object to be displayed.

Returns:
the name of the Actionscript class.

setClassName

public Place3 setClassName(String aName)
Set the name of the Actionscript 3 class which will be used to render the object to be displayed.

Parameters:
aName - the name of the Actionscript class.
Returns:
this object.

getFilters

public List<Filter> getFilters()
Get the list of filters that will be applied to the object when it is displayed as a bitmap.

Returns:
the list of bitmap filters.

setFilters

public void setFilters(List<Filter> list)
Set the list of filters that will be applied to the object when it is displayed as a bitmap.

Parameters:
list - the list of bitmap filters.

getBlend

public Blend getBlend()
Get the blend that describes how the object will be rendered in relation to the background.

Returns:
the Blend that describes how the object is composited.

setBlend

public Place3 setBlend(Blend mode)
Set the blend that describes how the object will be rendered in relation to the background.

Parameters:
mode - the Blend that describes how the object is composited.
Returns:
this object.

add

public Place3 add(EventHandler aClipEvent)
Adds a clip event to the list of clip events.

Parameters:
aClipEvent - a clip event object.
Returns:
this object.

getEvents

public List<EventHandler> getEvents()
Get the list of event handlers that define the actions that will be executed in response to events that occur in the movie clip being placed.

Returns:
the set of event handlers for the movie clip.

setEvents

public void setEvents(List<EventHandler> list)
Set the list of Clip events. Clip Events are only valid for movie clips and the argument should be set to null when placing other types of object. If the object already contains a set of encoded clip event objects they will be deleted.

Parameters:
list - a list of ClipEvent objects.

add

public Place3 add(Filter filter)
Adds a Filter to the list of filters.

Parameters:
filter - a Filter object.
Returns:
this object.

copy

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

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