|
|||||||||
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.FSButtonEvent
public class FSButtonEvent
FSButtonEvent is used to define the actions that a button will execute in response to a particular event.
The events that a button responds to are:
RollOver | occurs when the mouse cursor moves over the active area of a button. |
RollOut | occurs when the mouse cursor moves out of the active area of a button. |
Press | occurs when the mouse button is clicked while the mouse cursor is over the active area of the button. |
Release | occurs when the mouse button is clicked and released while the mouse cursor is over the active area of the button. |
DragOut | occurs when the mouse button is clicked and the mouse cursor is dragged out of the active area of the button. |
DragOver | occurs when the mouse button is clicked, the mouse cursor is dragged into the active area of the button and the mouse button is released. |
When a button is configured as a menu item (FSDefineButton2 objects only) then three additional events can occur:
MenuDragOver | occurs when the mouse button is clicked and the mouse cursor is dragged into the active area of the menu item. |
MenuDragOut | occurs when the mouse button is clicked and the mouse cursor is dragged out of the active area of the menu item. |
ReleaseOut | occurs when the mouse button is clicked and the mouse cursor is dragged into the active area of the menu item. |
In addition to responding to mouse events, buttons also respond to keys being pressed on the keyboard. Keyboard events are defined by the character key being pressed, e.g. "t", "T", "$", etc. For control keys a number of reserved names are supported:
<Left> | Left arrow key. |
<Right> | Right arrow key. |
<Home> | Home key. |
<End> | End key |
<Insert> | Insert key. |
<Delete> | Delete key. |
<Backspace> | Backspace key. |
<Enter> | Enter (return) key. |
<Up> | Up arrow key. |
<Down> | Down arrow key. |
<Pageup> | Page up key. |
<Pagedown> | Page down key. |
<Tab> | Tab key. |
<Escape> | Escape key. |
<Space> | Space bar. |
Since the event code allows multiple events, the code for compound events can be created by performing a bit-wise Or of the individual codes:
int eventCode = FSButtonEvent.RollOver | FSButtonEvent.Press;";
The class method codeForKey returns the event code that identifies when a specific key is pressed:
int eventCode = FSButtonEvent.codeForKey('J');
Control keys are identified using one of the reserved ButtonEvent values:
int eventCode = FSButtonEvent.Enter | FSButtonEvent.PageUp;
However while multiple mouse events can be defined for a button only one keyboard event can be defined.
Attributes | |
---|---|
event | a code identifying the different types of button events that the actions defined in this object will be executed in response to. |
actions | An array of action objects that are executed when the events defined in the event code occur. |
encodedActions | An array of bytes containing encoded actions can also be set. The encoded actions are typically generated by the parser in the Translate framework. The actions array and encodedActions cannot both be valid at the same time. Accessor methods used to set either of the attributes will set the other to null. |
The FSButtonEvent class represents the ButtonCondAction data structure from the Macromedia Flash (SWF) File Format Specification. It was introduced in Flash 3.
Field Summary | |
---|---|
static int |
Backspace
Defines the button event that occurs when the backspace key is pressed on the keyboard. |
static int |
Delete
Defines the button event that occurs when the delete key is pressed on the keyboard. |
static int |
Down
Defines the button event that occurs when the down arrow key is pressed on the keyboard. |
static int |
DragOut
Defines the button event that occurs when the mouse button is clicked and the mouse cursor is dragged out of the active area of the button. |
static int |
DragOver
Defines the button event that occurs when the mouse button is clicked and the mouse cursor is dragged into the active area of the button. |
static int |
End
Defines the button event that occurs when the end key is pressed on the keyboard. |
static int |
Enter
Defines the button event that occurs when the enter key is pressed on the keyboard. |
static int |
Escape
Defines the button event that occurs when the escape key is pressed on the keyboard. |
static int |
Home
Defines the button event that occurs when the home key is pressed on the keyboard. |
static int |
Insert
Defines the button event that occurs when the insert key is pressed on the keyboard. |
static int |
Left
Defines the button event that occurs when the left arrow key is pressed on the keyboard. |
static int |
MenuDragOut
Defines the button event that occurs when the mouse button is clicked and the mouse cursor is dragged out of the active area of the menu item. |
static int |
MenuDragOver
Defines the button event that occurs when the mouse button is clicked and the mouse cursor is dragged into the active area of the menu item. |
static int |
Pagedown
Defines the button event that occurs when the page down key is pressed on the keyboard. |
static int |
Pageup
Defines the button event that occurs when the page up key is pressed on the keyboard. |
static int |
Press
Defines the button event that occurs when the mouse button is clicked while the mouse cursor is over the active area of the button. |
static int |
Release
Defines the button event that occurs when the mouse button is clicked and released while the mouse cursor is over the active area of the button. |
static int |
ReleaseOut
Defines the button event that occurs when the mouse button is clicked, the mouse cursor is dragged into the active area of the button and the mouse button is released. |
static int |
Right
Defines the button event that occurs when the right arrow key is pressed on the keyboard. |
static int |
RollOut
Defines the button event that occurs when the mouse cursor moves out of the active area of a button. |
static int |
RollOver
Defines the button event that occurs when the mouse cursor moves over the active area of a button. |
static int |
Space
Defines the button event that occurs when the space bar is pressed on the keyboard. |
static int |
Tab
Defines the button event that occurs when the tab key is pressed on the keyboard. |
static int |
Up
Defines the button event that occurs when the up arrow key is pressed on the keyboard. |
Constructor Summary | |
---|---|
FSButtonEvent(FSButtonEvent obj)
Constructs an FSButtonEvent object by copying values from an existing object. |
|
FSButtonEvent(FSCoder coder,
int len)
Construct an FSButtonEvent object, initialising it with values decoded from an encoded object. |
|
FSButtonEvent(int aNumber,
java.util.ArrayList anArray)
Constructs an FSButtonEvent object that defines the array of actions that will be executed when a particular event occurs. |
|
FSButtonEvent(int aNumber,
byte[] bytes)
Constructs an FSButtonEvent object that defines the array of actions that will be executed when a particular event occurs. |
Method Summary | |
---|---|
void |
add(FSActionObject anAction)
Add an action to the end of the actions array. |
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. |
static int |
codeForKey(char c)
Generates the code identifying a particular event using the name of the event. |
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 |
getActions()
Gets the array of actions that are executed by the button in response to specified event(s). |
byte[] |
getEncodedActions()
Get the array of encoded actions that are executed when the frame is displayed. |
int |
getEvent()
Gets the event code that this FSButtonEvent defines actions for. |
int |
length(FSCoder coder)
|
void |
setActions(java.util.ArrayList anArray)
Sets the array of actions that are executed by the button in response to specified event(s). |
void |
setEncodedActions(byte[] bytes)
Set the array of encoded actions generated by the classes in the Translate framework. |
void |
setEvent(int aNumber)
Sets the event code that this FSButtonEvent defines actions for. |
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 RollOver
public static final int RollOut
public static final int Press
public static final int Release
public static final int DragOut
public static final int DragOver
public static final int ReleaseOut
public static final int MenuDragOver
public static final int MenuDragOut
public static final int Left
public static final int Right
public static final int Home
public static final int End
public static final int Insert
public static final int Delete
public static final int Backspace
public static final int Enter
public static final int Up
public static final int Down
public static final int Pageup
public static final int Pagedown
public static final int Tab
public static final int Escape
public static final int Space
Constructor Detail |
---|
public FSButtonEvent(FSCoder coder, int len)
coder
- an FSCoder containing the binary data.public FSButtonEvent(int aNumber, java.util.ArrayList anArray)
aNumber
- the event code.anArray
- the array of action objects that will be executed when the
specified event(s) occur.public FSButtonEvent(int aNumber, byte[] bytes)
aNumber
- the event code.bytes
- an array of encoded action objects.public FSButtonEvent(FSButtonEvent obj)
obj
- an FSButtonEvent object.Method Detail |
---|
public static int codeForKey(char c)
c
- a keyboard character.
public void add(FSActionObject anAction)
anAction
- an object derived from the base class FSActionObject.public int getEvent()
public java.util.ArrayList getActions()
public byte[] getEncodedActions()
public void setEvent(int aNumber)
aNumber
- the event code.public void setActions(java.util.ArrayList anArray)
anArray
- the array of action objects that will be executed when the
specified event(s) occur.public void setEncodedActions(byte[] bytes)
bytes
- the array of encoded actions.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 |