v_nastey Posted July 31, 2014 Share Posted July 31, 2014 I'm new into pixi, and what I have is a button that has a texture and a movieclip. On a click on the button, I want to remove the texture and to have the moveclip. In other words i have this: var back = PIXI.Texture.fromFrame("image.png");var mc = new PIXI.MovieClip(someAssets);mc.setTexture(back); What I need to do is when I click the mc button, to remove the texture and preview just the movieclip. How can i do it? Quote Link to comment Share on other sites More sharing options...
Sebi Posted July 31, 2014 Share Posted July 31, 2014 I'm new into pixi, and what I have is a button that has a texture and a movieclip. On a click on the button, I want to remove the texture and to have the moveclip. In other words i have this: var back = PIXI.Texture.fromFrame("image.png");var mc = new PIXI.MovieClip(someAssets);mc.setTexture(back); What I need to do is when I click the mc button, to remove the texture and preview just the movieclip. How can i do it?I don't get what you are trying to do. Can you show the code of your "button"?Or could you provide an better example?To toggle the visibility of elements, you can just do:buttonSprite.click = function() {backSprite.visible = false;movieClip.visible = true;}; Quote Link to comment Share on other sites More sharing options...
v_nastey Posted July 31, 2014 Author Share Posted July 31, 2014 Basicly the movieclip is the button. the movieclip contains a array of images that are displayed. So for start what i want to do is to put a texture over the movieclip and when i click on the movieclip, to remove the texture and gave the original image that has the movieclip itself. Quote Link to comment Share on other sites More sharing options...
Sebi Posted July 31, 2014 Share Posted July 31, 2014 You could try this:var textures = [ back, other, other, ... ];var mc = new PIXI.MovieClip(textures);mc.interactive = true;mc.click = function() { if(mc.textures[0] === back) { mc.textures.shift(); // remove first element mc.gotoAndPlay(0); }}; 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.