I have problem with moving bitmap array on second timer loop. I think this problem is related to the loop addchild was in, not sure how to solve it.
The current code does create 14 images in a strip, the problem was I could’t move them with another timer or just outside the completeListener function.
import flash.display.Bitmap;
import flash.display.Loader;
import flash.display.Sprite;
import flash.events.Event;
import flash.net.URLRequest;
var iamount=new String;
var effects=new Timer(500,0);
var i:int ;
var ii:int ;
var slot:int;
i=1;
ii=1;
slot=0;
iamount=14;
var gfx:Array = new Array();
for (i; i<iamount; i++) {
var imagefile:URLRequest=new URLRequest("http://????????/port/img/"+i+".JPG");
var loader:Loader = new Loader();
loader.load(imagefile);
loader.contentLoaderInfo.addEventListener(Event.COMPLETE,completeListener);
function completeListener(e:Event):void {
slot+=1;
gfx*=new Bitmap(e.target.loader.content.bitmapData);
addChild(gfx*);
gfx*.width=128;
gfx*.height=96;
gfx*.y=460;
gfx*.x=(180*slot)-(iamount*100);
}
}
effects.addEventListener(TimerEvent.TIMER,effectsTime);
effects.start();
function effectsTime(event:TimerEvent):void {
for (ii; ii<iamount; ii++) {
if (mouseX>522) {
gfx[ii].x-=2
trace(">>");
}
if (mouseX<502) {
gfx[ii].x+=2
trace("<<");
}
}
}
TypeError: Error #1010: A term is undefined and has no properties.
at alpha_fla::MainTimeline/effectsTime()
at flash.utils::Timer/_timerDispatch()
at flash.utils::Timer/tick()
on the gfx[ii] part. I have no idea