AS3:: How can a global var take over a value which appears in a listenerEvent

So this is what i’m working on:
I have two calsses: **MINIATURKA **which loads images from url,
and MINIATURKI which loads an XML file and creates an Array of class MINIATURKA(loaded jpg)

The problem is, that the img have different widths, and I want to locate all images in a row one next to the another, so the creating of the Array code should look like this:

xml1 = new XML(URLLoader(event.target).data);
var i:Number;
var currentX:Number = 0;
mini = new Array(xml1.obrazek.length());            
count = xml1.obrazek.length();
for (i=0; i<count; i++)
{   
    mini* = new Miniaturka(xml1.obrazek*.attribute("id"),i);
    addChild(mini*);
    mini*.x = currentX;
    currentX += mini*.width;
}

But the problem is that when i trace the *mini.width **it is the same as the this value [889] in the code od class **MINIATURKA: buton.graphics.drawRect(0, 0, 889, 500);
**
HERE IS THE CODE OD CLASS MINIATURKA:

[COLOR=#000000]public function Miniaturka(id:String, index:Number):void {
   var je:JPGSizeExtractor = new JPGSizeExtractor();
   this.id = id;
   this.index = index;
   tryb = false;
   var loader:Loader = new Loader();
   loader.load(new URLRequest("images/" + id + "m.jpg"));
   loader.contentLoaderInfo.addEventListener(Event.COMPLETE, nLoadComplete);

   je.addEventListener( JPGSizeExtractor.PARSE_COMPLETE, sizeHandler);
   je.extractSize("images/" + id + "m.jpg");

   function sizeHandler( e : Event ) : void {
        trace(je.width);
   }

   button = new Sprite();
   button.graphics.beginFill(0x000000, 0);
   button.graphics.drawRect(0, 0, 889, 500);
   button.graphics.endFill();
   button.buttonMode = true;
   addChild(button);

   button.addEventListener(MouseEvent.MOUSE_OVER, onOver);
   button.addEventListener(MouseEvent.MOUSE_OUT, onOut);
   button.addEventListener(MouseEvent.CLICK, onClick);
}[/COLOR]

[LEFT][COLOR=#000000]I can’t put the creation of button sprite into the sizeHandler function, because the mini.width* will trace as 0 :confused:
[/COLOR][COLOR=#000000]The proper value traces the:** trace(je.width); **from the above code. How to make the: je.width value work in this line as: **button.graphics.drawRect(0, 0, je.width, 500);
**[/COLOR][COLOR=#000000]Is it even possible?
[/COLOR][COLOR=#000000]Or is there another way to send the value direct to the another class?

http://www.adartis.pl/#portfolio - I’m trying to make a universal gallery like on this webside[/COLOR][/LEFT]