//Placing Picutes On Stage
var imageXCord:Number = 0;
var imageXMulti:Number = 121;
function eventResponse(e:MouseEvent):void
{
trace("click" + e.currentTarget.name);
}
for (var i:Number=0; i<=picQTY; i++)
{
this[imageXCord] = new UILoader();
this[imageXCord].source = imgSrcArray*;
this[imageXCord].scaleContent = false;
this[imageXCord].x = imageXCord;
addChild(this[imageXCord]);
this[imageXCord].addEventListener(MouseEvent.CLICK, eventResponse);
imageXCord += imageXMulti;
trace(imageXCord);
}
Output:
121
242
363
484
605
726
847
968
1089
1210
1331
- addition Output if i click on UILoader that was added to stage.
clickinstance2
clickinstance8
clickinstance14
clickinstance20
clickinstance26
clickinstance32
- i am confused how entire thing assigns instance names of UILoader i presume. how come it assignes names in such manner
- how can i assign that instance name my self in case of above code, or instead of dynamicaly populating variable and adding UILoader in such way
- and how can i access these instances at the most of UILoader.
hope this makes sence.