views:

638

answers:

2

Hello Flexers,

I have what seems a straighfoward situation:

I update the source property of an image, when the image is loaded i want to redraw the border skin to fit the new size of the image.

newImgEdit.addEventListener(Event.COMPLETE, loadImgComplete);
newImgEdit.source = myurl_ressource;

private function loadImgComplete(evt:Event):void {
 trace("redraw !!");
 //invalidateDisplayList();
 this.setStyle("borderSkin", ShapeContainerBorderOn);
 var img:Image = evt.currentTarget as Image;
 img.removeEventListener(Event.COMPLETE, loadImgComplete);
}

The "trace redraw" seems to happen once the image is loaded but the border still do not get redrawn with the good height and width.

Do i need to remove the listerner or it will be garbage collected later ? Any clues ?

A: 

You should be able to call validateNow() on the item you want to re-layout.

(See 'Manually forcing layout' on http://livedocs.adobe.com/flex/3/html/help.html?content=size_position_2.html)

Simon Groenewolt
A: 

It dit not redraw the border at the good size :/

coulix