hjkhghopjkertteerterterterertertrtoirh
bnmbertsurhetertertertertertertertpdf'tdfg
/
srv
/
www
/
virtual
/
wccweb.jp
/
web
/
htdocs
/
wphh
/
2009
/
shosai
/
util
/
Upload FileeE
HOME
/*======================================================================*//** * * 3PCPG * * @author Copyright (c) 2008 muraken[undefined™(http://www.undefined.nu)] * @version 1.0.0 * *//*=======================================================================*/ package util{ import flash.display.Bitmap; import flash.display.BitmapData; import flash.display.Loader; import flash.events.Event; import flash.events.EventDispatcher; import flash.events.IOErrorEvent; import flash.events.ProgressEvent; import flash.net.URLRequest; import flash.system.LoaderContext; public class GroupLoader extends EventDispatcher{ private var _loader:Loader; private var dataArray:Array; private var returnArray:Array = new Array(); public function get data():Array { return returnArray; } public function GroupLoader():void { _loader = new Loader(); dataArray = new Array(); } public function addLoad(fileName:String):void{ dataArray.push(fileName); } public function start():void{ var url : URLRequest = new URLRequest(dataArray[returnArray.length]); _loader.contentLoaderInfo.addEventListener (Event.INIT,LoaderInfoInitFunc); _loader.contentLoaderInfo.addEventListener (IOErrorEvent.IO_ERROR,_ioerror); _loader.load(url,new LoaderContext(true)); } private function _ioerror(e:IOErrorEvent):void { dispatchEvent(e); } private function LoaderInfoInitFunc(e:Event):void{ var _bmp:Bitmap = _loader.content as Bitmap; returnArray.push(_bmp.bitmapData); if (dataArray.length == returnArray.length) { _loader.contentLoaderInfo.removeEventListener (IOErrorEvent.IO_ERROR,_ioerror); _loader.contentLoaderInfo.removeEventListener (Event.INIT, LoaderInfoInitFunc); dispatchEvent(new Event(Event.INIT)); }else { dispatchEvent(new ProgressEvent(ProgressEvent.PROGRESS, false, false, returnArray.length, dataArray.length)); start(); } } } }