7 Replies Latest reply on Mar 3, 2010 7:35 PM by kglad

    How can I check if a function is or is not called from the event listener? in Flash CS4 (AS3)



      I came across a little problem.

      I put an event listener inside a for loop and the for loop inside a function.

      I want the for loop to end as soon as the event listener inside the for loop calls its function.


      Here is the general code for a better picture.



      this.addEventListener(Event.ENTER_FRAME, function#1);
      function function#1(event:Event):void{
                if(something is true){
                          for(var i = 0; i < numOfmy_mcs; i++){
                                    this["my_mc_"+String(i)].addEventListener(MouseEvent.CLICK, function#2);
      function function#2(e:Event):void{
      //do something cool here


      Thank you for any help!