Skip to main content
Participant
November 8, 2006
Question

[PLEASE TRY] _rotation and dimension

  • November 8, 2006
  • 6 replies
  • 290 views
please try this code ( published here):

I think it should be always a square, but when rotation is different from 90 or 180 it change in a rectangle...

seem that flash change scale one dimension when I change the orher...

any hint?
This topic has been closed for replies.

6 replies

Inspiring
November 8, 2006
It's a bug in Flash Player.

Values you GET from _width and _height are not what you SET it .. setting
_width/_height means something completely different from setting it.

When you GET the _width, Flash first applies ALL the transforms (rotate,
skew, scale) and then takes the width (in parent object coordinate space)

When you SET the _width, Flash simply adjusts the _xscale with the same
proportion as you changed the _width by. Then means, if the object is
rotated 90deg, changing the _width actually changed the _height.

NOTE: Inside Flash (the authoring tool) everything works correctly .. the
width and height fields behave the way _width and _height should. Its only
in the player you get this long standing bug happening.
--
Jeckyl


Inspiring
November 8, 2006
FYI, I tried with F9 AS3 and the results were the same. So I guess it is "as
designed" :)


c_3_kAuthor
Participant
November 8, 2006
thank you very much for your help, other comments appreciated.
Inspiring
November 8, 2006
Probably is a bug. I've seen archived message board stuff relating to
rotation and scaling problems dating back to flash 3. But it's a simple work
around.


c_3_kAuthor
Participant
November 8, 2006
...double post...
c_3_kAuthor
Participant
November 8, 2006
ok, thank you, it works saving the rotation before.

but you agree that this is a bug to be reported to adobe or there's any logic that I haven't understood?
Inspiring
November 8, 2006

You could reset the rotation before sizing:

on (release) {
var save_rot:Number = this._rotation;
this._rotation =0;

r = 1+random(20);
this._width = 10*r;
this._height = 10*r;

this._rotation = save_rot + 90;

trace(this._width / this._height) //should be always = 1
}