qnx.ui.listClasses.ScrollPane

ScrollPane

Properties | Methods | Events | Examples


Packageqnx.ui.listClasses
Classpublic class ScrollPane
InheritanceScrollPane Inheritance UIComponent Inheritance flash.display.MovieClip

The ScrollPane class represents a scrolling pane. The ScrollPane is useful for displaying large amounts of data such as text, large images, or maps. The user can drag the scoll pane to view the data that is currently outside of the viewport.

Class information:
PlayBook Tablet OS Version:   1.0.6

View the examples

See also

List



Public Properties

 PropertyDefined By
 Inheritedcontainment : String
Gets or sets a property that determines how a component is contained within a parent container.
UIComponent
  enableShadows : Boolean
Enables or disables scroll shadows.
ScrollPane
  scrollBarAlpha : Number
Gets or sets the opacity value for the scroll bar on the list.
ScrollPane
  scrollBarColor : Number
Gets or sets the color of the scroll bar.
ScrollPane
  scrollBarOffset : int
Gets or sets the x or y postion of the scrollbar, in pixels.
ScrollPane
  scrollDirection : String
Sets a String representing the scroll direction of the scroll pane.
ScrollPane
  scrollX : int
Sets the x position of the content item given a pixel value.
ScrollPane
  scrollY : int
Sets the y position of the content item given a pixel value.
ScrollPane
 Inheritedsize : Number
