|
|||||||||
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.FSMovieObject
com.flagstone.transform.FSDefineObject
com.flagstone.transform.FSDefineButton2
public class FSDefineButton2
FSDefineButton2 defines the appearance and actions of push and menu buttons.
It provides a more sophisticated model for creating buttons:
Push and Menu buttons behave slightly differently in tracking mouse movements when the button is clicked. A Push button 'captures' the mouse so if the cursor is dragged outside of the active area of the button and the mouse click is released then the Release Outside event is still sent to the button. A Menu button does not 'capture' the mouse so if the cursor is dragged out of the active area the button returns to its 'inactive' state.
Attributes | |
---|---|
type | Identifies the data structure when it is encoded. Read-only. |
identifier | An unique identifier for this object in the range 1..65535. |
buttonType | Whether the button is a Push button or a Menu button. |
buttonRecords | An array of FSButton objects that describe the appearance of the button in each of its states. |
buttonEvents | An array of FSButtonEvent objects that define the actions that are executed for each type of button event. |
encodedEvents | An array of bytes containing encoded button events can also be set. The encoded objects are typically generated by the parser in the Translate framework. The buttonEvents array and encodedEvents cannot both be valid at the same time. Accessor methods used to set either of the attributes will set the other to null. |
An FSDefineButton2 object must contain at least one FSButton object. If more than one button record is defined for a given button state then each shape will be displayed by the button. The order in which the shapes are displayed is determined by the layer assigned to each button record.
Each FSButton object can contain an FSColorTransform object which can be used to change the colour of the shape being displayed without changing the original definition.
Actions do not need to be specified for every button event. Indeed actions do not need to be specified at all.
FSDefineShape upShape = new FSDefineShape(movie.newIdentifier(), bounds, fillStyles, lineStyles, shape1); FSDefineShape overShape = new FSDefineShape(movie.newIdentifier(), bounds, fillStyles, lineStyles, shape2); FSDefineShape downShape = new FSDefineShape(movie.newIdentifier(), bounds, fillStyles, lineStyles, shape3); ArrayList records = new ArrayList(); ArrayList events = new ArrayList(); records.add(FSButtonRecord(FSButton.Up, upShape.getIdentifier(), 1)); records.add(FSButtonRecord(FSButton.Over, overShape.getIdentifier(), 2)); records.add(FSButtonRecord(FSButton.Down, downShape.getIdentifier(), 3)); ArrayList actions = new ArrayList(); actions.add(action); actions.add(action); actions.add(action); events.add(FSButtonEvent(FSButtonEvent.Press, actions)); FSDefineButton2 button = new FSDefineButton2(movie.newIdentifier(), FSDefineButton2.Push, records, events);
The FSDefineButton2 class represents the DefineButton2 structure from the Macromedia Flash (SWF) File Format Specification. It was introduced in Flash 3.
Field Summary | |
---|---|
static int |
Menu
Defines whether a FSDefineButton2 object is configured as a menu button. |
static int |
Push
Defines whether a FSDefineButton2 object is configured as a momentary, push button. |
Fields inherited from class com.flagstone.transform.FSDefineObject |
---|
identifier |
Constructor Summary | |
---|---|
FSDefineButton2(FSCoder coder)
Construct an FSDefineButton2 object, initialising it with values decoded from an encoded object. |
|
FSDefineButton2(FSDefineButton2 obj)
Constructs an FSDefineButton2 object by copying values from an existing object. |
|
FSDefineButton2(int anIdentifier,
int buttonType,
java.util.ArrayList buttonRecordArray,
java.util.ArrayList buttonEventArray)
Constructs an FSDefineButton object, specifying the unique identifier, the type of button to be created, the button records that describe the button's appearance and the actions that are performed in response to each button event. |
|
FSDefineButton2(int anIdentifier,
int buttonType,
java.util.ArrayList buttonRecordArray,
byte[] bytes)
Constructs an FSDefineButton object, specifying the unique identifier, the type of button to be created, the button records that describe the button's appearance and the encoded actions that are performed in response to each button event. |
Method Summary | |
---|---|
void |
add(FSButton aButton)
Adds an FSButton to the array of button records. |
void |
add(FSButtonEvent aButtonEvent)
Adds a button event object to the array of button events. |
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. |
java.util.ArrayList |
getButtonEvents()
Gets the array of button records defined for this button. |
java.util.ArrayList |
getButtonRecords()
Gets the array of button records defined for this button. |
int |
getButtonType()
Gets the button type - push or menu. |
int |
length(FSCoder coder)
|
void |
setButtonEvents(java.util.ArrayList anArray)
Sets the array of button events defined for this button. |
void |
setButtonRecords(java.util.ArrayList anArray)
Sets the array of button records defined for this button. |
void |
setButtonType(int aType)
Sets the button type. |
void |
setEncodedEvents(byte[] bytes)
Set the encoded button event objects generated by the classes in the Translate framework. |
Methods inherited from class com.flagstone.transform.FSDefineObject |
---|
getIdentifier, setIdentifier |
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 |
Field Detail |
---|
public static final int Push
public static final int Menu
Constructor Detail |
---|
public FSDefineButton2(FSCoder coder)
coder
- an FSCoder containing the binary data.public FSDefineButton2(int anIdentifier, int buttonType, java.util.ArrayList buttonRecordArray, java.util.ArrayList buttonEventArray)
anIdentifier
- a unique identifier for this button.buttonType
- the type of button - push or menu.buttonRecordArray
- an array of FSButton objects.buttonEventArray
- an array of FSButtonEvent objects.public FSDefineButton2(int anIdentifier, int buttonType, java.util.ArrayList buttonRecordArray, byte[] bytes)
anIdentifier
- a unique identifier for this button.buttonType
- the type of button - push or menu.buttonRecordArray
- an array of FSButton objects.bytes
- an array containing the encoded FSButtonEvent objects.public FSDefineButton2(FSDefineButton2 obj)
obj
- an FSDefineButton2 object.Method Detail |
---|
public void add(FSButton aButton)
aButton
- a button record.public void add(FSButtonEvent aButtonEvent)
aButtonEvent
- a button event.public int getButtonType()
public java.util.ArrayList getButtonRecords()
public java.util.ArrayList getButtonEvents()
public void setButtonType(int aType)
aType
- the type of button - push or menu.public void setButtonRecords(java.util.ArrayList anArray)
anArray
- an array of FSButtonRecord objects.public void setButtonEvents(java.util.ArrayList anArray)
anArray
- and array of FSButtonEvent objects.public void setEncodedEvents(byte[] bytes)
bytes
- the array of encoded button events.public java.lang.Object clone()
FSTransformObject
clone
in class FSTransformObject
public boolean equals(java.lang.Object anObject)
FSMovieObject
equals
in class FSMovieObject
public void appendDescription(java.lang.StringBuffer buffer, int depth)
FSTransformObject
appendDescription
in class FSDefineObject
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 FSDefineObject
public void encode(FSCoder coder)
encode
in class FSDefineObject
public void decode(FSCoder coder)
decode
in class FSDefineObject
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |