qnx.fuse.ui.slider.Slider

Slider

Properties | Methods | Events | Constants | Examples


Packageqnx.fuse.ui.slider
Classpublic class Slider
InheritanceSlider Inheritance SliderBase Inheritance UIComponent Inheritance flash.display.MovieClip
Subclasses MediaSlider, VolumeSlider

The Slider class contains the functionality for a basic Slider implementation. The slider component allows a user to select a value (by dragging the thumb component along a track) between the specified minimum and maximum values:

A slider component.

The following example instantiates and initializes a new slider component called mySlider:

mySlider =  new Slider();
mySlider.setPosition(300, 300);
mySlider.minimum = 0;
mySlider.maximum = 100;
mySlider.value = 50;
mySlider.width = 250;
// listen to the when the slider moves
mySlider.addEventListener( SliderEvent.MOVE, sliderChange );            
this.addChild( mySlider );
     

The horizontal slider has a minimum value of 0, and a maximum value of 100. The following function, which is called by the event listener updates the value (level) of the slider every time the user moves the slider thumb:

private function sliderChange( event:SliderEvent ) : void
{
    var newlevel:int = Math.round( slider.value );
    trace( "slider value =", newlevel );
}
     


Class information:
BlackBerry 10 Version:   10.0.0
Found in:  qnxui.swc

View the examples



Public Properties

 PropertyDefined By
  active : Boolean
Gets or sets a value that determines whether the control is active and enabled.
Slider
  animateToValue : Boolean
When set to true, the Slider will animate when setting the value property on the Slider.
Slider
 InheritedcontextActions : Vector.<ActionSet>
Gets or Sets a Vector of ActionSet objects.
UIComponent
 InheritedcontextMultiSelectText : String
Gets or Sets a String to be displayed when showing the Multi Select Context Menu.
UIComponent
 InheritedcurrentTheme : String
[read-only] Returns the current theme this component is styled with.
UIComponent
 InheriteddoubleClickIncrement : Number
Specifies a percentage between 0.0 and 1.0 that the slider should move when double clicked.
SliderBase
 InheritedexplicitHeight : Number
[read-only] Returns the explicit height (actual height, in pixels) of the UI component.
UIComponent
 InheritedexplicitWidth : Number
[read-only] Returns the explicit width (actual width, in pixels) of the UI component.
UIComponent
 Inheritedid : String
The id is a name for the component that can be used in CSS using the # selector.
UIComponent
 InheritedincludeInLayout : Boolean
Specifies whether or not the component should be included in its parent container's layout.
UIComponent
 InheritedlayoutData : Object
Gets or sets the layoutData.
UIComponent
 Inheritedlocale : String
Gets or sets the current locale of the component.
UIComponent
  maximum : Number
Gets or sets the maximum value of the slider.
Slider
 InheritedminHeight : Number
Gets or sets the minimum preferred height of the control.
UIComponent
  minimum : Number
Gets or sets the minimum value of the slider.
Slider
 InheritedminWidth : Number
Gets or sets the minimum preferred width of the control.
UIComponent
 InheritedstyleChildren : Boolean
Allows you to style the children of this component with CSS.
UIComponent
  value : Number
Gets or sets the current value of the slider.
Slider

Protected Properties

 PropertyDefined By
 InheritedaccessibilityImplimentationClass : Class
UIComponent
  cssID : String
[override] [read-only] Returns the CSS ID of the component.
Slider
 InheritedexplicitLocale : Boolean
Set to true when the locale property has been set externally.
UIComponent
 InheritedinternalID : String
The Component's Id used for styling.
UIComponent
 InheritedlongPressEnabled : Boolean
Specifies whether the UIComponent can detect a long press.
UIComponent

Public Methods

 MethodDefined By
  
Creates a Slider instance.
Slider
 Inherited
Cancels a long press from occuring on the component.
UIComponent
 Inherited
childChanged(resizedChild:DisplayObject = null):Boolean
Notifies the UIComponent that one or more of its children has changed in a manner that may affect this object's layout.
UIComponent
 Inherited
destroy():void
Call this method when you want to have your object collected by the garbage collector.
UIComponent
 Inherited
Returns the CSS selector for the object, composing it from its position in the display hierarchy and an optional ID selector.
UIComponent
 Inherited
Returns the size options for the given control.
UIComponent
 Inherited
Calling this method results in a call to the components validateDisplayList() method before the display list is rendered.
UIComponent
 Inherited
