tags:

views:

391

answers:

1

Hi,

I'm playing around with the scaleX/Y in the canvas tag and have noticed some strange behaviour. When I set scale in in mxml the width and height of the canvas are adjusted accordingly. For example if I have a canvas like this:

<mx:Canvas width="1000" height="1000" scaleX="0.1" scaleY="0.1" /> 

The canvas now appears on screen to have a width and height of 100 and if inside my creationComplete callback I check the width and height property they are indeed 100.

But if I do exactly the same thing except I set the scaleX/Y property from actionscript the canvas on screen appears to have a width and height of 100 as expected, but when I check the width and height property of the canvas they are still at the previous values of 1000.

Could anyone help me understand what is going on and also tell me if there is any method that will refresh the width and height values so that they are correct?

Thanks,

Chris

A: 

At what point in the Canvas' lifecycle are you adjusting the scaleX/Y properties in Actionscript? And then, at what point are you re-checking them?

It may be helpful to examine this white paper on Flex component lifecycles (PDF) to pick the right timing for actionscript-based visual component tweaking.

ZackBeNimble