Be a Supporter!

AS3 Button Listeners

  • 406 Views
  • 3 Replies
New Topic Respond to this Topic
jujaswe
jujaswe
  • Member since: May. 5, 2012
  • Offline.
Forum Stats
Member
Level 04
Blank Slate
AS3 Button Listeners 2012-11-12 00:45:29 Reply

I have different buttons on different frames. I then initialize the click event listeners in my code. My question is: are event listeners (with weak reference) lost when the movieclip that contains the buttons changes frames?

If so, is initializing the listeners every time the movie clip enters a particular frame advisable? Would it not create a leak from the listeners?

Sandremss128
Sandremss128
  • Member since: Aug. 22, 2009
  • Offline.
Forum Stats
Supporter
Level 11
Programmer
Response to AS3 Button Listeners 2012-11-12 03:25:54 Reply

To avoid headaches, leave frames for the people who are meant to work with them (animators) and simply use the visibility property if you want to do something with code.

ProfessorFlash
ProfessorFlash
  • Member since: Oct. 6, 2007
  • Offline.
Forum Stats
Member
Level 32
Programmer
Response to AS3 Button Listeners 2012-11-12 11:14:21 Reply

The listener is added to the object not to the frame.


You can solve pretty much any problem you may have with AS3 by consulting the AS3 Language reference.

egg82
egg82
  • Member since: Jun. 24, 2006
  • Offline.
Forum Stats
Supporter
Level 05
Game Developer
Response to AS3 Button Listeners 2012-11-12 12:24:58 Reply

Programming? AS3? Frames? Whut? o.o

get yourself FlashDevelop (it's free)


Programming stuffs (tutorials and extras)
PM me (instead of MintPaw) if you're confuzzled.
thank Skaren for the sig :P

BBS Signature