1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
|
public function LoadTileSet(ImgPath:String)
{
var MyImgLoader:Loader = new Loader() ;
var MyImgData:URLRequest = new URLRequest(ImgPath);
MyImgLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, onProgress);
MyImgLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, onComplete);
MyImgLoader.load(MyImgData) ;
function onComplete(evt:Event):void
{
if ( IndexTile < TilesName.length - 1)
{
IndexTile++ ;
ImgPath = "img/tiles/auto/grass/Grass " + TilesName[IndexTile] + ".png";
LoadTileSet(ImgPath);
}
else
{
LoadingState = 1 ;
}
var Bt:Bitmap = Bitmap(MyImgLoader.content) ;
GrassTilesData.push(Bt.bitmapData) ;
}
function onProgress(evt:ProgressEvent):void
{
}
} |
Partager