Quick Links: Download Gideros Studio | Gideros Documentation | Gideros Development Center | Gideros community chat | DONATE
Controlling width of sprite — Gideros Forum

Controlling width of sprite

ar2rsawseenar2rsawseen Maintainer
edited June 2012 in General questions
just wanted to know if anyone has a hack to control width of sprite (or similar element). First I encountered the problem, where I needed to set bigger width, than it's actually is, and it was easy, I used 1px wide transparent Shape element (I call spacer) to position in the bottom right corner, to make is as wide as I needed.
Problem is that now I need to make it smaller than it's actually is. Here's the scenario. I have elements at random positions from -1000 to 1000 px on x and y axis, tweening to their destination position. So as you've guessed the container of all these elements can be up to 2000 px wide (withal the width varies).
So if I want to for example center my container on the screen (and target elements there), problem is that through out the tweening, width changes and in the end container is not centered.
Position of container needs to be set before tweening.
And as it is a component I'm creating for general use (like button class), I would like to try make it without any restrictions of when and how to set position etc.
Right now my only option is to check absolute maximal boundary and use spacer element to make sure center of my container does not move, meaning it's right in the middle of the container all the time. But that seems like an ugly solution for now. As width of this container would be returned as large value. Which is bad for generic component. Maybe someone has better idea? :)

TLDR; Do you know a way to set width of sprite, although other elements (children of sprite) go beyond that width


Sign In or Register to comment.