Skip to main content
Participant
December 27, 2008
Question

to call two methods from a listener.

  • December 27, 2008
  • 2 replies
  • 398 views
hi isit possible to call two functions from one button event listener?

or is it even possible to write two seperate listeners for one button that listen for the same thing an example is shown in the code;

also, i have string variable, that i want to use to call a certain funtion depending on the variable, for example the vairables name is phase_no can i do next_btn.addEventListener(MouseEvent.CLICK,nextPhase,beginSubmit+phase_no)??

any help would be appreciated
This topic has been closed for replies.

2 replies

Inspiring
December 27, 2008
>> //should i do it this way?

next_btn.addEventListener(MouseEvent.CLICK,nextPhase);
next_btn.addEventListener(MouseEvent.CLICK,beginPhase1);

Yeah, there's nothing wrong with using multiple listeners when needed. Just
be sure to remove them when you are done.

--
Dave -
www.offroadfire.com
Head Developer
http://www.blurredistinction.com
Adobe Community Expert
http://www.adobe.com/communities/experts/


Inspiring
December 27, 2008
Why don't you want to do it in one function? See code:
Participant
December 27, 2008
hi, thanks for your suggestion but i cant do that unforunately. the next button is used in differnt frames. in all frames i want to perform the first function but in the frame 1, i want to call say the function submit1 and in frame 2 i want to call the function submit2
Inspiring
December 27, 2008
You can check what frame it is in and do whatever. See code.

By the way, what is variable choice1 for?