0 Replies Latest reply on Jul 11, 2006 7:03 AM by audio:theory

    _width & _height VS. _xscale & _yscale - the wierdness continues!


      I had a problem which I've just "fixed" (quotes used for emphasis as I have NO idea why the "fix" works!).
      I found a whole bunch of similar threads but none exactly like the issue I was facing.

      I'm working on a class which creates a TextField within a container MovieClip. The class has an Object called destination which store's "destination" properties of the MovieClip - _x, _y, _height, _width, _rotation etc.
      The class also has a function called resetState() which copies all the properties in the destination object to the MovieClip (thus reseting the MovieClip's state to that of the destination object).

      Everything worked fine. I'd set destination._x to 200, call resetState() and as expected the MovieClip's _x property would be set to 200.
      However, if I set destination._height or destination._width and call resetState() nothing happens!?!
      After much hair pulling I tried destination._yscale = 200 and magically the MovieClip's _yscale property changed to 200!

      Now, here's the really strange part. Below is the code for resetState() all pretty simple stuff:

      public function resetCurrentState() {
      for( var prop in _dest)
      _mc[prop] = _dest[prop];

      And here is how I got resetState() to change the MovieClip's _width and _height:

      public function resetCurrentState() {
      for( var prop in _dest)
      _mc[prop] = _dest[prop];

      _mc._width = _dest._width;
      _mc._height = _dest._height;

      :confused: :confused: :confused:

      I understand that loading dynamic data (images/MovieClips etc.) can cause a similar problem if time is not allowed for the data to be fully loaded, however this is a simple MovieClip with no external data used - hell I'm not even trying to access the _width and _height property's until some time after the MovieClip has been created!?

      If anyone has any idea's as to why the _width and _height propertys have to be implicitly set I'd really like know!