Hi All
I have a swf file that loads and plays as an introduction at the start of my
flex app.
This is an AS3 swf that dispatches an event at the end to let flex know that
the video has ended.
I listen for an ESC key hit that is supposed to end the movie. I se tthe
image source to null and remove all event listeners. The movie dissapears so
you can't see it anymore which is all good.
The problem is that the sound carries on playing. I have tried calling stop
on the movie and calling stop on all it's children but the sound carris on
playing.
I have tired this code to stop it but it doesn't work:
this extends an Image
public function stop(e:Event = null):void
{
stopMovieClip(this as DisplayObjectContainer)
source = null;
removeEventListener("animationFinished",onAnimationFinished);
dispatch.dispatchEvent(new InfoEvent(InfoEvent.INTRO_MOVIE_END));
}
private function stopMovieClip(movieClip:DisplayObjectContainer):void
{
for (var i:int = 0; i < movieClip.numChildren; i++)
{
var currentComponent:Object = movieClip.getChildAt(i);
if(currentComponent is MovieClip)
{
trace(getQualifiedClassName(currentComponent));
var clip:MovieClip = currentComponent as MovieClip;
trace("frame: " + clip.currentFrame + " : " + clip.totalFrames);
clip.stop();
}
if(currentComponent is DisplayObjectContainer)
stopMovieClip(currentComponent as DisplayObjectContainer);
}
}
to which I get this output:
IntroMoviePlayer_introAnimation
frame: 0 : 0
Introduction_fla::MainTimeline
frame: 1 : 1
Introduction_fla::LogoAnimtoIntroTransitionMC_1
frame: 36 : 2016
Introduction_fla::b1MC_2
frame: 1 : 1
flash.display::MovieClip
frame: 1 : 1
flash.display::MovieClip
frame: 1 : 1
flash.display::MovieClip
frame: 1 : 1
Introduction_fla::b2MC_6
frame: 1 : 1
flash.display::MovieClip
frame: 1 : 1
flash.display::MovieClip
frame: 1 : 1
How can I stop this completly?
Thanks
--
Giles Roadnight
http://giles.roadnight.name