Jump to content

Working with Events in PIXIjs


clark
 Share

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. 

Link to comment
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);



 

Link to comment
Share on other sites

  • 2 weeks later...

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...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...