Hi,

Are you storing your loaders somewhere outside the function - e.g. is imageLoader an array outside the function? If not, your loaders may go out of scope...

Also, your function imgInitialised may go out of scope because that is declared inside the loop - not 100% about this, but try putting imgInitialised outside your function that creates the loaders.

e.g. pseudo code:

var imageLoader:Array;
function loadImages() {
    for(i = 0 to lettersCount) {
        startLoading & addEventListener
    }
}

function imgInitialised(e:Event):void {
    //hello from imgInitialised.
}

HTH

Glen

On 01/07/2010 14:32, Pankaj Singh wrote:
even after using INIT i m getting 0 width because event listener function is
never called (trace statement is not working)

for (var i:int=0; i<  lettersCount; i++)
     {
         imageLoader[i].load (new URLRequest(
xmlLettersList[i].attribute("img")));
         imageLoader[i].width = imageLoader[i].addEventListener(Event.INIT,
imgInitialised);
         trace("width = " + imageLoader[i].width);
         function imgInitialised (e:Event):Number
         {
             var bm:Bitmap = Bitmap(e.target.content);
             trace("inside function image Loaded");
             return bm.width;
         }
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders



_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to