RE: [flexcoders] Re: Catching graphics update on UIComponent

2009-07-13 Thread Alex Harui
Does it appear correctly on screen but just not in the snapshot?  Maybe try 
using callLater to defer 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: Monday, July 13, 2009 2:51 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Re: Catching graphics update on UIComponent





Alex,

I tried this with Flex 2.01 and it did not work properly. Still the same 
number. The updated code looks like:

currentNum += thisAmount;

lblNumber.text = String(currentNum);
this.validateNow();

Still get a grid of the same initial value.

Rich

--- In flexcoders@yahoogroups.com<mailto:flexcoders%40yahoogroups.com>, Alex 
Harui  wrote:
>
> 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:flexcoders%40yahoogroups.com> 
> [mailto:flexcoders@yahoogroups.com<mailto:flexcoders%40yahoogroups.com>] On 
> Behalf Of richmcgillicuddy
> Sent: Saturday, July 11, 2009 6:53 PM
> To: flexcoders@yahoogroups.com<mailto:flexcoders%40yahoogroups.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);
> }
>



[flexcoders] Re: Catching graphics update on UIComponent

2009-07-13 Thread richmcgillicuddy
Alex,


I tried this with Flex 2.01 and it did not work properly. Still the same 
number. The updated code looks like:

currentNum += thisAmount;

lblNumber.text = String(currentNum);
this.validateNow();

Still get a grid of the same initial value.

Rich


--- In flexcoders@yahoogroups.com, Alex Harui  wrote:
>
> Try calling validateNow() before taking the snapshot
> 
> Alex Harui
> Flex SDK Developer
> Adobe Systems Inc.
> 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);
> }
>