charlie_says Posted January 30, 2020 Share Posted January 30, 2020 The title is a bt misleasing - it's trivial to use Graphics as a button, but, I'm having trouble with a particular setup. My button class is a PIXI.Container which has a PIXI.Graphic child. The interactivity and listener are attached to the Graphic (I do this so I can control the shape of the hit area, and use any Sprite I need.) Again this works fine, but when I capture the click I need to get a reference to the Container and this is the part that is proving difficult. When I look at the event target from the lick I get a refernce to the canvas - I can't see a way to get a reference to the Graphic or Container... Can anyone advise? Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted January 30, 2020 Share Posted January 30, 2020 (edited) "graphics.parent" Or do you not have link to graphics itself from event listener body? Edited January 30, 2020 by ivan.popelyshev charlie_says 1 Quote Link to comment Share on other sites More sharing options...
charlie_says Posted January 30, 2020 Author Share Posted January 30, 2020 Thanks @ivan.popelyshev I almost replied immediately, explaining that was exactly what I had been trying... Then when I reviewed the code, it transpired I need glasses (actually, I do), I'd made a typo in "event", so of course it didn't work... themoonrat and ivan.popelyshev 2 Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted January 30, 2020 Share Posted January 30, 2020 Which IDE do you use? Quote Link to comment Share on other sites More sharing options...
charlie_says Posted January 30, 2020 Author Share Posted January 30, 2020 Currently I'm using VSCode... 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.