I am loading 50-ish something images using an Image control wrapped in
a repeater wrapped in a VBox component. I want to do some stuff once I
know the full dimensions of the VBox, which is when all the images
have been loaded.
Here is the code snippet:
<mx:VBox id="imgBx">
<mx:Repeater id="rp" dataProvider="{dp}">
<mx:Image id="img" width="120" height="80"
source="{dp_arr[rp.currentIndex]}" complete="onImgComplete(event);"/>
</mx:Repeater>
</mx:VBox>
/**AS3*/
private function onImgComplete(event:Event):void
{
if(imgCounter<imgTotal-1)
{
imgCounter++;
}else
{
configure();
}
}
Everything seems work fine at this point. The problem comes when I try
to immigrate the onImgComplete() from inline MXML into ActionScript,
basically as an event handler for this component like so:
creationComplete="img.addEventListener(Event.COMPLETE, onImgComplete);"
I got the following error:
"TypeError: Error #1006: addEventListener is not a function."
Any lead? Thanks.