Search

Archive for March, 2009

Resizing a Parent Sprite Without Resizing the Child Sprite

Posted by Nate Chatellier on March 26th, 2009

A co-worker approached me with a problem today. He wanted to resize a parent Sprite (or MovieClip, DisplayObject, etc) without resizing the child Sprite. So, in a nutshell, here's how you do it:
PLAIN TEXT
ACTIONSCRIPT:

_mcParent._mcChild.scaleX = 1 / _mcParent.scaleX;

_mcParent._mcChild.scaleY = 1 / _mcParent.scaleY;

_mcParent._mcChild.x = _nChildStartX / _mcParent.scaleX;

_mcParent._mcChild.y = _nChildStartY / _mcParent.scaleY;

And here's a simple demo [...]