Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.flagstone.transform
Class FSButtonEvent

    java.lang.Object
      com.flagstone.transform.FSTransformObject
          com.flagstone.transform.FSButtonEvent

All Implemented Interfaces:
  java.lang.Cloneable

    public class FSButtonEvent

extends FSTransformObject

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.

# History

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

### RollOver

    public static final int RollOver

  Defines the button event that occurs when the mouse cursor moves over the active area of a button.

  See Also:
    Constant Field Values

### RollOut

    public static final int RollOut

  Defines the button event that occurs when the mouse cursor moves out of the active area of a button.

  See Also:
    Constant Field Values

### Press

    public static final 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.

  See Also:
    Constant Field Values

### Release

    public static final 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.

  See Also:
    Constant Field Values

### DragOut

    public static final 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.

  See Also:
    Constant Field Values

### DragOver

    public static final 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.

  See Also:
    Constant Field Values

### ReleaseOut

    public static final 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.

  See Also:
    Constant Field Values

### MenuDragOver

    public static final 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.

  See Also:
    Constant Field Values

### MenuDragOut

    public static final 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.

  See Also:
    Constant Field Values

### Left

    public static final int Left

  Defines the button event that occurs when the left arrow key is pressed on the keyboard.

  See Also:
    Constant Field Values

### Right

    public static final int Right

  Defines the button event that occurs when the right arrow key is pressed on the keyboard.

  See Also:
    Constant Field Values

### Home

    public static final int Home

  Defines the button event that occurs when the home key is pressed on the keyboard.

  See Also:
    Constant Field Values

### End

    public static final int End

  Defines the button event that occurs when the end key is pressed on the keyboard.

  See Also:
    Constant Field Values

### Insert

    public static final int Insert

  Defines the button event that occurs when the insert key is pressed on the keyboard.

  See Also:
    Constant Field Values

### Delete

    public static final int Delete

  Defines the button event that occurs when the delete key is pressed on the keyboard.

  See Also:
    Constant Field Values

### Backspace

    public static final int Backspace

  Defines the button event that occurs when the backspace key is pressed on the keyboard.

  See Also:
    Constant Field Values

### Enter

    public static final int Enter

  Defines the button event that occurs when the enter key is pressed on the keyboard.

  See Also:
    Constant Field Values

### Up

    public static final int Up

  Defines the button event that occurs when the up arrow key is pressed on the keyboard.

  See Also:
    Constant Field Values

### Down

    public static final int Down

  Defines the button event that occurs when the down arrow key is pressed on the keyboard.

  See Also:
    Constant Field Values

### Pageup

    public static final int Pageup

  Defines the button event that occurs when the page up key is pressed on the keyboard.

  See Also:
    Constant Field Values

### Pagedown

    public static final int Pagedown

  Defines the button event that occurs when the page down key is pressed on the keyboard.

  See Also:
    Constant Field Values

### Tab

    public static final int Tab

  Defines the button event that occurs when the tab key is pressed on the keyboard.

  See Also:
    Constant Field Values

### Escape

    public static final int Escape

  Defines the button event that occurs when the escape key is pressed on the keyboard.

  See Also:
    Constant Field Values

### Space

    public static final int Space

  Defines the button event that occurs when the space bar is pressed on the keyboard.

  See Also:
    Constant Field Values

Constructor Detail

### FSButtonEvent

    public FSButtonEvent(FSCoder coder,
                         int len)

  Construct an FSButtonEvent object, initialising it with values decoded from an encoded object.

  Parameters:
    `coder` - an FSCoder containing the binary data.

### FSButtonEvent

    public 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.

  Parameters:
    `aNumber` - the event code.
    `anArray` - the array of action objects that will be executed when the specified event(s) occur.

### FSButtonEvent

    public FSButtonEvent(int aNumber,
                         byte[] bytes)

  Constructs an FSButtonEvent object that defines the array of actions that will be executed when a particular event occurs.

  Parameters:
    `aNumber` - the event code.
    `bytes` - an array of encoded action objects.

### FSButtonEvent

    public FSButtonEvent(FSButtonEvent obj)

  Constructs an FSButtonEvent object by copying values from an existing object.

  Parameters:
    `obj` - an FSButtonEvent object.

Method Detail

### codeForKey

    public static int codeForKey(char c)

  Generates the code identifying a particular event using the name of the event.

  Parameters:
    `c` - a keyboard character.
  Returns:
    the event code corresponding to the specified event.

### add

    public void add(FSActionObject anAction)

  Add an action to the end of the actions array.

  Parameters:
    `anAction` - an object derived from the base class FSActionObject.

### getEvent

    public int getEvent()

  Gets the event code that this FSButtonEvent defines actions for.

  Returns:
    the compound event code.

### getActions

    public java.util.ArrayList getActions()

  Gets the array of actions that are executed by the button in response to specified event(s).

  Returns:
    the array of action objects that will be executed when the specified event(s) occur.

### getEncodedActions

    public byte[] getEncodedActions()

  Get the array of encoded actions that are executed when the frame is displayed.

  Returns:
    the array of action objects or null if the actions have been decoded.

### setEvent

    public void setEvent(int aNumber)

  Sets the event code that this FSButtonEvent defines actions for.

  Parameters:
    `aNumber` - the event code.

### setActions

    public void setActions(java.util.ArrayList anArray)

  Sets the array of actions that are executed by the button in response to specified event(s).

  Parameters:
    `anArray` - the array of action objects that will be executed when the specified event(s) occur.

### setEncodedActions

    public void setEncodedActions(byte[] bytes)

  Set the array of encoded actions generated by the classes in the Translate framework. If the object already contains an array of actions then they will be deleted.

  Parameters:
    `bytes` - the array of encoded actions.

### clone

    public java.lang.Object clone()

  Description copied from class: `FSTransformObject`
  Creates a deep copy of the entire object.

  Overrides:
    `clone` in class `FSTransformObject`
  Returns:
    a copy of the object.

### equals

    public boolean equals(java.lang.Object anObject)

  Returns true if anObject is equal to this one. Objects are considered equal if they would generate identical binary data when they are encoded to a Flash file.

  Overrides:
    `equals` in class `FSTransformObject`
  Returns:
    true if this object would be identical to anObject when encoded.

### appendDescription

    public void appendDescription(java.lang.StringBuffer buffer,
                                  int depth)

  Description copied from class: `FSTransformObject`
  AppendDescription is used to present a string description of the object including all nested objects up to a specified depth. This method provide a more controlled way of creating a string representation of an object since large objects such as font or shape definitions can contain dozens of nested objects. The representation of the object is appended to the StringBuffer, showing the name of the class and values of the attributes it contains. If the object contains any attributes that are objects then the object graph will be traversed up to the specified depth. If objects are nested at a level less than specified depth then the full string representation of the object is displayed. For objects at the specified depth only the name of the class is displayed. Any objects below this depth are not displayed.

  Specified by:
    `appendDescription` in class `FSTransformObject`
  Parameters:
    `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.

### length

    public int length(FSCoder coder)

  Specified by:
    `length` in class `FSTransformObject`

### encode

    public void encode(FSCoder coder)

  Specified by:
    `encode` in class `FSTransformObject`

### decode

    public void decode(FSCoder coder)

  Specified by:
    `decode` in class `FSTransformObject`

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD