Set sprite width or height without scaling it's children

Posted by Gabi Barrientos on Stack Overflow See other posts from Stack Overflow or by Gabi Barrientos
Published on 2012-10-01T20:56:38Z Indexed on 2012/10/01 21:37 UTC
Read the original article Hit count: 255

Filed under:
|
|
|

I am trying to dynamically change the width and height of a Sprite object, which is a container for other similar Sprite objects. The container object automatically changes it's size according to the size of it's children, but when I change the position of the children objects, the size of the container stays the same and it's children appear to be placed outside of the container.

I tried to solve this problem by using something like this:

if (container.width < (child.x + child.width)) { container.width = (child.x + child.width); }

but when I use this code, the container object's children are scaled.
Is there a way to change the container's size without scaling it's children?

© Stack Overflow or respective owner

Related posts about actionscript-3

Related posts about size