Skip to main content
Inspiring
April 5, 2013
Answered

How to remove a function on the main timeline within a movie clip

  • April 5, 2013
  • 1 reply
  • 804 views

How do you remove a function that is coded on a frame in the main timeline from within a movie clip?  I tried this, but no dice:

infoGraphicDisparity.addEventListener(MouseEvent.CLICK, fl_ClickToGoToScene);

function fl_ClickToGoToScene(event:MouseEvent):void

{

    parent.removeEventListener (Event.ENTER_FRAME, parent["enterFrameHandler"]);

    MovieClip(this.root).gotoAndPlay("disparity");

}

this is the event I am trying to remove:

stage.addEventListener(Event.ENTER_FRAME, enterFrameHandler);

any help would be appreciated as always.

Thanks!

This topic has been closed for replies.
Correct answer kglad

from any frame (that executes after enterFrameHandler is defined) in any display object in the display list

stage.removeEventListener(Event.ENTER_FRAME, MovieClip(root).enterFrameHandler);

1 reply

kglad
Community Expert
kgladCommunity ExpertCorrect answer
Community Expert
April 5, 2013

from any frame (that executes after enterFrameHandler is defined) in any display object in the display list

stage.removeEventListener(Event.ENTER_FRAME, MovieClip(root).enterFrameHandler);

EverestJAuthor
Inspiring
April 5, 2013

Can I buy you a beer, sir?  That little line of code saved my project.  THANK YOU SO MUCH!

kglad
Community Expert
Community Expert
April 5, 2013

you're welcome.