Aspire UI Components (Flash ActionScript 3.0) Docs
Table of Contents

uiSkins

The uiSkins manager handles requests for skin assets and manages the loading and caching of external bitmap images used for skinning.

See Also: Skinning


Using uiSkins

You do not normally need to access the uiSkins manager in your application code.

The uiSkins manager is initialized and used automatically by the Aspire UI framework. The “rules.xml” XML file from the default theme folder is automatically loaded and parsed. Subsequently, all the bitmap skin assets specified in the XML will be (pre)loaded and cached, ready for use by components in the framework.

Changing Theme

By default, Aspire UI will use the “default” theme, ie the skin assets stored in the “assets/skins/default” folder. If you wish to indicate a specific theme folder to use, you may do so by calling the uiSkins.initialize() method:

uiSkins.initialize("classic"); // ** uses the "classic" theme **

NOTE: If the uiSkins.initialize() method is to be called, it must be called before any other Aspire UI class is used, otherwise an error will be thrown.

See Also: About Themes

Changing Path

By default, the themes are stored in “assets/skins/” (relative to the location of your application SWF). If you wish to change this path, you may do so when calling the uiSkins.initialize() method:

uiSkins.initialize(null,"someotherpath/"); // ** uses assets from the "default" theme folder in "someotherpath/" **
uiSkins.initialize("classic","someotherpath/"); // ** uses assets from the "classic" theme folder in "someotherpath/" **

Changing “rules.xml”

By default, the rules governing the various skins are stored in an XML file “rules.xml” in their respective theme folders (each theme uses its own “rules.xml”). If you wish to use an alternative XML file, you may do so when calling the uiSkins.initialize() method:

uiSkins.initialize(null,null,"rules.override.xml"); // ** uses "default" theme from "assets/skins/", and "rules.override.xml" in lieu of "rules.xml" **
uiSkins.initialize("classic",null,"rules.override.xml"); // ** uses "classic" theme from "assets/skins/", and "rules.override.xml" in lieu of "rules.xml" **
uiSkins.initialize("classic","someotherpath/","rules.override.xml"); // ** uses "classic" theme from "someotherpath/", and "rules.override.xml" in lieu of "rules.xml" **

See Also: Excluding Skin Assets

Checking Loading Progress

The uiSkins manager will preload all the skins before rendering any component. If you wish to track this loading progress, you may do so by listening to the ProgressEvent.PROGRESS event:

uiSkins.manager.addEventListener(ProgressEvent.PROGRESS,on_skinProgress);
 
function on_skinProgress(evt:ProgressEvent):void
{
    trace("bytesLoaded::"+evt.bytesLoaded);
    trace("bytesTotal::"+evt.bytesTotal);
}

If you wish to be notified when all the skin assets have been loaded and the uiSkins manager is ready for use, listen to the Event.INIT event:

// ** let assets preload before starting application **
uiSkins.manager.addEventListener(Event.INIT,main);
 
function main(evt:Event):void
{
// ** main application code **
}

NOTE: uiSkins is a singleton class and may not be instantiated via the new operator. To access the manager, use uiSkins.manager.


API Reference

For more information on the members of the com.ghostwire.ui.managers.uiSkins class, please refer to the API Reference.


 
 
Recent changes RSS feed Creative Commons License Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki