Jump to content

onRemoved from child


dmko
 Share

Recommended Posts

You should change handler function in parent, so that when removed it removes its children.

parent.once('removed', function(){
    console.log('parent removed');
    parent.removeChild(child);
    // or if you want to make it more universal
    // parent.children.slice().forEach(function(c){
    //      parent.removeChild(c)});
    
});

https://jsbin.com/xusocineku/edit?js,console,output

 

Link to comment
Share on other sites

Yeah - that technically works in this small example, but in general is there no way for a DisplayObject to detect when it's been removed from the scene graph unless it was explicitly from a removeChild()?

Link to comment
Share on other sites

hrm I'm a little worried about using a different fork... I kinda just want to `npm install pixi` and be off to the races...

I hope your features make it in! 

Pixi 5 is a ways away though, no? it's still alpha?

Link to comment
Share on other sites

  • 2 years later...

I made it several times in my projects, including my own flash API, its just I do not have enough time and enough motivation from people to make it into pixi plugin. Here what was rejected in pixijs : https://github.com/pixijs/pixi.js/pull/4586 

Yes, maybe in a month or two i'll finally make it into a plugin - but that'll be whole separate tree, not just a simple "Stage" element.

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...