Calling this method results in a call to the components validateProperties() method before the display list is rendered.
UIComponent
 Inherited
measure(availableWidth:Number, availableHeight:Number):LayoutMeasurement
This method calls doMeasure() in order to calculate the preferred size of the control.
UIComponent
 Inherited
setActualSize(w:Number, h:Number):void
Sets the width and height of the object without setting the explicitWidth and explicitHeight.
UIComponent
 Inherited
setFillSkin(skin:Object):void
Sets the fill skin for the slider.
SliderBase
 Inherited
setLayoutBounds(bounds:Rectangle):void
Sets the receiver's size and location to the rectangular area specified by the arguments.
UIComponent
 Inherited
setPosition(x:Number, y:Number):void
Sets the x and y position of the component.
UIComponent
 Inherited
setThumbSkin(skin:Object):void
Sets the skin for the slider thumb button.
SliderBase
 Inherited
setTrackSkin(skin:Object):void
Sets the skin for the track of the slider.
SliderBase
 Inherited
updateDefaultLocale(updateChildren:Boolean = true):void
Updates the locale property to be the same as the locale of the device.
UIComponent
 Inherited
Lets a component that contains text know that it should update its font formats as the font settings have changed.
UIComponent
 Inherited
Validates the display list of the component by calling the updateDisplayList().
UIComponent
 Inherited
Validates the component immediately by calling validateProperties(), validateSizes(), and validateDisplayList() if necessary.
UIComponent
 Inherited
Validates the properties of the component by calling the commitProperties() method.
UIComponent

Protected Methods

 MethodDefined By
 Inherited
Adds the listeners for actually dragging and for when dragging is to stop.
SliderBase
 Inherited
Adds the listeners responsible for starting to Drag the Thumb or Drag along the Track.
SliderBase
 Inherited
allowShowContextMenu(target:IEventDispatcher):Boolean
When the user presses on the component this method is called with the object that dispatched the event.
UIComponent
 Inherited
Process properties of the component.
UIComponent
 Inherited
Process the state of the component.
UIComponent
 Inherited
Style the component after the style has changed.
UIComponent
 Inherited
createFill(linkage:Object):void
Creates the fill skin based on the passed in linkage object.
SliderBase
 Inherited
Creates an empty sprite which will be used for detecting clicks within the bounds of the slider to allow for dragging when not touching the thumb.
SliderBase
 Inherited
createThumb(linkage:Object):void
Create the Thumb Skin based on the passed in linkage object.
SliderBase
 Inherited
createTrack(linkage:Object):void
Creates the Track Skin based on the passed in linkage object.
SliderBase
 Inherited
doMeasure(availableWidth:Number, availableHeight:Number):LayoutMeasurement
Performs a measurement on the control, and returns a LayoutMeasurement instance containing the available width and height within the layout.
UIComponent
 Inherited
excemptFromCSSStyling(target:*, property:String = null):void
Exempts a property on an object from being styled by CSS.
UIComponent
 Inherited
flushCache():void
Invoked as part of parentLayoutChanged.
UIComponent
 Inherited
getStyleApplier():Function
A style applier is a method that gets called every time a property from the stylesheet should be applied to the component.
UIComponent
 Inherited
onAdded():void
Called when the instance is added to the stage.
UIComponent
 Inherited
Is called when a user is no longer long pressing on the component.
UIComponent
 Inherited
Is called when a user long presses on the component.
UIComponent
 Inherited
onRemoved():void
Called when the instance is removed from the stage.
UIComponent
 Inherited
Invalidates the parent's size and display list if includeInLayout property is set to true.
UIComponent
 Inherited
Calling this function will refresh the ContextMenu with whatever actions were set by contextActions.
UIComponent
 Inherited
Removes the listeners for actually dragging and for when dragging is to stop.
SliderBase
 Inherited
Removes the listeners responsible for starting to Drag the Thumb or Drag along the Track.
SliderBase
 Inherited
Shows the context menu if there are contextActions associated with the control.
UIComponent
 Inherited
styleState():void
Style the component after state has changed.
UIComponent
 Inherited
Called when the position of the thumb on the x axis has changed.
SliderBase
 Inherited
Called when the thumb has been pressed by the user.
SliderBase
 Inherited
Called when the thumb has been released by the user.
SliderBase
 Inherited
Called when the track has been double clicked by the user.
SliderBase
 Inherited
Called when the track has been pressed by the user.
SliderBase
 Inherited
