2 Replies Latest reply on Mar 20, 2012 7:17 AM by sinious

    How do I tell Flash to stop listening for an event listener once it is clicked in actionscript 3.0?

    super waffle Level 1

      so i have an event listener a mouse click in a movie clip name "em_contact" i also have an event listener after an animation plays out on an object called contactbtn_mc, How do i tell Flash once em_contact is clicked dont listen for that event any more?

      my code is below

       

      em_contact.addEventListener(MouseEvent.CLICK,gotocontactanimation);

       

       

      function gotocontactanimation(EvntObj:MouseEvent):void {

                 var myTween:Tween = new Tween(em_contact, "y", Bounce.easeOut, 0, 475, 28, false);

       

       

       

      the contactbtn_mc symbol is embeded inside "em_contact" and the code for it is below.

       

       

       

      contactbtn_mc.addEventListener(MouseEvent.CLICK,gotocontactanimation);

       

       

      function gotocontactanimation(EvntObj:MouseEvent) {

                MovieClip(root).contact_mc.gotoAndPlay(2);

      }

       

      the gotoAndPlay animation in question is on the root level inside a symbol name contact_mc. this works fine but the em_contact movie clip is still listening for the one mouse event so the animation just plays over in the background