This document explains the use of the Flash Lite Scrollbar component and API.
(Note, this document has also been published in pdf format inside the Forum Nokia Flash Lite Components package)
The Flash Lite Scrollbar component is a flexible and scalable user interface component that allows Flash Lite developers to create mobile user interfaces easily.
The Scrollbar component uses placeholder MovieClips similar to many other Forum Nokia UI components in order to ease scaling, orientation, and positioning issues.
The Scrollbar can be attached automatically to the top, bottom, left side, or right side of the placeholder. It can be set to hide itself after a given timeout after the component is interacted.
| | Figure 2. Example illustration of the Scrollbar component. |
| Figure 1. Scrollbar component in use in an application. | |
Scrollbar component is included in the Forum Nokia Flash Lite Components package.
Installation of the Scrollbar component is easy. Execute the components MXP file and follow the simple instructions in Adobe Extension Manager to complete the installation process. Restart Adobe Flash CS4 after installation.
Note: Component FLA and AS files should appear in the directories [INSTALL PATH]\Flash CS4\en\Configuration\Components\Forum Nokia and [INSTALL PATH]\Flash CS4\en\Configuration\Classes\com\forumnokia. In some setup environments, the files may appear under the wrong language directories (for example, fi instead of en). In such cases, the files should be manually moved to the correct directories as specified above.

fscommand2("DisableKeypadCompatibilityMode");
fscommand2("FullScreen", true);
fscommand2("SetQuality", "high");
Stage.scaleMode = "noScale";
Stage.align = "TL";
_focusrect = false;
import mx.utils.Delegate;
// Get the list events’ names
var event_slider = your_list_mc.onPageScrollEvent();
var event_count = your_list_mc.onDataLoadEvent();
// Tell the scrollbar the event names to listen
your_list_mc.scrollbarInstance.setSliderChangeEvent(event_slider);
your_list_mc.scrollbarInstance.setCountChangeEvent(event_count);
// Tell the list instance that the scrollbar is listening for events
your_list_mc.addEventListener( event_slider,
Delegate.create(your_scrollbar_mc, your_scrollbar_mc.eventHandler) );
your_list_mc.addEventListener( event_count,
Delegate.create(your_scrollbar_mc, your_scrollbar_mc.eventHandler) );
var event_name:String = scrollbar_mc.onSliderChangeEvent();
scrollbar_mc.addEventListener( event_name, Delegate.create(listener_mc, listener_mc.eventHandler) );
function eventHandler(eventObj:Object):Void {
switch (eventObj.type)
{
case event_name:
// Add your functionality here
break;
default :
trace("unknown eventObj.type:"+eventObj.type);
break;
}
}
// Tells the list instance the name of the page scroll event
your_list_mc.setOnPageScrollEvent(event_name);
// Tells the scrollbar instance who is listening to it’s event
scrollbar_mc.addEventListener( event_name, Delegate.create(your_list_mc,
your_list_mc.eventHandler) );
var stageListener = new Object();
stageListener.onResize = function()
{
scrollbarInstance.setPlaceholder("Stage");
}
The skin and assets of the Scrollbar component are composed of eight different parts, as shown below. This structure enables the Scrollbar interface to be scalable and easily skinned.
Scrollbar assets are composed of arrow icons (8x8 pixels) and top and bottom buttons, each of which have respective Up and Down states. Assets are organised in the following folder structure:
_assets
Asset MovieClips use the following linkage ID naming: Scrollbar.Default.Up.ArrowBottom
NOTE: Custom assets must follow the same folder structure, and linkage identifiers must be named accordingly.
As with assets, the skin also has separate MovieClips for Up and Down states of the Scrollbar. The skin consists of a background, top, body, and bottom part of the slider (moves on top of the background), and top and bottom arrow backgrounds. The structure and default sizes of these parts are defined below:
_skins
Skin MovieClips use the following linkage ID naming: Scrollbar.Default.Down.Background
Note: Each new custom skin must follow the same folder structure, with linkage identifiers named accordingly.
Inspectable parameters help customise the Button component from the Component Inspector panel (Shift + F7). All inspectable parameters can also be controlled via ActionScript.
| Parameter | Description | Value |
|---|---|---|
| Arrows | Display/hide arrow elements. | Visible/hidden; default is Visible |
| Asset path | Defines the asset linkage identifier path. For instance, for the myAssets value, the component would search for the assets under the Scrollbar.myAssets.* linkage path. | Asset identifier string |
| Auto hide | Auto hide speed in milliseconds. The component is hidden after being interacted with for a given period. | 0 (Off) |
| Placeholder | If specified, the List component will locate and scale itself according to this parameter. If not specified, the List locates itself manually and is drawn based on its default dimensions. | Instance of a placeholder MovieClip |
| Scrollbar position | The position and orientation of the scrollbar related to the reference object. The height or width of the scrollbar is adjusted to match the height or width of the placeholder reference, depending on the orientation. Note: The setPlaceholder() function needs to be called, because the placeholder object is usually constructed after the Scrollbar. Otherwise, the scrollbar may not be sized and positioned correctly. | Left/right/top/bottom; default is Right |
| Scrolling speed | Scrolling speed when arrows or the scrollbar track is pressed. | Number (smaller is faster); default is 80 |
| Skin path | Defines the component’s skin linkage identifier path. For instance, for the mySkin' value, it would search for the skin components under the Scrollbar.mySkin.* linkage path. | Skin identifier string |
public function setArrowVisibility( visible:Boolean ): Void;
Hides both arrows from the component.
public function setScrollbarPosition( position:String ): Void;
Places the object automatically at the top/bottom/left/right side of the placeholder object. Default position is ”Right”.
Example : setScrollbarPosition(”Right”)
public function setScrollSpeed(speed:Number): Void;
Sets the speed of scrolling.
public function setAutoHide(value:Number): Void;
The entire component will be hidden automatically after a given period (milliseconds). The component will become visible when the component’s area is tapped.
public function setSkin( path:String ): Void;
Sets a new path for the skin. Reconstructs the component.
public function setAssets( path:String ): Void;
Sets a new path for the assets. Reconstructs the component.
public function setPlaceholder( nameStr:String ): Void;
Sets a placeholder object used to relocate, scale, and reconstruct the component.
public function setCountChangeEvent( eventName:String ): Void;
Defines an event. The received item count causes the height of the slider part to change. See also setNumberofItems.
public function setSliderChangeEvent( eventName:String ): Void;
Defines an event. The position of the slider should change when the user navigates a list. See also setSliderPos.
public function onSliderChangeEvent(): String;
Returns the name for this dispatched event. When the user changes the slider position, the new first item index (related to list functionality) will be dispatched (usually for the list). See also setSliderPos.
public function addEventListener(event:String, listenerFunction:Object): Void;
Specifies a listening function that receives the specified event.
public function removeEventListener(event:String, listenerFunction:Object): Void;
Tells the component to stop dispatching events to the listener function.
public function setShowingItems(count:Number) :Void;
Because the scrollbar is intended to work with lists, the height of the slider follows the amount of items and the visible item count in a list.
public function setNumberofItems(count:Number) :Void;
Because the scrollbar is intended to work with lists, the height of the slider part follows the amount of items and the visible item count in a list.
public function setSliderPos(pos:Number) :Void;
The slider position should change when the list is navigated. The position argument is an index of currently visible items from the top of the list.
public function setHeight(height:Number) :Void;
Sets the new height for the component.
public function enableComponent() :Void;
Makes the component react to user input.
public function disableComponent() :Void;
Makes the component stop reacting to user input.
No related wiki articles found