Updates the left and right constraints for determining the thumb position.
SliderBase
 Inherited
updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void
Sets the size and position of the children of the component.
UIComponent
 Inherited
updateFill():void
Updates the Fill skin to take up a certain width or percentage of the Slider.
SliderBase
 Inherited
Updates the Hit Sprite to be as large as the bounds of the Slider.
SliderBase

Events

 Event Summary Defined By
 InheritedDispatched when an action in the Context Menu is selected.UIComponent
 InheritedDispatched when the Context Menu has closed to the DISMISSED state.UIComponent
 InheritedDispatched when the ContextMenu is closing to the DISMISSED state.UIComponent
 InheritedDispatched when the Context Menu has opened to the PEEK or EXPANDED state.UIComponent
 InheritedDispatched when the ContextMenu is opening from the DISMISSED state.UIComponent
 InheritedDispatched when the CrossCut multiselect has been canceled.UIComponent
  Dispatched when a slide event has ended.Slider
  Dispatched when a slide event has started.Slider
  Dispatched when the value of the slider has changed during a slide action.Slider

Protected Constants

 ConstantDefined By
  ANIMATION_TIME : Number = 0.5
[static]
Slider

Property Detail

active


active:Boolean

Gets or sets a value that determines whether the control is active and enabled.

The default value is true.


Implementation

public function get active():Boolean
public function set active(value:Boolean):void

animateToValue


animateToValue:Boolean

When set to true, the Slider will animate when setting the value property on the Slider. When set to false, the Thumb and fill will snap to the new position.


Implementation

public function get animateToValue():Boolean
public function set animateToValue(value:Boolean):void

cssID


cssID:String  [read-only]
[override]

Returns the CSS ID of the component. The CSS ID is used for identifying the type of component in CSS.

The default value is Slider.


Implementation

protected function get cssID():String

maximum


maximum:Number

Gets or sets the maximum value of the slider.

The maximum value represents the very right extent of the track.

The default value is 100.


Implementation

public function get maximum():Number
public function set maximum(value:Number):void

minimum


minimum:Number

Gets or sets the minimum value of the slider.

The minimum value represents the very left extent of the track.

The default value is 0.


Implementation

public function get minimum():Number
public function set minimum(value:Number):void

value


value:Number

Gets or sets the current value of the slider. The value is represented by the position of the thumb on the slider track.

Setting this property will cause the thumb to update its position. This value is updated as the user drags the slider thumb.

The value is constrained to be within the minimum and maximum values.

The default value is 0.


Implementation

public function get value():Number
public function set value(value:Number):void

Constructor Detail

Slider()


public function Slider()

Creates a Slider instance.

Event Detail

slider_drag_ended


Event Object Type: qnx.fuse.ui.events.SliderEvent
SliderEvent.type property = qnx.ui.events.SliderEvent.END

Dispatched when a slide event has ended.

slider_drag_started


Event Object Type: qnx.fuse.ui.events.SliderEvent
SliderEvent.type property = qnx.ui.events.SliderEvent.START

Dispatched when a slide event has started.

slider_move


Event Object Type: qnx.fuse.ui.events.SliderEvent
SliderEvent.type property = qnx.ui.events.SliderEvent.MOVE

Dispatched when the value of the slider has changed during a slide action.

Constant Detail

ANIMATION_TIME


protected static const ANIMATION_TIME:Number = 0.5

Examples

The following example creates a simple Slider instance and adds it to the stage.
package
{
    import flash.display.Sprite;
    
    import qnx.fuse.ui.events.SliderEvent;
    import qnx.fuse.ui.slider.Slider;
    
    [SWF(height="1280", width="768", frameRate="30", backgroundColor="#FFFFFF")]
    public class sliderSample extends Sprite
    {
        private var mySlider:Slider;
        
        public function sliderSample()
        {
            initializeUI();
        }
        
        private function initializeUI():void
        {
            mySlider =  new Slider();
            mySlider.setPosition(300, 300);
            mySlider.minimum = 0;
            mySlider.maximum = 100;
            mySlider.value = 50;
            mySlider.width = 250;
            // listen to the when the slider moves
            mySlider.addEventListener( SliderEvent.MOVE, sliderChange );            
            this.addChild( mySlider );
        }
        
        private function sliderChange( event:SliderEvent ) : void
        {
            var newlevel:int = Math.round( event.target.value );
            trace( "slider value: ", newlevel );
        }
    }
}
     




comments powered by Disqus