DragButton
| Kind of class: | class |
|---|---|
| Inherits from: | EventMovieClip < MovieClip |
| Known subclasses: | |
| Author: | Martijn de Visser, Arthur Clemens (refactoring) |
| Classpath: | org.asapframework.ui.buttons.DragButton |
| File last modified: | Monday, 09 October 2006, 00:41:07 |
A button that can be dragged around.
Assumes the presence of the following frame labels to represent states:
Assumes the presence of the following frame labels to represent states:
- 'normal'
- 'rollover'
- 'mousedown'
Events broadcasted to listeners:
- DragButtonEvent with type:
ON_MOVE- if sendMoveEvent == true- (null)
- DragButtonEvent with type:
ON_START- (null)
- DragButtonEvent with type:
ON_END- (null)
Summary
Constructor
Class properties
- DEFAULT_FRAME_NORMAL : String
- DEFAULT_FRAME_ROLLOVER : String
- DEFAULT_FRAME_MOUSEDOWN : String
Instance properties
- mDragging : Boolean
- mSendMoveEvent : Boolean
- mBounds : Rectangle
- mLastPos : Point
- mStartPos : Point
- mFrameNormal : String
- mFrameRollOver : String
- mFrameMouseDown : String
- distance : Point
- sendMoveEvent (inValue:Boolean)
- Set to true to receive move events (may be CPU intensive, false by default)
Instance properties inherited from EventMovieClip
Instance methods
Event handlers
- onClipDragging : Void
- Override in subclasses; if you need actions to be taken when the clip is being dragged, implement additional functionality in an overriding method.
- onUpdatePosition : Void
- onPress : Void
- onDragEnd : Void
- onMouseUp : Void
- onRollOver : Void
- onRollOut : Void
- onRelease : Void
- onReleaseOutside : Void
Constructor
DragButton
function DragButton (
)
Class properties
DEFAULT_FRAME_MOUSEDOWN
static private DEFAULT_FRAME_MOUSEDOWN:String = "mousedown"
(read)
DEFAULT_FRAME_NORMAL
static private DEFAULT_FRAME_NORMAL:String = "normal"
(read)
DEFAULT_FRAME_ROLLOVER
static private DEFAULT_FRAME_ROLLOVER:String = "rollover"
(read)
Instance properties
distance
mBounds
mDragging
private mDragging:Boolean = false
(read)
mFrameMouseDown
private mFrameMouseDown:String = DEFAULT_FRAME_MOUSEDOWN
(read)
mFrameNormal
private mFrameNormal:String = DEFAULT_FRAME_NORMAL
(read)
mFrameRollOver
private mFrameRollOver:String = DEFAULT_FRAME_ROLLOVER
(read)
mLastPos
mSendMoveEvent
private mSendMoveEvent:Boolean = false
(read)
mStartPos
sendMoveEvent
sendMoveEvent
(write)
Set to true to receive move events (may be CPU intensive, false by default)
Instance methods
getBounds
Returns:
- The bounding rectangle (in pixels) in which the MovieClip may move.
setBounds
Sets the bounding rectangle (in pixels) in which the MovieClip may move. Pass a Rectangle with a height of 1 to create a horizontal-only draggable clip.
Parameters:
inBounds:
the constraining rectangle in pixels
Event handlers
onClipDragging
function onClipDragging (
) : Void
Override in subclasses; if you need actions to be taken when the clip is being dragged, implement additional functionality in an overriding method. Performance may be a point as this function is called while the clip moves on each onEnterFrame event.
onDragEnd
function onDragEnd (
) : Void
Events broadcasted to listeners:
- DragButtonEvent with type:
ON_END- (null)
onMouseUp
function onMouseUp (
) : Void
onPress
function onPress (
) : Void
Events broadcasted to listeners:
- DragButtonEvent with type:
ON_START- (null)
onRelease
function onRelease (
) : Void
onReleaseOutside
function onReleaseOutside (
) : Void
onRollOut
function onRollOut (
) : Void
onRollOver
function onRollOver (
) : Void
onUpdatePosition
private function onUpdatePosition (
) : Void
Events broadcasted to listeners:
- DragButtonEvent with type:
ON_MOVE- if sendMoveEvent == true- (null)