1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
|
import flash.utils.getDefinitionByName;
import mx.collections.ArrayList;
import spark.events.IndexChangeEvent;
import spark.skins.SparkButtonSkin;
private var _skin:String;
protected function dropdownlist1_changeHandler(event:IndexChangeEvent):void
{
var ddl:DropDownList = event.currentTarget as DropDownList;
_skin = ddl.selectedItem.label;
var ldrContext:LoaderContext = new LoaderContext(false, ApplicationDomain.currentDomain);
var l:Loader = new Loader();
l.contentLoaderInfo.addEventListener(Event.OPEN, onOpen);
l.contentLoaderInfo.addEventListener(Event.COMPLETE, onComplete);
l.load(new URLRequest("E:/workspaces/flex/sim_test/Skin1/bin/library_"+_skin+".swf"), ldrContext);
}
protected function onOpen(event:Event):void
{
trace('open');
}
protected function onComplete(event:Event):void
{
var fullyQualifiedName:String = "skins." + _skin.charAt(0).toUpperCase() + _skin.substr(1);
var buttonSkin:Class = getDefinitionByName(fullyQualifiedName) as Class;
test.setStyle("skinClass", buttonSkin);
} |
Partager