Using event listeners?


(Blake Jones) #1

Is there any way to use event listeners in flashpunk?

It seems the class has to extend Sprites for event listeners to work. I can add classes that extend Entity.

However, I can’t add classes that extend Sprite. Is there anyway to use classes that extend Sprite in flashpunk?


(Nate ) #2

I’m not sure! But I might have an alternate answer if you tell me what you are trying to do!


(Blake Jones) #3

Ok so I saw here that you can use an event listener to handle rightclick events: http://www.emanueleferonato.com/2012/06/04/easily-handle-right-mouse-button-in-flash-movies/

And i’d really like to have that option in my project, however it seems you can only use those if your class extends the Sprite class? and I get all kinds of errors trying to get this to work so i’m starting to think flashpunk doesn’t play too friendly with the Sprite class?


(Jacob Albano) #4

You can add the event listener to your Engine class.


(azrafe7) #5

I seem to recall that @SHiLLySiT added middle and right click support in his personal branch of FlashPunk.

As a side note I’d like to add that you’ll need to compile for Flash 11.2+ to use those features.


(Blake Jones) #6

thanks guys! that worked :slight_smile: