Wesley W Posted January 15, 2016 Share Posted January 15, 2016 Hi, This is my codepen : http://codepen.io/WW/pen/LGzpVv what i wanna do is trying click on stage and get the mouse position value, but, there's nothing happens while clickiing on stage. the official example looks working great : http://pixijs.github.io/examples/index.html?s=demos&f=graphics-demo.js&title=Graphics but mine isn't. so, anyone any idea? thanks for help. PS : i guess the problem might because the stage width & height isn't fit to the renderer. just guess, still trying.... Quote Link to comment Share on other sites More sharing options...
bubamara Posted January 15, 2016 Share Posted January 15, 2016 It isn't working, because you have empty container. In this case you need to set hitArea for it : stage = new PIXI.Container(); stage.interactive = true; stage.hitArea = new PIXI.Rectangle(0, 0, w, h); and adjust it in on_resize() stage.hitArea.width = w; stage.hitArea.height = h; Wesley W 1 Quote Link to comment Share on other sites More sharing options...
Wesley W Posted January 15, 2016 Author Share Posted January 15, 2016 wow, it works. thanks for great help. Quote Link to comment Share on other sites More sharing options...
Exca Posted January 15, 2016 Share Posted January 15, 2016 You have nothing on the stage so nothing gets clicked. Add something and the click events are triggered. Also setting the stage width & height will scale the stage based on the width and height of stage. For example if you have a child in stage that is 100x100 px then setting the width and height of stage would be same as saying: stage.scale.x = w/100; stage.scale.y = h/100; Wesley W 1 Quote Link to comment Share on other sites More sharing options...
Wesley W Posted January 15, 2016 Author Share Posted January 15, 2016 ok, thanks for ur kind reminder. 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.