Set group Height

Recommended Posts

Do anyone knows how to set the height of a group ?


this.upperContainer =;

this.upperContainer.height = 500;



/// Outputs zero 0


If I change the  x or y the group moves properly in the canvas, but I want to change the height and width

so I can add objects into that group that make calculations according to the height and width of this group container.



any ideas?

Share this post

Link to post
Share on other sites

group.height actually uses a setter function that tries to scale the group from its previous height value, which it gets by checking the bounds of all the children in the group. If the group's height is 0, which it would be if it's empty, then it would remain 0. Add something with non-zero bounds to the group and try it again.


Are you trying to change the height value without side effects? If it's purely application-level record keeping I'd add a different member variable to your group instead of touching something the framework uses.

Share this post

Link to post
Share on other sites

oh I see.. so the group size will be as big or as small as the objects take space inside of it.

I see.. 


FYI: I did add some objects inside the group and then printed the height again.. it is now > 0 

I kinda wanted to add objects inside the group using the group height and width. Like adding a sprite just in the center of the group, not the canvas. 

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.