0

ATTEMPTING:

Loading a movie clip (NoScale_mc) into a scaled movie clip (Scaled_mc).

ISSUE:

When I load the movie clip NoScale_mc into Scaled_mc it obviously scales too.

QUESTION:


How can I keep the NoScale_mc in THE EXACT SAME POSITION and THE EXACT SAME SCALE but yet still load it into the Scaled_mc using the addChild() method?


Papa De Beau
  • 3,744
  • 18
  • 79
  • 137
  • 1
    You can't. Children scale and move with their parent. Place it ontop. – Marty Apr 26 '12 at 05:19
  • I understand a person can't scale and move the position without affecting the child. But it is possible, if the MC is static, to move another MC into it and keep the same postitions. MyMC.x = MyMC.x - OtherMC.x; etc... But the question is can we do that with SCALE? @ilollar is on the right track I believe. One would have to see how much the MC is scaled and add/subtract that to the MC that is being loaded. I believe this should work but I can't figure out the math part. – Papa De Beau Apr 26 '12 at 19:32
  • P.S. I kind of need to do this because I am loading MC's to android devices and the "Main.swf" is being scaled to fit devices. – Papa De Beau Apr 26 '12 at 19:35
  • @PapaDeBeau Can you tell me how my suggestion is not working? You said "it is on the right track", but then said you couldn't figure out the math - what is not working with the math I gave? If I know how it isn't working, I may be able to update my answer with something that does work. – redhotvengeance Apr 27 '12 at 00:39
  • @Marty, any ideas how to keep the position? We got the scale to work and keep the same size. :) – Papa De Beau Apr 30 '12 at 17:40

1 Answers1

2

You could do a little reverse tirckery with math to try to accomplish this. So get the scaled values of the parent DisplayObject and use those values to inverse-scale the child DisplayObject.

For instance, the parent DisplayObject is scaled to: scaleX = 1.45 and scaleY = 4.6. So you can set the child DisplayObject to: scaleX = 1/1.45 and scaleY = 1/4.6.

This may produce odd results though, and will most-likely end up being a headache to maintain. You're probably better off adding the child DisplayObject to the stage on top of the parent, like Marty Wallace said. If you want to keep it looking aligned with the parent DisplayObject, then just set both of their x and y positions to the same thing (or with an offset, if that is what is desired).

redhotvengeance
  • 27,446
  • 10
  • 49
  • 54
  • Brilliant! I knew it was possible. Now I just got to get the x and y positions to stay the same. I had it at one time. I just have to remember code. Any ideas? :) If not no worries. :) – Papa De Beau Apr 29 '12 at 23:40
  • Take look at the [globalToLocal](http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/display/DisplayObject.html#globalToLocal()) and [localToGlobal](http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/display/DisplayObject.html#localToGlobal()) methods - they should help you out. – redhotvengeance Apr 30 '12 at 21:15