|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.flagstone.transform.Place2
public final class Place2
Place2 is used to add and manipulate objects (shape, button, etc.) on the Flash Player's display list.
Place2 supersedes the Place class providing more functionality and easier manipulation of objects in the display list through the following operations:
Clipping Depth
With the introduction of Flash 3 the display list supported a clipping layer.
This allowed the outline of an object to define a clipping path that is used
to mask other objects placed in front of it. The clipping depth can be set to
mask objects between the layer containing the clipping path and a specified
layer.
Shape Morphing
Shapes that will be morphed are defined using the DefineMorphShape class
which defines a start and end shape. The Flash Player performs the
interpolation that transforms one shape into another. The progress of the
morphing process is controlled by a ratio which ranges from 0.0 to 1.0, where
0 generates a shape identical to the starting shape in the DefineMorphShape
object and 1.0 generates the shape at the end of the morphing process.
Event Handlers
With the introduction of Flash 5, movie clips (defined using the
DefineMovieClip class) could specify sequences of actions that would be
performed in response to mouse or keyboard events. The actions are specified
using EventHandler objects and the Place2 class is used to register the
actions in response to a particular event with the Flash player. Multiple
events can be handled by defining an EventHandler for each type of event. For
more information see the EventHandler and Event which defines the set of
events that a movie clip responds to.
Since only one object can be placed on a given layer an existing object on the display list can be identified by the layer it is displayed on rather than its identifier. Therefore Layer is the only required attribute. The remaining attributes are optional according to the different operation being performed:
The Layer class provides a simple API for manipulating objects on the display list. While it is relatively simple to create instances of Place2 object that perform the same steps the API provided by Player is easier to use and much more readable.
Layer| Constructor Summary | |
|---|---|
Place2()
Creates an uninitialised Place2 object. |
|
Place2(Place2 object)
Creates and initialises a Place2 object using the values copied from another Place2 object. |
|
Place2(SWFDecoder coder,
Context context)
Creates and initialises a Place2 object using values encoded in the Flash binary format. |
|
| Method Summary | |
|---|---|
Place2 |
add(EventHandler aClipEvent)
Adds a clip event to the list of clip events. |
Place2 |
copy()
Creates a complete copy of this object. |
void |
encode(SWFEncoder coder,
Context context)
Encode an object to the Flash binary format. |
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. |
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 Place2 |
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 Place2 |
replace(int identifier,
int layer)
Replace an existing object with another. |
static Place2 |
replace(int identifier,
int layer,
int xCoord,
int yCoord)
Replace an existing object with another. |
Place2 |
setColorTransform(ColorTransform cxform)
Sets the colour transform that defines the colour effects applied to the object. |
Place2 |
setDepth(Integer aNumber)
Sets the number of layers that this object will mask. |
void |
setEvents(List<EventHandler> list)
Set the list of Clip events. |
Place2 |
setIdentifier(int uid)
Sets the identifier of the object. |
Place2 |
setLayer(int aLayer)
Sets the layer at which the object will be placed. |
Place2 |
setLocation(int xCoord,
int yCoord)
Sets the location where the object will be displayed. |
Place2 |
setName(String aString)
Set the name of an object to be displayed. |
Place2 |
setRatio(Integer aNumber)
Sets point of the morphing process for a morph shape in the range 0..65535. |
Place2 |
setTransform(CoordTransform matrix)
Sets the coordinate transform that defines the position where the object will be displayed. |
Place2 |
setType(PlaceType aType)
Sets the type of placement. |
static Place2 |
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 |
|---|
public Place2(SWFDecoder coder,
Context context)
throws IOException
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.
IOException - if an error occurs while decoding the data.public Place2()
public Place2(Place2 object)
object - a Place2 object from which the values will be
copied.| Method Detail |
|---|
public static Place2 show(int identifier,
int layer,
int xCoord,
int yCoord)
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.
public static Place2 move(int layer,
int xCoord,
int yCoord)
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.
public static Place2 replace(int identifier,
int layer)
identifier - the unique identifier of the new object.layer - the display list layer of the existing object.
public static Place2 replace(int identifier,
int layer,
int xCoord,
int yCoord)
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.
public Place2 add(EventHandler aClipEvent)
aClipEvent - a clip event object.
public List<EventHandler> getEvents()
public void setEvents(List<EventHandler> list)
list - a list of ClipEvent objects.public PlaceType getType()
public int getLayer()
public int getIdentifier()
public CoordTransform getTransform()
public ColorTransform getColorTransform()
public Integer getRatio()
public Integer getDepth()
public String getName()
public Place2 setType(PlaceType aType)
aType - the type of operation to be performed, either New, Modify or
Replace.
public Place2 setLayer(int aLayer)
aLayer - the layer number on which the object is being displayed. Must
be in the range 1..65535.
public Place2 setIdentifier(int uid)
uid - the identifier of a new object to be displayed. Must be in the
range 1..65535.
public Place2 setTransform(CoordTransform matrix)
matrix - an CoordTransform object that will be applied to the object
displayed.
public Place2 setLocation(int xCoord,
int yCoord)
xCoord - the x-coordinate of the object's origin.yCoord - the x-coordinate of the object's origin.
public Place2 setColorTransform(ColorTransform cxform)
cxform - an ColorTransform object that will be applied to the object
displayed.
public Place2 setRatio(Integer aNumber)
aNumber - the progress in the morphing process.
public Place2 setDepth(Integer aNumber)
aNumber - the number of layers clipped.
public Place2 setName(String aString)
aString - the name assigned to the object.
public Place2 copy()
copy in interface Copyable<MovieTag>public String toString()
toString in class Objectpublic int prepareToEncode(Context context)
prepareToEncode in interface SWFEncodeablecontext - an Context that allows information to be passed between
objects to control how they are initialised for encoding.
public void encode(SWFEncoder coder,
Context context)
throws IOException
encode in interface SWFEncodeablecoder - an SWFEncoder object.context - an Context that allows information to be passed between
objects to control how they are initialised for encoding.
IOException - if an error occurs while encoding the object.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||