Constructors

Properties

Methods

SliderUI class

SliderUI

 

 

 

Overview

Author

Matt Przybylski [http://www.reintroducing.com]

Version

1.0

Description

The SliderUI is a class that allows you to quickly create sliders with tracks without the need to use components. There is a "percent" and a "currentValue" property that you can tap into to see what position the slider is at on the track. Please note that if you are using the SliderUI on the "y" axis your track's registration point needs to be on the bottom (NOT the top) and the slider will go up to raise the value and down to lower it. If you do not pay attention to this your slider will be "broken".

Constructors

 

SliderUI

Usage

public function SliderUI($stage:Stage, $axis:String, $track:Sprite, $slider:Sprite, $lowVal:Number, $highVal:Number, $startVal:Number = 0):void

Description

Creates an instance of the SliderUI with the given parameters. If the $startVal parameter is set to something higher than the $highVal or lower than the $lowVal parameter, the $startVal parameter is reset to one of those two values.

Parameters

$stage
The stage that the track and slider are sitting on
$axis
The axis that the slider will be used on
$track
The track to be used for the slider
$slider
The object that will function as the slider
$lowVal
A number representing the low value of the slider
$highVal
A number representing the high value of the slider
$startVal
A number representing the value the slider should start at (default: 0)

Properties

 

percent

Usage

public function get percent():Number

Description

Returns the percentage of the slider's position on the track, between 0 and 1.
 

currentValue

Usage

public function get currentValue():Number

Description

Returns the current value of the slider's position on the track.

Methods

 

initEvents

Usage

private function initEvents():void

Description

Initializes the slider and timer events.

Returns

Nothing
 

enable

Usage

public function enable():void

Description

Enables the controls of the SliderUI.

Returns

void
 

disable

Usage

public function disable():void

Description

Disables the controls of the SliderUI.

Returns

void
 

destroy

Usage

public function destroy():void

Description

Cleans up the SliderUI for garbage collection.

Returns

void
 

handleMouseDown

Usage

private function handleMouseDown($evt:MouseEvent):void

Description

Starts the dragging of the slider and starts the timer to dispatch percentage.

Returns

Nothing
 

handleMouseUp

Usage

private function handleMouseUp($evt:MouseEvent):void

Description

Stops the slider dragging and timer.

Returns

Nothing
 

updateInfo

Usage

private function updateInfo($evt:TimerEvent):void

Description

Updates the info of the slider's position.

Returns

Nothing