grinchikins
asked on
In a container movie - load SWF - play to end - unload - load the next SWF
In Flash 8, using ActionScript 2.0 I would like to load an swf intro into a container movie - let it play to the end (how can I tell when the last frame is finished) and then unload it to purge the memory (as there are some large bitmaps and animation that won't play again) - then play the next swf - the actual main movie.
I don't want a preloader script and I don't want to activate these movies with buttons, which is what I'm coming up with when I search for this on Flash sites.
Thanks!
Charles
I don't want a preloader script and I don't want to activate these movies with buttons, which is what I'm coming up with when I search for this on Flash sites.
Thanks!
Charles
ASKER
Thanks. I tried a test and it doesn't seem that I need _root.play() at the end of the first movie - if I just use loadMovie() in 2 frames in the container it works. But it flashes a blank frame between movies and if it doesn't purge memory I'm not sure what the advantage of this is. It's smoother just using one big movie.
Charles
Charles
Well, I'm not sure how to solve the blank frame thing since I'm not really sure what happens but as for purging memory, ths kind of thing is done by flash itself and we can't do anything about it.
--trigger-happy
--trigger-happy
You could also do it this way - add function to the main timeline that gets called from the last frame of the loaded movie.
/** this goes on the first frame of the main timeline in the container swf **/
function onDoneIntro ( intro_mc:MovieClip ) :Void
{
intro_mc.removeMovieClip() ;
// do stuff to play the main movie here - are you loading it or is it part of the container?
}
/** this goes on the last frame of the loaded swf **/
_root.onDoneIntro( this );
/** this goes on the first frame of the main timeline in the container swf **/
function onDoneIntro ( intro_mc:MovieClip ) :Void
{
intro_mc.removeMovieClip()
// do stuff to play the main movie here - are you loading it or is it part of the container?
}
/** this goes on the last frame of the loaded swf **/
_root.onDoneIntro( this );
ASKER
Thanks bolckage1 this is what I want - removeMovieClip - so tell me if I'm doing this correctly. My intro_mc is 120 frames long. In Container it seems I have to have 120 blank frames - why can't I run this on a single frame?
And, as I've said above, when intro_mc ends and main_mc starts there is a "flash" (not the program :) - the backgrounds are identical so I can tell that the Container is dropping the first swf and loading the second swf and there is a second of nothing between them.
Here's how I setup your code, am I correct?
//on frame 1 of container.swf
loadMovie ("intro_mc.swf",1);
function onDoneIntro ( intro_mc:MovieClip ) :Void
{
intro_mc.removeMovieClip() ;
loadMovie ("main.swf",1);
}
//on frame 121 of container.swf
_root.onDoneIntro( this );
Thanks
Charles
And, as I've said above, when intro_mc ends and main_mc starts there is a "flash" (not the program :) - the backgrounds are identical so I can tell that the Container is dropping the first swf and loading the second swf and there is a second of nothing between them.
Here's how I setup your code, am I correct?
//on frame 1 of container.swf
loadMovie ("intro_mc.swf",1);
function onDoneIntro ( intro_mc:MovieClip ) :Void
{
intro_mc.removeMovieClip()
loadMovie ("main.swf",1);
}
//on frame 121 of container.swf
_root.onDoneIntro( this );
Thanks
Charles
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
--trigger-happy