|
|||||||||
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.FSButton
public class FSButton
FSButton identifies the shape that is drawn when a button is in a particular state.
Shapes can be drawn for each of three button states, Over, Up and Down. Creating a button with more than one FSButton object each referencing a different shape allows the button to be animated as it is clicked.
A shape is also used to define active area of the button. When defining the active area the outline of the shape defines the boundary of the area. The shape is not drawn when the button is displayed. The button will only respond to mouse events when the cursor is placed inside the active area.
Attributes | |
---|---|
state | the state(s) the button is in when the shape will be drawn, either Up, Over or Down. Active is used to denote when a shape defined the active area of a button. |
identifier | The identifier, in the range 1..65535, of the object that contains the definition of the shape that is drawn. |
layer | The layer number defines the order in which shapes are displayed. Shapes with a higher layer number are displayed in front of those on a lower layer. Complex buttons can be created by displaying more than one shape for a given button state. The layer number may be in the range 1..65535 - the range is determined by the size of the field when the value is encoded to a Flash file - however the vast majority of buttons will typically only use layer numbers less than 10. |
transform | an FSCoordTransform object that defines a coordinate transform that will be applied to the shape when it is displayed. The transform is most commonly used to offset shapes to create a 3-D appearance. The size may also be changed allowing a single shape definition to be used to display buttons in a range of sizes while still maintaining the same look and feel. |
colorTransform | an optional FSColorTransform object that can be used to change the shape's colour when it is drawn. |
An FSButton can define the appearance of the button for more than one state. Multiple states can be defined by bitwise Or-ing individual state codes together:
int buttonState = FSButton.Up | FSButton.Over;
The purpose of the layer attribute is to define the order in which shapes are displayed for a given button state. This is analogous to the layer number in the Flash Player's display list - specified using objects such as FSPlaceObject. When a button is displayed it is placed on a single layer in the display list and the layer numbers assigned to shapes in a FSButton object do not interfere with shapes assigned to the same layer in the display list.
The coordinate transform is used to change the appearance of the button without changing the original shape definitions. If it is omitted then a unity transform will be encoded which does not change the way the shape is drawn.
The FSButton class represents the ButtonRecord structure from the Macromedia Flash (SWF) File Format Specification. It was introduced in Flash 1.
Field Summary | |
---|---|
static int |
Active
Code for the active area of the button. |
static int |
Down
Code for the state of the button when the mouse is clicked the active area. |
static int |
Over
Code for the state of the button when the mouse is over the active area. |
static int |
Up
Code for the button in the up state. |
Constructor Summary | |
---|---|
FSButton(FSButton obj)
Constructs an FSButton object by copying values from an existing object. |
|
FSButton(FSCoder coder)
Construct an FSButton object, initalizing it with values decoded from an encoded object. |
|
FSButton(int aState,
int anIdentifier,
int aLayer)
Constructs an FSButton object without a coordinate or colour transform that will be applied to the shape drawn for the button states. |
|
FSButton(int aState,
int anIdentifier,
int aLayer,
FSCoordTransform aTransform)
Constructs an FSButton object with a coordinate transform that will be applied to the shape drawn for the button states. |
|
FSButton(int aState,
int anIdentifier,
int aLayer,
FSCoordTransform aTransform,
FSColorTransform aColorTransform)
Constructs an FSButton object with a coordinate and colour transform that will be applied to the shape drawn for the button states. |
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 will be applied to the button. |
int |
getIdentifier()
Gets the identifier of the shape that this FSButton applies to. |
int |
getLayer()
Gets the layer that the button will be displayed on. |
int |
getState()
Get the state(s) of the button when the shape is drawn. |
FSCoordTransform |
getTransform()
Gets the coordinate transform that will be applied to the button. |
boolean |
isActive()
Does the Button Record defines a shape for the button's active area. |
boolean |
isDown()
Does the Button Record define a shape for the button's 'down' state. |
boolean |
isOver()
Does the Button Record define a shape for the button's 'over' state. |
boolean |
isUp()
Does the Button Record define a shape for the button's 'up' state. |
int |
length(FSCoder coder)
|
void |
setColorTransform(FSColorTransform aTransform)
Sets the colour transform that will be applied to the shape to change it's colour. |
void |
setIdentifier(int anIdentifier)
Sets the identifier of the FSDefineShape, FSDefineShape2 or FSDefineShape3 object that defines the appearance of the button when it is in the specified state(s). |
void |
setLayer(int aNumber)
Sets the layer in the display list that the shape will be displayed on. |
void |
setState(int aNumber)
Set the state(s) of the button when the shape is drawn. |
void |
setTransform(FSCoordTransform aTransform)
Sets the coordinate transform that will be applied to the shape to change it's appearance. |
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 |
Field Detail |
---|
public static final int Up
public static final int Over
public static final int Down
public static final int Active
Constructor Detail |
---|
public FSButton(FSCoder coder)
coder
- an FSCoder containing the binary data.public FSButton(int aState, int anIdentifier, int aLayer)
aState
- the state of the button when the shape is drawn.anIdentifier
- the identifier of an FSDefineShape, FSDefineShape2 or
FSDefineShape3 object.aLayer
- the layer in the display list on which the shape is drawn.public FSButton(int aState, int anIdentifier, int aLayer, FSCoordTransform aTransform)
aState
- the state of the button when the shape is drawn.anIdentifier
- the identifier of an FSDefineShape, FSDefineShape2 or
FSDefineShape3 object.aLayer
- the layer in the display list on which the shape is drawn.aTransform
- an FSCoordTransform object that changes the appearance of the
shape when it is drawn.public FSButton(int aState, int anIdentifier, int aLayer, FSCoordTransform aTransform, FSColorTransform aColorTransform)
aState
- the state of the button when the shape is drawn.anIdentifier
- the identifier of an FSDefineShape, FSDefineShape2 or
FSDefineShape3 object.aLayer
- the layer in the display list on which the shape is drawn.aTransform
- an FSCoordTransform object that changes the appearance of the
shape when it is drawn.aColorTransform
- an FSColorTransform object that changes the colour of the
shape when it is drawn.public FSButton(FSButton obj)
obj
- an FSButton object.Method Detail |
---|
public int getState()
public boolean isActive()
public boolean isDown()
public boolean isOver()
public boolean isUp()
public int getIdentifier()
public int getLayer()
public FSCoordTransform getTransform()
public FSColorTransform getColorTransform()
public void setState(int aNumber)
aNumber
- the state of the button when the shape is drawn.public void setIdentifier(int anIdentifier)
anIdentifier
- the identifier of the shape object that defines the shape's
appearance.public void setLayer(int aNumber)
aNumber
- the number of the layer in the display list where the shape is
drawn.public void setTransform(FSCoordTransform aTransform)
aTransform
- an FSCoordTransform object that will be applied to the shape.public void setColorTransform(FSColorTransform aTransform)
aTransform
- an FSColorTransform object that will be applied to the shape.public java.lang.Object clone()
FSTransformObject
clone
in class FSTransformObject
public boolean equals(java.lang.Object anObject)
equals
in class FSTransformObject
public void appendDescription(java.lang.StringBuffer buffer, int depth)
FSTransformObject
appendDescription
in class FSTransformObject
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 FSTransformObject
public void encode(FSCoder coder)
encode
in class FSTransformObject
public void decode(FSCoder coder)
decode
in class FSTransformObject
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |