Sign in to follow this  
clark

Working with Events in PIXIjs

Recommended Posts

Hey :D

 

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. 

Share this post


Link to post
Share on other sites

Thanks! 

 

I do not really understand the EventTarget.js class. 

http://www.goodboydigital.com/pixijs/docs/files/src_pixi_utils_EventTarget.js.html#l6

The 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 stuff

And 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);



 

Share this post


Link to post
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.