Skip navigation
Currently Being Moderated

Help removing a listener with a "this" statement.

Jul 17, 2012 2:53 PM

Thanks in advance for the help. I have a quick question:

 

Instance "MovieClip B" is nested inside "MovieClip_A". In "MovieClip_B", I have the action at key frame 5:

 

this.removeEventListener(Event.ENTER_FRAME, loop);

 

to remove the event listener that was added in key frame one of the same movie clip:

 

this.addEventListener(Event.ENTER_FRAME, loop);

 

Is there a way for me to remove this event listener in "MovieClip_B" by adding the remove code in its parent keyframe, "MovieClip_A"? I have tried this example in MovieClip_A, but with no luck:

 

MovieClip_B.removeEventListener(Event.ENTER_FRAME, loop);

 

 

Thanks again for the help!

-DJ

 
Replies
  • Currently Being Moderated
    Jul 17, 2012 3:01 PM   in reply to DjPhantasy5

    Where is loop is in MovieClip_A ?

     

    maybe

     

    MovieClip_B.removeEventListener(Event.ENTER_FRAME, MovieClip_B.loop);

     

    or

     

    MovieClip(parent).MovieClip_B.removeEventListener(Event.ENTER_FRAME, MovieClip(parent).loop);

     
    |
    Mark as:
  • Currently Being Moderated
    Jul 17, 2012 3:37 PM   in reply to DjPhantasy5

    MovieClip_B.removeEventListener(Event.ENTER_FRAME, MovieClip(parent).loop);

     

    try

     

    function activeB():void{

         this.addEventListener(Event.ENTER_FRAME, loop);

    }

     

    function desactiveB():void{

        this.removeEventListener(Event.ENTER_FRAME, loop);

    }

     

    from MovieClip_A

     

    MovieClip_B.activeB()

     

    or

     

    MovieClip_B.desactiveB()

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points