Try calling validateNow() before taking the snapshot

Alex Harui
Flex SDK Developer
Adobe Systems Inc.<http://www.adobe.com/>
Blog: http://blogs.adobe.com/aharui

From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On Behalf 
Of richmcgillicuddy
Sent: Saturday, July 11, 2009 6:53 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Catching graphics update on UIComponent





I have a UIComponent that is a component made up of a label and a background 
image. I am running a loop to update the component, change the label and copy 
the resulting bitmap to a standard image. My result is that I get the image 
without any updates. The add function just pushes the counter of the label up 1 
and updates the .text field of the label. The code looks like...

I know invalidatedisplaylist just adds a flag to a future update but how should 
this be built.

var curX :int = 10;
var curY : int = 70;
var anImage : Image;
var imageBitmapData:BitmapData ;

while (curY < this.height) {
bbMain.add(1);
if (curX < this.width) {
curX += 60;
} else {
curY += 60;
curX = 10;
}
this.invalidateDisplayList();
// Copy into new image
anImage = new Image();
anImage.width = 54
anImage.height = 54;
anImage.x = curX;
anImage.y = curY;
this.addChild(anImage);

imageBitmapData = ImageSnapshot.captureBitmapData(bbMain);
anImage.source = new Bitmap(imageBitmapData);
}


Reply via email to