Home > Blog > AS3 Pitfalls – Dude, where’s my _xscale?

AS3 Pitfalls – Dude, where’s my _xscale?

PROBLEM:

MovieClip._xscale (or MovieClip.xscale) does not light up as a recognized property in AS3. It’s not even listed as a property of the MovieClip class in the documentation. What gives?

SOLUTION:

_xscale and _yscale properties have been replaced by scaleX and scaleY, which are both properties of the DisplayObject class. MovieClip (eventually) extends DisplayObject and inherits these properties.

The second snag is that scaleX and scaleY percentages are now divided by 100. Whereas before, MovieClip._xscale = 100 displayed the clip at its native width, MovieClip.scaleX = 1.0 is the new hotness.

1
MovieClip._xscale = 100; // Displays an object at its full width in Actionscript 2
1
MovieClip.scaleX = 1.0; // Displays an object at its full width in Actionscript 3

Take care when porting AS2 files to AS3.

Ryan Henson Creighton is a Toronto-based game developer, and founder of Untold Entertainment Inc., specializing in online games for kids, teens, tweens and preschoolers.
Ryan Henson Creighton
Ryan Henson Creighton
View all posts by Ryan Henson Creighton

Popularity: 7% [?]

Rate this Post:
1 Star2 Stars3 Stars4 Stars5 Stars (1 votes, average: 5.00 out of 5)
Loading ... Loading ...
                      

                                 
 

One Response to “AS3 Pitfalls – Dude, where’s my _xscale?”

  1. You’d think xscale would make sense with AS3′s far more logical naming conventions… but anyway thanks for the tip, glad it didn’t take me all day trying to find it!

Leave a Reply