Christopher Hunt
Christopher Hunt

Reputation: 107

Removing Instance of Video when Finished

I did a file/import/video and pointed to a video on my server and this is all on the first frame. On my aa layer I have the following:

 stop();
 import fl.video.VideoEvent;
 intro.addEventListener(VideoEvent.COMPLETE, fPlay);

 function fPlay(e:VideoEvent):void {
 gotoAndPlay(2);
 }

As you can see, when the video finishes, it hops to frame 2 and continues to the website. What started happening on a few occasions, is the timeline would randomly jump back to frame 2 for no apparent reason. I'm assuming it's because I didn't remove the instance of the video, or something along those lines? This whole issue on;y started when I introduced the video.

Can someone shed some light? If it is removing the Listener, can you show me how to write it? I tried a few times to remove it, but would get errors about not having enough parameters.

Thanks!

Upvotes: 0

Views: 165

Answers (1)

SimplyZ
SimplyZ

Reputation: 908

To remove the Listener:
intro.removeEventListener(VideoEvent.COMPLETE, fPlay);

But u need to use it before you hop to another frame.

To remove the instance of the video:
removeChild(intro);

Same rule as above, need to be used before changing frames.

Upvotes: 1

Related Questions