Jump to content

remove child of uipanel


gamify
 Share

Recommended Posts

i am not able to remove 3 buttons inside the popup modal but the popup modal container is removed so i need to remove all its child elements too but removeChild(panel) not woking

panel= new UiContainer(this.pos.x, this.pos.y, 450, 325,"Enter your Feedback","UIPanel");
         panel.addChild(new ButtonUI(
            30, 200,
            "green",
            "Accept",
            "accept_id1",
            UipanelButton
        ));

me.game.world.addChild(panel);

i used below code so only container is removed but not buttons (3 buttons) ,on click of the button inside panel

me.game.world.removeChild(panel);

 

Link to comment
Share on other sites

Looks like this should work: https://github.com/melonjs/melonJS/blob/91e1ca185a21f7d44b871b5542282e14c134e7a5/src/renderable/container.js#L530-L532

Put a breakpoint on me.GUI_Button.onDeactivateEvent and ensure that it is executing when the container is removed. Probably it is not, but you can breakpoint on me.Container.onDeactivateEvent and trace it down the other direction to find out where it's falling over.

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