This is Interesting: Free Magazines for Graphics designers and webmasters  


Home > Archive > Flash Site Design > September 2005 > Loading second SWF into MC makes flicker





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Loading second SWF into MC makes flicker
Jake2005

2005-09-29, 6:20 pm

Sorry for such a detailed question. This is my first stab at Flash, though I do
have a lot of experience with other forms of web design. I've read through
various parts of about 7-8 Flash books and have spent endless hours searching
forums online for answers to my problem. I have made some progress, but I'm not
there yet. I am designing an all-flash site that has an animated menu that
slides top/bottom as users make button selections. The design is all very
subtle, even individual objects on each "page" fade in. I read that movies
should be broken apart into smaller sections (separate SWF files) and that
loading them into movie clips is best. Most of the examples, however, load one
SWF into a movie clip and then replace that SWF by loading another SWF into the
same movie clip. I tried that, but each one of my SWFs needs a preloader,
because some are larger in size.

What I get is a quick "blip" where my menu disappears for a split second as
the first SWF is unloaded and the second SWF hits the transparent preload
frame. My solution was to leave the first SWF on a level underneath, and then
load the second SWF on the next available level using getNextHighestDepth().
This works really well, but because I am continually occupying more and more
levels with each button press, it seems to slow down animation over time, like
I might be eating up all the memory. I also fear that I might be nesting movie
clips within movie clips, which could cause the slowdown, I don't know. I am
looking for a better way to manage multiple movie clips without a flicker or a
way to unload all the underlying levels (except 0) when the new SWF gets
loaded, without having to actually know which level I'm on.

This is the button script, where NameOfNextMovie is substituted for the next
SWF that needs to play:

on (release) {

this.createEmptyMovieClip("container", this.getNextHighestDepth());
container.loadMovie("NameOfNextMovie.swf", container.getNextHighestDepth());

}


Here's the preload script which is on the first (blank) frame of each loaded
movie:


if (_framesloaded>=_totalframes) {
gotoAndPlay("Scene 1", 2);


} else {
gotoAndPlay("Scene 1", 1);
}


As you can see I don't know very much about ActionScript, so please be easy on
me. Any help, or points in the right direction would be greatly appreciated. My
two favorite books so far have been Flash MX 2004 Hands on Training and Flash
MX 2004 Advanced Visual QuickPro Guide. I would recommend them to anybody
trying to learn Flash.

Sponsored Links


Copyright 2003 - 2008 forum4designers.com  Software forum  Computer Hardware reviews