gamify Posted March 1, 2017 Share Posted March 1, 2017 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); Quote Link to comment Share on other sites More sharing options...
Parasyte Posted March 1, 2017 Share Posted March 1, 2017 How is your ButtonUI class listening to PointerEvents? Do you ever call releasePointerEvent when the button is destroyed? Quote Link to comment Share on other sites More sharing options...
gamify Posted March 2, 2017 Author Share Posted March 2, 2017 ButtonUI = me.GUI_Object.extend({ onClick : function (/* event */) { if(this.id == 'close_id3'){ me.game.world.removeChildNow(panel); } } }); Quote Link to comment Share on other sites More sharing options...
gamify Posted March 2, 2017 Author Share Posted March 2, 2017 i don want only that button to destroy i need all buttons and textbox to be destroyed Quote Link to comment Share on other sites More sharing options...
Parasyte Posted March 3, 2017 Share Posted March 3, 2017 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. Quote Link to comment Share on other sites More sharing options...
gamify Posted March 7, 2017 Author Share Posted March 7, 2017 okay thank you it's working Quote Link to comment Share on other sites More sharing options...
Parasyte Posted March 8, 2017 Share Posted March 8, 2017 Out of curiosity, what did you do to fix it? Quote Link to comment Share on other sites More sharing options...
gamify Posted March 13, 2017 Author Share Posted March 13, 2017 onDeactiveEvents and jquery remove function used Quote Link to comment Share on other sites More sharing options...
gamify Posted March 13, 2017 Author Share Posted March 13, 2017 onDeactivateEvent:function(event){ $("#label1").remove(); $("#label2").remove(); me.game.world.removeChild(panel); } Quote Link to comment Share on other sites More sharing options...
Parasyte Posted March 14, 2017 Share Posted March 14, 2017 Oh, you're using DOM elements. That explains it. Quote Link to comment Share on other sites More sharing options...
gamify Posted March 14, 2017 Author Share Posted March 14, 2017 yup Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.