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:
  • 'normal'
  • 'rollover'
  • 'mousedown'
Events broadcasted to listeners:

Summary


Constructor
Instance properties
Instance methods
Event handlers

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

distance:Point
(read)

mBounds

private mBounds:Rectangle
(read)

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

private mLastPos:Point
(read)

mSendMoveEvent

private mSendMoveEvent:Boolean = false
(read)

mStartPos

private mStartPos:Point
(read)

sendMoveEvent

sendMoveEvent
(write)

Set to true to receive move events (may be CPU intensive, false by default)

Instance methods

getBounds

function getBounds (

Returns:
  • The bounding rectangle (in pixels) in which the MovieClip may move.

setBounds

function setBounds (
inBounds:Rectangle) : Void

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:

onMouseUp

function onMouseUp (
) : Void

onPress

function onPress (
) : Void

Events broadcasted to listeners:

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: