clark Posted January 22, 2014 Share Posted January 22, 2014 Hey Is anyone here familiar with AS3? I have a situation where I want to dispatch an event (non interaction). For example, imagine an apple falling. I want to say:if (apple.hitGround){ this.dispatchEvent( blah..... )}How does one do something similar in PIXI? My Apple extends PIXI.DisplayObjectContainer. Quote Link to comment Share on other sites More sharing options...
xerver Posted January 22, 2014 Share Posted January 22, 2014 The code you wrote is perfectly fine. Just make sure to use the Emitter mixin. Quote Link to comment Share on other sites More sharing options...
clark Posted January 23, 2014 Author Share Posted January 23, 2014 Thanks! I do not really understand the EventTarget.js class. http://www.goodboydigital.com/pixijs/docs/files/src_pixi_utils_EventTarget.js.html#l6The MrDoob class is 404. I can only appear to find EventDispatcher.js and the example in the source does not make much sense to me. So back to an example, I have an Apple. Inside the constructor of the Apple, I would want to call:PIXI.EventTarget.call(this); //mixes in event target stuffAnd doing this would give Apple the ability to dispatch/add/remove events?In the global space containing my Apple.....this._apple.addEventListener(type, someFunction)And back in the apple:this.dispatchEvent(type); Quote Link to comment Share on other sites More sharing options...
clark Posted February 7, 2014 Author Share Posted February 7, 2014 I never managed to figure this out. Does anyone know how to mixin Emitter functionality with TypeScript? Quote Link to comment Share on other sites More sharing options...
xerver Posted February 7, 2014 Share Posted February 7, 2014 The code posted is again fine, if you can show an actual non-working code example I can help you further. 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.