8 Replies Latest reply on Dec 5, 2011 10:04 AM by barg27

    Internal scaleX is negative and can't be reset

    turbidity Level 1

      If you like bizarro problems, here's one for you. I'm in the process of converting an application built on Sprites into an MXML app built with UIComponents. Most of my views share a common class. One of those is showing the bizarre behavior of showing up flipped on the X axis. I put in a breakpoint, and after the component gets added to the stage, its internal scaleX property is set to -1. When I say internal property, I mean one of those marked with a $ in the variables panel. Both the scaleX and _scaleX properties show 1, but the $scaleX property shows -1. I overrode the component's setter for scaleX, and it never gets called. The component is evidently starting with the negative value of its default value of 1.


      Here's where it gets fun. If I set the scaleX to .09, the scaleX and _scaleX properties reflect this, but the internal property is set to -.08999. I know that the discrepancy in the decimal is due to floating point numbers, but I am flummoxed by the fact that the value I entered is getting reversed and set to a negative. Of course, this gives me a workaround. I can set the scaleX to -1, which makes $scaleX set to 1.


      Does anyone have an explanation, or better yet a solution to this incredibly bizarre problem? Mucho kudos to you if you do.


      One possible hint (or red herring) is that I have encountered a similar problem with the visible property on a separate component. The $visible property didn't match up with visible or _visible. The cause of the problem was putting a UIComponent into a Sprite. Changing the parent to a UIComponent fixed that oddness. However, I've checked, double-checked, and triple-checked that the display list containing this component is made of UIComponents up to the WindowedApplication root file.


      So tell me; why is my scaleX the opposite of what I set it to on this one component?