Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

In a container movie - load SWF - play to end - unload - load the next SWF

Posted on 2006-11-08
8
Medium Priority
?
1,161 Views
Last Modified: 2008-09-05
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
0
Comment
Question by:grinchikins
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
  • 2
8 Comments
 
LVL 14

Expert Comment

by:trigger-happy
ID: 17904819
Technically the movieclip will remove itself when the container movie clip goes out of existence in the timeline but you can never really purge it from memory. When it comes to reaching the last frame of the movie clip, all you have to do is to add _root.play() in the last frame of the movie clip in which you want to load. As for loading the movie clip into the container clip, this can be done with your typical loadMovie() action.

--trigger-happy
0
 

Author Comment

by:grinchikins
ID: 17915518
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
0
 
LVL 14

Expert Comment

by:trigger-happy
ID: 17918667
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
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 5

Expert Comment

by:blockage1
ID: 17923535
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 );

0
 

Author Comment

by:grinchikins
ID: 17948519
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

0
 
LVL 5

Accepted Solution

by:
blockage1 earned 400 total points
ID: 17948976
The "flash" is happening because loading isn't instantaneous. There will be a slight delay between requesting the main movie and it being ready to play - download time, even from a local disk will be noticeable. Try loading the main movie before you need it. You might need to stop it and/or turn its _visible off while its waiting to play. Also if there are any sounds in the main movie make sure they're not on frame 1.

And yes it does sound like the container should be 1 frame.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There are times in your Flash CS4 application when you want more than a simple pointer or a hand, and it's hard to find an ideal walk-through to tell you what to do.  I spent a few days recently learning my way around making custom cursors in Flash,…
This article describes a solution to a problem of subloading one movie into another when they have different SWF versions. Sometime back, I was working on an ActionScript project while I came across an interesting fact which I would like to share…
The goal of the tutorial is to teach the user how to live broadcast using Flash Media Live Encoder and connecting it to YouTube to broadcast. Log into your Youtube account, choose live stream settings, start live stream from Flash Media Live Enc…
This Micro Tutorial will teach to how to utilize bit rate in Adobe Flash Media Live Encoder.
Suggested Courses

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question