Question

I'm trying to figure out how to set z coordinate of a dynamic text. x and y are possible. For example, I have a dynamic text with instance name of greetMe. I can set it's y and x position by

greetMe.y = 100;
greetMe.x = 200;

Though there's no error when I tried

greetMe.z = -100

, it is still not working. I tried to see the transform button but the menu is lock or unclickable. Is there any way to set the z-coordinate of a dynamic text?

I just wanted to hide first my dynamic object behind then when the user click a button, it will show up.


Thanks to sweet. The best idea is to set its visibility false then when the button has been clicked, it will show up by visibility of true.

greetMe.visible = false;

then... to make it visible...

greetMe.visible = true;
Was it helpful?

Solution

Sounds like all you want to do is hide the textField initially and reveal it later. If this is the case you can simply set the field's visible property.

// Hide the field initially
greetMe.visible = false;  

// And show it when required
greetMe.visible = true;

If you need to put the textfield behind your button, you can use the swapChildren method of DisplayList. From the documentation):

Swaps the z-order (front-to-back order) of the two specified child objects. All other child objects in the display object container remain in the same index positions.

swapChildren(greetMe, myButton);

Or you could use setChildIndex to ensure the textField is at the bottom of the displayList like so (documentation):

setChildIndex(greetMe, 0); 
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top