AS3關於SWF美術資源的管理(一)

rawShape Button,MovieClip,TextFile),些元要public ,

protected function initRawShape():void {
    super.addChild(rawShape);
    for (var i:int = 0, len:int = rawShape.numChildren; i < len; i++) {
        var p:String=rawShape.getChildAt(i).name
        if (this.hasOwnProperty(p))
        {
            try
            {
                this[p]=rawShape.getChildAt(i);
            }
            catch (err:Error)
            {
                trace(err)
            }
        }
    }
}

->




$pros["closeBtn"] = closeBtn as SimpleButton
protected function addPropertys($pros : Dictionary) : void{
        super.addChild(rawShape);
        for (var i:int = 0, len:int = rawShape.numChildren; i < len; i++) {
            var p:String=rawShape.getChildAt(i).name
            if ($pros[p])
            {
                try
                {
                    $pros[p]=rawShape.getChildAt(i);
                }
                catch (err:Error)
                {
                    trace(err)
                }
            }
        }
}



:

/**
 * *
 */     
public function initlink():void {
    //    var qualifiedClassName : String = getQualifiedClassName( this ).split("::").pop();
    var $class:Class=getLinkClass(qualifiedClassName);
    if(!$class)return;
    //
    rawShape = new $class;
    //匹詰ublic 目
    initRawShape();
}


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章