00:00
00:00
mike
hello!

Mike Welsh @mike

Age 39, Male

stupids

Penn State

San Diego

Joined on 2/24/00

Level:
23
Exp Points:
5,598 / 5,880
Exp Rank:
8,641
Vote Power:
6.47 votes
Rank:
Police Captain
Global Rank:
3,970
Blams:
1,268
Saves:
1,004
B/P Bonus:
16%
Whistle:
Normal
Trophies:
14
Medals:
916
Supporter:
10y 7m 13d
Gear:
1

Thanks for the thorough post Mike. I'm trying to create a solution that automatically sets scaleX to -1 if the stage placed instance is horizontally flipped, so that going forward I can just assume all left facing mc's are properly represented by scaleX being negative (otherwise I've been making them all face right and then flipping them programmatically as needed, which I'd rather not have to do).

I get that -scaleY and 180 rotation is equivalent to -scaleX. However, Flash CS3 is setting both scaleY and scaleX to positive and rotation to 180. Perhaps that's because of the sign ambiguity, I didn't take the time to fully understand the math here. However, if all I do is set the transform.matrix back to itself, then scaleY all of a sudden goes negative, so that it now works as I would expect, and I can then convert 180 rotation negative scaleY to negative scaleX as needed. Since all I did was set the matrix to what it currently is (the a,b,c,d values it already knew), this seems like a Flash bug that scaleY is not getting set to negative initially.

Here's the solution I came up with:
obj.transform.matrix = obj.transform.matrix; //resets scaleY to expected value
if(obj.scaleX > 0 && obj.scaleY < 0 && Math.abs(obj.rotation) > 90){
obj.scaleX *= -1;
obj.scaleY *= -1;
obj.rotation -= 180;
}