Gets or sets the size for this component (as a percentage of the container's size, or in pixels).
UIComponent
 InheritedsizeMode : String
Gets or sets the size mode for this component.
UIComponent
 InheritedsizeUnit : String
Gets or sets the unit of measure for the size property.
UIComponent

Public Methods

 MethodDefined By
  
Creates a ScrollPane instance.
ScrollPane
 Inherited
destroy():void
Call this method when you want to have your object collected by the garbage collector.
UIComponent
 Inherited
drawNow():void
Calls the draw() method.
UIComponent
  
getScrollContent():DisplayObject
Returns the ScrollPane content as a DisplayObject.
ScrollPane
 Inherited
invalidate(property:String = all, invalidateNow:Boolean = false):void
Marks the property as invalid and the draw() method is called on the next frame or the next render, whichever comes first.
UIComponent
  
removeScrollContent():DisplayObject
Removes all content from the ScrollPane instance.
ScrollPane
 Inherited
setPosition(x:Number, y:Number):void
Sets the x and y position of the component.
UIComponent
  
setScrollContent(content:Object):DisplayObject
Sets content for the ScrollPane instance.
ScrollPane
 Inherited
setSize(w:Number, h:Number):void
Sets the width and height of the component.
UIComponent
  
update():void
Refreshes the scroll pane properties based on the width and height of the content.
ScrollPane

Protected Methods

 MethodDefined By
 Inherited
callLater(method:Function):void
Calls the specified method on the next frame or the next render, which ever happens first.
UIComponent
 Inherited
createInstance(linkage:Object):DisplayObject
Calling this method will attempt to create a DisplayObject instance based on the value of the linkage parameter.
UIComponent
 Inherited
draw():void
Called every time you set the width and height of the component.
UIComponent
 Inherited
isInvalid(property:String, ... properties):Boolean
Checks to see if the property is invalid and returns true if it is.
UIComponent
 Inherited
onAdded():void
Called when the instance is added to the stage.
UIComponent
 Inherited
onRemoved():void
Called when the instance is removed from the stage.
UIComponent
 Inherited
setEnabled(val:Boolean):void
Called when the enabled property changes.
UIComponent
 Inherited
validate(property:String = all):void
Lets the component know that the specified property has been validated.
UIComponent

Events

 Event Summary Defined By
   Dispatched when scrolling begins.ScrollPane
   Dispatched when scrolling ends.ScrollPane
   Dispatched when scrolling occurs.ScrollPane

Property Detail

enableShadows


enableShadows:Boolean

Enables or disables scroll shadows. The scroll shadows are vertical and horizontal bars that appear on the edge of the ScrollPane instance. They provide context as to the extent of the content within the ScrollPane.

The default value is true.


Implementation

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

scrollBarAlpha


scrollBarAlpha:Number

Gets or sets the opacity value for the scroll bar on the list.

When the list is pressed it reveals the scroll bar. The scroll bar alpha determines the opacity of the scroll bar when it is revealed.

The default value is 0.5.


Implementation

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

scrollBarColor


scrollBarColor:Number

Gets or sets the color of the scroll bar.

The default value is 0x737a80.


Implementation

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

See also

scrollBarAlpha

scrollBarOffset


scrollBarOffset:int

Gets or sets the x or y postion of the scrollbar, in pixels.

The offset value is relative to the scrollDirection property and is used to position the scrollbar relative to the edge of the pane. For example, when the scrollpane scrolls vertically, the offset value is relative to the right edge of the pane, since the scroll bar appears on the right side of the scroll pane.

The default value is 10.


Implementation

public function get scrollBarOffset():int
public function set scrollBarOffset(value:int):void

See also

scrollDirection

scrollDirection


scrollDirection:String

Sets a String representing the scroll direction of the scroll pane.

The direction argument can be NONE (unable to scroll), BOTH (can scroll in both directions if content exceeds pane height or width), HORIZONTAL (can only scroll horizontally) and VERTICAL (only on the vertical).


Implementation

public function get scrollDirection():String
public function set scrollDirection(value:String):void

See also

ScrollDirection

scrollX


scrollX:int

Sets the x position of the content item given a pixel value.

The minimum value is 0 pixels, and the maximum value is equal to the width of the content item.


Implementation

public function get scrollX():int
public function set scrollX(value:int):void

scrollY


scrollY:int

Sets the y position of the content item given a pixel value.

The minimum value is 0 pixels, and the maximum value is equal to the height of the content item.


Implementation

public function get scrollY():int
public function set scrollY(value:int):void

Constructor Detail

ScrollPane()


public function ScrollPane()

Creates a ScrollPane instance.

Method Detail

getScrollContent()


public function getScrollContent():DisplayObject

Returns the ScrollPane content as a DisplayObject.

Returns

DisplayObject — A DisplayObject containing the scroll pane content.

removeScrollContent()


public function removeScrollContent():DisplayObject

Removes all content from the ScrollPane instance.

Returns

DisplayObject — DisplayObject

setScrollContent()


public function setScrollContent(content:Object):DisplayObject

Sets content for the ScrollPane instance.

You can set an item to the scroll pane by passing either a class reference, a String linkage identifier, or an instance of a DisplayObject.

Parameters

content:Object — The content to be added to the ScrollPane.

Returns

DisplayObject — Returns the item that was added.

update()


public function update():void

Refreshes the scroll pane properties based on the width and height of the content.

Call this function if the content of the ScrollPane changes during run time.

Event Detail

scrollBegin


Event Object Type: qnx.ui.events.ScrollEvent
ScrollEvent.type property = qnx.ui.events.ScrollEvent.SCROLL_BEGIN

Dispatched when scrolling begins.

scrollEnded


Event Object Type: qnx.ui.events.ScrollEvent
ScrollEvent.type property = qnx.ui.events.ScrollEvent.SCROLL_END

Dispatched when scrolling ends.

scrollMove


Event Object Type: qnx.ui.events.ScrollEvent
ScrollEvent.type property = qnx.ui.events.ScrollEvent.SCROLL_MOVE

Dispatched when scrolling occurs.

Examples

The following example provides a ScrollPane that is used to view a large image. The image is included in the assets folder.

package
{
    import flash.display.Sprite;
    
    import qnx.ui.data.DataProvider;
    import qnx.ui.events.ScrollEvent;
    import qnx.ui.listClasses.ScrollPane;
    import qnx.ui.listClasses.ScrollDirection;
    import qnx.ui.text.Label;
    
    [SWF(height="600", width="1024", frameRate="30", backgroundColor="#FFFFFF")]
    public class listSample extends Sprite
    {
        
        private var myScrollPane:ScrollPane;
        private var myLabel:Label;
        
        [Embed(source="../assets/pup.jpg")] 
        public static var bigImage:Class;
        
        public function listSample()
        {
            initializeUI();
        }
        
        private function initializeUI():void
        {
            
            myScrollPane = new ScrollPane();            
            myScrollPane.setPosition(50, 50);            
            myScrollPane.width = 300;            
            myScrollPane.height = 300;
            myScrollPane.scrollDirection = ScrollDirection.BOTH;        
            myScrollPane.setScrollContent( bigImage );
            
            myScrollPane.addEventListener(ScrollEvent.SCROLL_END, onScroll);
            myScrollPane.addEventListener(ScrollEvent.SCROLL_BEGIN, onScrollStart);
            
            this.addChild(myScrollPane);
            
        }
    
        private function onScroll(event:ScrollEvent):void {
            
            trace("Finished scrolling...");            
        }
        
        private function onScrollStart(event:ScrollEvent):void {
            
            trace("Start scrolling...");            
        }        
            
    }
}
     

The following example provides a ScrollPane that is used to view a large paragraph of text.

package
{
    import flash.display.Sprite;
    
    import qnx.ui.events.ScrollEvent;
    import qnx.ui.listClasses.ScrollPane;
    import qnx.ui.listClasses.ScrollDirection;
    import qnx.ui.text.Label;
    
    [SWF(height="600", width="1024", frameRate="30", backgroundColor="#FFFFFF")]
    public class listSample extends Sprite
    {
        
        private var myScrollPane:ScrollPane;
        private var myLabel:Label;
        
        public function listSample()
        {
            initializeUI();
        }
        
        private function initializeUI():void
        {
            
            myScrollPane = new ScrollPane();            
            myScrollPane.setPosition(100, 100);            
            myScrollPane.width = 400;            
            myScrollPane.height = 300;
            myScrollPane.scrollDirection = ScrollDirection.BOTH;
            
            var myLabel:Label = new Label();
            myLabel.multiline = true;
            myLabel.width = 600;
            myLabel.height = 600;
            myLabel.textField.wordWrap = true;        
            myLabel.multiline = true;
            myLabel.text = "Lorem ipsum dolor sit amet, consectetur adipiscing " +
                "elit. Sed convallis facilisis massa. Sed porttitor, velit nec eleifend " +
                "tincidunt, eros velit imperdiet magna, sed fermentum libero nulla et mauris." +
                " Sed pellentesque, lectus vel sagittis interdum, nisi lectus lobortis tortor," +
                " in consequat augue metus non justo. Vivamus ut magna in risus mattis commodo. " +
                "Integer lacinia pharetra sodales. Morbi ornare, sem vitae vestibulum condimentum," +
                " ipsum mi condimentum neque, at imperdiet eros lectus nec eros. Morbi aliquam " +
                "convallis mauris, vel suscipit elit lacinia non. Donec id porttitor eros. " +
                "Quisque accumsan dui in eros porta aliquet condimentum eros pellentesque. " +
                "Fusce blandit nisl facilisis justo hendrerit vitae blandit ante elementum. " +
                "Cras nisl massa, ornare sed hendrerit non, cursus at eros. Nulla facilisi. ";
            this.addChild(myLabel);
            
            myScrollPane.setScrollContent( myLabel );
            
            myScrollPane.addEventListener(ScrollEvent.SCROLL_END, onScroll);
            myScrollPane.addEventListener(ScrollEvent.SCROLL_BEGIN, onScrollStart);
            
            this.addChild(myScrollPane);
            
        }
    
        private function onScroll(event:ScrollEvent):void {
            
            trace("Finished scrolling...");            
        }
        
        private function onScrollStart(event:ScrollEvent):void {
            
            trace("Start scrolling...");            
        }        
            
    }
}