Не судите строго, AS изучаю буквально второй день... Знаю несколько других языков прикладных, и там как-то проще все это. В двух словах что реализуется: есть массив карты с координатами и индексами текстур, через load делаю подгрузку двух картинок(
по мне очень криво), далее должен идти вывод карты на экран, но тут первая проблема, load живет своей жизнью, и весь скрипт его не ждет... т.е должен происходить вывод картинок, а их как бы нет. И 2 вопрос, как можно создать массив текстур (1.jpg,2.jpg,3.jpg,4.jpg) с подгрузкой картинок, и далее накладывать (копировать,клонировать) их на другие объекты? Пожалуйста не судите строго..

Код AS3:
package
{
import flash.events.*;
import flash.display.*;
import flash.net.*;
import flash.geom.*;
import flash.text.*;
public class Main extends Sprite
{
public var imageLoader:Loader = new Loader();
public var imageLoader1:Loader = new Loader();
public static var masmap:Array = new Array();
public static var masmap_texture:Array = new Array();
public static var bmp:Bitmap;
public static var bmp1:Bitmap;
public static var bmpmas:Array = new Array();
public static var bmpmasindex:int;
public function Main():void
{
bmpmasindex = 0;
masmap[0] = 'x0y0';
masmap_texture[0] = 0;
masmap[1] = 'x1y0';
masmap_texture[1] = 0;
masmap[2] = 'x2y0';
masmap_texture[2] = 1;
masmap[3] = 'x0y1';
masmap_texture[3] = 0;
masmap[4] = 'x1y1';
masmap_texture[4] = 1;
masmap[5] = 'x2y1';
masmap_texture[5] = 0;
masmap[6] = 'x0y2';
masmap_texture[6] = 0;
masmap[7] = 'x1y2';
masmap_texture[7] = 0;
masmap[8] = 'x2y2';
if (stage) init();
else addEventListener(Event.ADDED_TO_STAGE, init);
var theURL:String = "../img/map/mapmini1.png";
var imageRequest:URLRequest = new URLRequest(theURL);
imageLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, onComplete);
imageLoader.load(imageRequest);
var theURL1:String = "../img/map/mapmini2.png";
var imageRequest1:URLRequest = new URLRequest(theURL1);
imageLoader1.contentLoaderInfo.addEventListener(Event.COMPLETE, onComplete1);
imageLoader1.load(imageRequest1);
var index_texture:int; var selectindex:int; var temp_string:String;
for (var ix:int = 0; ix <= 3; ix++) {
for (var iy:int = 0; iy <= 3; iy++) {
temp_string = String('x') + String(ix) + String('y') + String(iy);
selectindex = masmap.indexOf(temp_string);
trace(temp_string);
switch (index_texture)
{
case 0:
trace ("Вывод первой текстуры");
break;
case 1:
trace ("Вывод сторой текстуры");
break;
}
}
}
}
public function onComplete(evt:Event):void
{
bmp = imageLoader.content as Bitmap;
//addChild(imageLoader.content);
bmpmas[bmpmasindex] = new Bitmap(bmp.bitmapData);
bmpmas[bmpmasindex].x = 100;
bmpmas[bmpmasindex].y = 100;
addChild(bmpmas[bmpmasindex]);
bmpmasindex++;
//bmpmas[bmpmasindex] = new Bitmap(bmp.bitmapData);
//bmpmas[bmpmasindex].x = 100;
//bmpmas[bmpmasindex].y = 100;
//addChild(bmpmas[bmpmasindex]);
//bmpmasindex++;
var bmp3 = new Bitmap(bmp.bitmapData);
bmp3.x = 200;
bmp3.y = 200;
addChild(bmp3);
trace ("Img Complete");
}
public function onComplete1(evt:Event):void{
bmp1 = imageLoader1.content as Bitmap;
//addChild(imageLoader1.content);
//imageLoader1.content.x = 200;
//var bmp2 = new Bitmap(bmp.bitmapData);
//bmp2.x = 300;
//bmp2.y = 300;
//addChild(bmp2);
}
private function init(e:Event = null):void
{
removeEventListener(Event.ADDED_TO_STAGE, init);
// entry point
}
}
}