日韩久久久精品,亚洲精品久久久久久久久久久,亚洲欧美一区二区三区国产精品 ,一区二区福利

一個loader加載多個swf

系統(tǒng) 2139 0
      
        var
      
      
         _swfLoader:Loader;


      
      
        var
      
      
         _swfRequest:URLRequest;

 


      
      
        var
      
       _swfPathArr:Array = 
      
        new
      
       Array(
      
        "00.swf"
      
      , 
      
        "01.swf"
      
      , 
      
        "02.swf"
      
      
        );

 


      
      
        var
      
       _swfClipsArr:Array = 
      
        new
      
      
         Array();


      
      
        var
      
       _swfTempClip:
      
        MovieClip
      
      
        ;


      
      
        var
      
      
         _loadedSWFs:int;

 

 

startLoading(_swfPathArr);

 


      
      
        function
      
       startLoading(pathArr:Array):
      
        void
      
      
         {

    _swfLoader 
      
      = 
      
        new
      
      
         Loader();

    _swfRequest 
      
      = 
      
        new
      
      
         URLRequest();

   

    loadSWF(pathArr[
      
      0
      
        ]);

}

 


      
      
        function
      
       loadSWF(path:String):
      
        void
      
      
         {

    setupListeners(_swfLoader.contentLoaderInfo);

   

    _swfRequest.url 
      
      =
      
         path;

    _swfLoader.load(_swfRequest);

}

 


      
      
        function
      
       setupListeners(dispatcher:IEventDispatcher):
      
        void
      
      
         {

    dispatcher.addEventListener(Event.COMPLETE, onSwfComplete);

    dispatcher.addEventListener(ProgressEvent.PROGRESS, currentSwfProgress);

}

 


      
      
        function
      
       currentSwfProgress(event:ProgressEvent):
      
        void
      
      
         {

    
      
      
        var
      
       _perc:int = (event.bytesLoaded / event.bytesTotal) * 100
      
        ;

    
      
      
        //
      
      
         swfPreloader.percentTF.text = _perc + "%";
      
      
        }

 

 


      
      
        function
      
       onSwfComplete(event:Event):
      
        void
      
      
         {

    event.target.removeEventListener(Event.COMPLETE, onSwfComplete);

    event.target.removeEventListener(ProgressEvent.PROGRESS, currentSwfProgress);

 

    _swfTempClip 
      
      =
      
         event.target.content;

    _swfTempClip.customID 
      
      =
      
         _loadedSWFs;

    _swfClipsArr.push(_swfTempClip);

   

    
      
      
        if
      
      (_loadedSWFs <_swfPathArr.length - 1
      
        ) {

        _loadedSWFs
      
      ++
      
        ;

        loadSWF(_swfPathArr[_loadedSWFs]);

    } 
      
      
        else
      
      
         {

        _swfLoader.unloadAndStop();

        _swfLoader 
      
      = 
      
        null
      
      
        ;

        onCompletePreloading();

    }

}

 


      
      
        function
      
       onCompletePreloading():
      
        void
      
      
         {

    contentContainer.addChild(_swfClipsArr[
      
      0
      
        ]);

   

    news_btn.addEventListener(MouseEvent.CLICK, setContent);

    portfolio_btn.addEventListener(MouseEvent.CLICK, setContent);

    contact_btn.addEventListener(MouseEvent.CLICK, setContent);

}

 


      
      
        function
      
       setContent(event:MouseEvent):
      
        void
      
      
         {

    
      
      
        var
      
       _swfToAdd:
      
        MovieClip
      
      
        ;

   

    
      
      
        switch
      
      
        (event.target.name) {

        
      
      
        case
      
      
        "news_btn"
      
      
        :

        _swfToAdd 
      
      = _swfClipsArr[0
      
        ];

        
      
      
        break
      
      
        ;

       

        
      
      
        case
      
      
        "portfolio_btn"
      
      
        :

        _swfToAdd 
      
      = _swfClipsArr[1
      
        ];

        
      
      
        break
      
      
        ;

       

        
      
      
        case
      
      
        "contact_btn"
      
      
        :

        _swfToAdd 
      
      = _swfClipsArr[2
      
        ];

        
      
      
        break
      
      
        ;

    }

   

    contentContainer.removeChildAt(contentContainer.numChildren
      
      -1
      
        );

    contentContainer.addChild(_swfToAdd);

    trace(_swfToAdd.customID);

}
        
http://www.beautifycode.com/the-finer-art-of-loading-2-handling-multiple-swfs

?

一個loader加載多個swf


更多文章、技術(shù)交流、商務(wù)合作、聯(lián)系博主

微信掃碼或搜索:z360901061

微信掃一掃加我為好友

QQ號聯(lián)系: 360901061

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點(diǎn)擊下面給點(diǎn)支持吧,站長非常感激您!手機(jī)微信長按不能支付解決辦法:請將微信支付二維碼保存到相冊,切換到微信,然后點(diǎn)擊微信右上角掃一掃功能,選擇支付二維碼完成支付。

【本文對您有幫助就好】

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描上面二維碼支持博主2元、5元、10元、自定義金額等您想捐的金額吧,站長會非常 感謝您的哦!!!

發(fā)表我的評論
最新評論 總共0條評論
主站蜘蛛池模板: 沁阳市| 武隆县| 新乡市| 元朗区| 宜州市| 长宁县| 隆化县| 北票市| 郸城县| 鄄城县| 松原市| 江津市| 望谟县| 宁城县| 丹巴县| 安仁县| 广丰县| 南皮县| 常德市| 旅游| 铅山县| 绿春县| 石阡县| 柯坪县| 江孜县| 长治市| 阜城县| 开原市| 沽源县| 白沙| 和平区| 石景山区| 洪洞县| 昆明市| 察哈| 会东县| 通河县| 临安市| 永福县| 沧州市| 富裕县|