Author Topic: Quick Q about Buttons  (Read 992 times)

archerboy

  • Guest
Quick Q about Buttons
« on: Sat, Jun 12, 2010 »
So it's just a curiosity question, I decided not to post in the help forum:

I made a simple button and after adding the function that changes state, I was surprised that it worked instantaneously.

No Event Listeners, nada.

Is this essentially a part of the Flixel Library?  I looked through the ASdocs, but couldn't find anything.

cai

  • Contributor
  • ****
  • Posts: 465
  • Karma: +0/-0
  • the illest of villains
    • View Profile
    • Brandon Cash
Re: Quick Q about Buttons
« Reply #1 on: Sun, Jun 13, 2010 »
FlxButton automatically sets up the event listener for you, so you don't have to:

Code: [Select]
FlxG.stage.addEventListener(MouseEvent.MOUSE_UP, onMouseUp);

When destroy() gets called (such as in changing states), the event listener is removed.
Follow me on Twitter | Come join us at #flixel on irc.freenode.net!