|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.flagstone.transform.button.DefineButton2
public final class DefineButton2
DefineButton2 defines the appearance and actions of push and menu buttons.
It provides a more sophisticated model for creating buttons than
DefineButton
:
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.
A DefineButton2 object must contain at least one ButtonShape. If more than one button shape 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.
ButtonShape
,
EventHandler
Constructor Summary | |
---|---|
DefineButton2(DefineButton2 object)
Creates and initialises a DefineButton2 object using the values copied from another DefineButton2 object. |
|
DefineButton2(int uid,
ButtonType buttonType,
List<ButtonShape> buttonShapes,
List<EventHandler> handlers)
Creates a DefineButton2 object, specifying the unique identifier, the type of button to be created, the button shapes that describe the button's appearance and the actions that are performed in response to each button event. |
|
DefineButton2(SWFDecoder coder,
Context context)
Creates and initialises a DefineButton2 object using values encoded in the Flash binary format. |
Method Summary | |
---|---|
DefineButton2 |
add(ButtonShape obj)
Adds an ButtonShape to the list of button records. |
DefineButton2 |
add(EventHandler obj)
Adds a button event object to the list of button events. |
DefineButton2 |
copy()
Creates a complete copy of this object. |
void |
encode(SWFEncoder coder,
Context context)
Encode an object to the Flash binary format. |
List<EventHandler> |
getEvents()
Get the list of event handlers defined for this button. |
int |
getIdentifier()
Get the unique identifier assigned to this object. |
List<ButtonShape> |
getShapes()
Get the list of button records defined for this button. |
ButtonType |
getType()
Get the button type - either PUSH or MENU. |
int |
prepareToEncode(Context context)
Prepare an object for encoding, returning the expected size of an object when it is encoded. |
void |
setEvents(List<EventHandler> list)
Sets the list of button events defined for this button. |
void |
setIdentifier(int uid)
Sets the unique identifier for an object within a given Movie. |
void |
setShapes(List<ButtonShape> list)
Sets the list of button shapes defined for this button. |
void |
setType(ButtonType buttonType)
Sets whether the button is a menu button or a push button. |
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public DefineButton2(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 DefineButton2(int uid, ButtonType buttonType, List<ButtonShape> buttonShapes, List<EventHandler> handlers)
uid
- a unique identifier for this button. Must be in the range
1..65535.buttonType
- the button is a menu button (true) or push button (false).buttonShapes
- a list of Button objects. Must not be null.handlers
- a list of ButtonEvent objects. Must not be null.public DefineButton2(DefineButton2 object)
object
- a DefineButton2 object from which the values will be
copied.Method Detail |
---|
public int getIdentifier()
getIdentifier
in interface DefineTag
public void setIdentifier(int uid)
setIdentifier
in interface DefineTag
uid
- a unique identifier for the object. Must be in the range
1..65535.public DefineButton2 add(ButtonShape obj)
obj
- a button shape object. Must not be null.
public DefineButton2 add(EventHandler obj)
obj
- a button event. Must not be null.
public ButtonType getType()
public List<ButtonShape> getShapes()
public List<EventHandler> getEvents()
public void setType(ButtonType buttonType)
buttonType
- the type of button, either ButtonType.MENU or ButtonType.PUSH.public void setShapes(List<ButtonShape> list)
list
- a list of ButtonShape objects. Must not be null.public void setEvents(List<EventHandler> list)
list
- a list of ButtonEvent objects. Must not be null.public DefineButton2 copy()
copy
in interface Copyable<MovieTag>
public String toString()
toString
in class Object
public int prepareToEncode(Context context)
prepareToEncode
in interface SWFEncodeable
context
- 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 SWFEncodeable
coder
- 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 |