만든목적 :
1. 다량의 이미지를 한번에 로딩하자
2. 로딩시 순차적으로 이미지를 보여주자.
3. 프로그래스 바 표현을 해주자

이런 목적으로 제작 했습니다. 사용은 그냥 잘 쓰시면 됩니다.(수정 맘대로 하셔도 됨)

===> 자세한 내용은 첨부 파일을 참조하기 바랍니다.



테스트 이미지 (순차적으로 이미지를 한번에 로딩 할 수 있음 ㅋㅋㅋㅋㅋ)
==> 10 읽어들인 이미지 개수임.



테스트 코드

<?xmlversion="1.0" encoding="utf-8"?>

<mx:Application

       backgroundColor="#ffffff"

       creationComplete="init()"

       xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">

       <mx:Script>

             <![CDATA[

                   

                    importmx.controls.Image;

                    importwonsama.info.ImageLoaderInfo;

                    importwonsama.event.ImageLoaderEvent;

                    importwonsama.loader.ImageLoader;

                    importmx.containers.Canvas;

                   

                    /**

                     * 초기화

                     * */

                    private function init():void{

                          

                           //테스트용 이미지 주소 생성 ==> 배열에 삽입

                           var imgArr:Array = new Array;

                           for(var i:uint=0;i<10;i++){

                                 var imgSource:String = "assets/img/number/0"+i+".png";

                                 imgArr.push(imgSource);

                           }

                          

                           //이미지 로더 생성 이벤트 등록

                           var loader:ImageLoader = newImageLoader;

                           loader.loadImages(imgArr);

                           loader.addEventListener(ImageLoaderEvent.UPDATE_PROGRESS,imageProgressHandler);

                           loader.addEventListener(ImageLoaderEvent.COMPLETE_LOAD,imageCompleteHandler);

                    }

                   

                    /**

                     * 이미지가 1 로딩 완료가 되었을 발생하는 이벤트 핸들러

                     * @param e 이미지 로더 이벤트

                     * */

                    private function imageProgressHandler(e:ImageLoaderEvent):void{

                          

                           //일반적으로  프로그래스 처리 내용이 들어가면 될거 같음

                          

                           var info:ImageLoaderInfo = e.info as ImageLoaderInfo;

                           txtInfo.text =String(info.countSuccess);

                    }

                   

                    /**

                     * 이미지가 모두 로딩 완료가 되었을 발생하는 이벤트 핸들러

                     * @param e 이미지 로더 이벤트

                     * */

                    private function imageCompleteHandler(e:ImageLoaderEvent):void{

                          

                           //일반적으로 로딩된 이미지를 보여주는 처리를 하면 될거 같음

                          

                           var info:ImageLoaderInfo = e.info as ImageLoaderInfo;

                          

                           for(var s:String ininfo.loadImgArr){

                                 var imgLoad:Image = info.loadImgArr[s];

                                 if(imgLoad==null){

                                        //기본 이미지 삽입

                                        //main.addChild("기본이미지");

                                 }

                                 else{

                                        main.addChild(imgLoad);

                                 }

                           }                               

                    }

                   

             ]]>

       </mx:Script>

       <mx:Label id="txtInfo"fontFamily="굴림"fontSize="12"/>

       <mx:HBox id="main"width="100%" height="100%"/>

      

</mx:Application>

'기타 > Old' 카테고리의 다른 글

[AS3.0] Shallow copy 와 Deep copy  (0) 2009.07.07
아이온을 넷북에서 즐긴다?  (0) 2009.07.03
아이폰, '외산폰 무덤인 한국'서 통할까?  (0) 2009.07.02
미리보기 켄버스  (0) 2009.07.01
Fixed Size of a Pie Chart  (0) 2009.07.01

+ Recent posts