皮肤库元件加载及解析

最近又开始做播放器(同学一直说我是播霸),打算重新写一个超轻量级的样式管理。
coding的时候不禁怀念并感叹FLEX的样式管理真的很强大。
下面代码是很简单却也是库元件的核心:
package com.skin
{
import flash.display.Loader;
/**
* 解析皮肤元件
* @author kingnare
*
*/
public class SkinFactory
{
public static var loader:Loader;
public static function make(classname:String):*
{
if(!loader)
{
throw new Error(“Loader is null”);
}
try
{
if(loader.contentLoaderInfo.applicationDomain.hasDefinition(classname))
{
var classReference:Class = loader.contentLoaderInfo.applicationDomain.getDefinition(classname) as Class;
return new classReference();
}
else
{
return null;
}
}
catch(e:Error)
{
throw new Error(“Error when getting skin symbol:”+classname);
}
}
}
}
留此文以备用。

1 comment to 皮肤库元件加载及解析

  • 岚岚

    港句老实话..
    看不懂一点,
    真的不好意思来.
    学计算机系的….真的天才别.
    [reply=auzn,2009-04-07 11:25 AM]:)[/reply]

    [Reply]

Leave a Reply

 

 

 

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">