Jump to content

deep and child


roxor45
 Share

Recommended Posts

hi all ,

I have make some button in my script for show/hide some object like that :
 

var background = PIXI.Sprite.fromImage('images/sol2.jpg');
app.stage.addChild(background);
var varbg = 1;




function backg() {
	if (varbg < 1) {
	app.stage.addChild(background);
	varbg = 1;
	}
else 
	{
	 (varbg > 0)
	app.stage.removeChild(background);
	varbg = 0 ;	
	}
}

in the beginning my other object ( like bunny) , it's in front of the background.

When I clic on button for hide background, it's ok my background disapear like a charm .

but when a REclick on my button for show the background , my background reapear on the front of the canvas , Over my other object :( .

 

So, my question is : It's possible to add a deep level at a child ?

 

thanks for your help

Link to comment
Share on other sites

7 hours ago, Exca said:

In this case you could also just say .visible = false / true to keep layering constant.

thanks for this idea ! it's work !

function backg() {
	if (varbg < 1) {
	background.visible = true;
	varbg = 1;
	}
else 
	{
	 (varbg > 0)
	background.visible = false;
	varbg = 0 ;	
	}
}

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...