This article explains the use of the Flash Lite Button component and API.
(Note, this document has also been published in pdf format inside the Forum Nokia Flash Lite Components package)
The Flash Lite Button component is a flexible and scalable user interface component that allows Flash Lite developers to create mobile user interfaces easily, using Flash Lite.
The button component uses placeholder MovieClips, similar to many other Forum Nokia UI components, in order to ease scaling, orientation, and positioning issues.
Figures 1, 2 and 3 give example visual illustrations of the Button component. The exact appearance of the component in your application depends on the parameters and exact style you choose to use.
| | ![]() Figure 2. Unpressed button. |
| Figure 1. Button components in use in a pop-up component together with a list component. | |
Button component is included in the Forum Nokia Flash Lite Components package.
Installation of the Button 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;
var myEvent = myButton.onReleaseEvent();
myButton.addEventListener(myEvent, myListener);
function myListener(eventObject:Object):Void {
if (eventObject.type == myEvent) {
switch (eventObject.target) {
case _level0.myButton :
// My Button action here
break;
default :
break;
}
}
}
Button assets consist of an icon (50x50 pixels) and a label (50x100 pixels). Each asset has separate MovieClips for Up, Down, and Over states of the button, which are organised in the following structure:
_assets
NOTE: Custom assets must follow the same folder structure, and linkage identifiers must be named accordingly.
The skin of a button component is composed of nine different parts, as can be seen below. This structure enables the button interface to be scalable and easily skinnable.
As with assets, skins also have separate MovieClips for Up, Down, and Over states of the button. The structure and default size of these parts is defined below:
_skins
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 with the component APIs.
| Parameter | Description | Value |
|---|---|---|
| Skin | Defines the button skin linkage identifier path. For instance, for the mySkin value, the button would search for the skin components under the Button.mySkin.* linkage path. | Skin identifier string |
| Assets | Defines the button asset linkage identifier path. For instance, for the myAssets value, the component would search for the assets under the Button.myAssets.* linkage path. | Asset identifier string |
| Placeholder | If specified, the button component will locate and scale itself according to this parameter. If not specified, the button locates itself manually and is drawn based on its default dimensions. | Instance of a placeholder MovieClip |
| Assets scaling | Defines the scaling method for the component assets. If specified, component assets are scaled according to the given width or height of the button. | None/width/height |
| Icon alignment | Defines the location of the icon asset on the button, if an icon is defined. | None/left/center/right |
| Label alignment | Defines the text alignment of the label asset. | Left/center/right |
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 setLabel( newLabel:String ): Void;
Sets the label text value of the component.
public function assetScaling( newProperty:String ): Void;
Defines the asset scaling method. The parameter value can be either “none”, “width”, or “height”.
public function setIconAlignment( newPosition:String ): Void;
Defines the location of the icon asset according to the parameter, when an icon is defined. The parameter value can be “none”, “left”, “center”, or “right”. Label location changes according to icon alignment.
public function setLabelAlignment( newPosition:String ): Void;
Sets the label text alignment. The parameter value can be “left”, “center”, or “right”.
public function enableComponent() :Void;
Makes the component react to user input.
public function disableComponent() :Void;
Makes the component stop reacting to user input.
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 onReleaseEvent():String;
Calls the button component’s release event.
No related wiki articles found