PDA

View Full Version : yet ANOTHER loadmovie Q.... sorry!



iLikePie
September 13th, 2003, 06:43 AM
hi,

I've just finished making an animated cartoon for school, and it's in about 5 diferent flash files (and therefore 5 .swf's)

i want to now use some actionscript so the cartoon will play from start to finish, but i can't work out what to do.

one suggestion i had was to make a new file with an empty MC then load each one in, and load the next once it's done. however, apparently this leaves a blank frame after each clip which isn't desireable.

Is there a way to just have some script on the last frame of an .swf which will call the next one or something? i couldn't find the relevant stuff in a search, because they're all about loading clips into other sites or whatever, but i want each one to fill the full screen...

help is much appreciated!
Thanks, Stuart

Voetsjoeba
September 13th, 2003, 06:49 AM
Let me see if I get this straight: you have an animated cartoon splitted up in 5 swfs. Once 1 swf has finished playing, you want the following one to start ... right ? Should there be a pause in between ?

iLikePie
September 13th, 2003, 09:26 AM
nope, i don't want a pause...
hopefully it'll just be one after the other, no gaps or lag or anything :)

iLikePie
September 14th, 2003, 06:28 AM
is anyone able to help me? i know it's something that gets asked a lot, but i really can't get it working, and it's due in a few days... please? :azn:

Stuart

blah-de-blah
September 14th, 2003, 07:44 AM
Wait you said you tried loading all the movies into one BIG movie right? or did you not?! After that BIG movie finishes loading all of em, it starts playing the first then the second and stuff. DOesn't that work!? i'm sorta confused sorry :-\

Voetsjoeba
September 14th, 2003, 07:51 AM
Well if your movies aren't too big, you should be able to use this ... I don't know if there will be a gap in between ... But you can try it for sure :)

On the main timeline:



this.createEmptyMovieClip("holder",1);
holder._x = 50;
holder._y = 60;
holder.loadMovie("external1.swf");


Then on the last frame of external1.swf, place this:



_root.holder.loadMovie("external2.swf");


That should do it ... Again, I don't know how big your files are ... Can you send the swfs to me or attach them so I can test it ?

Johnny64
September 14th, 2003, 08:06 AM
You could do it like this too


this.createEmptyMovieClip("holder1",1);
holder1.onLoad = function(){
this.play();
}
holder._x = 50;
holder._y = 60;
holder.loadMovie("external1.swf");
this.createEmptyMovieClip("holder2",2);
holder._x = 50;
holder._y = 60;
holder.loadMovie("external2.swf");
this.createEmptyMovieClip("holder3",3);
holder._x = 50;
holder._y = 60;
holder.loadMovie("external3.swf");

then put a empty frame at the end and start of your movie's
put a stop() action in all the first frames. Then at the end of the the first movie put


_root.holder2.play();

then in the second movie you put


_root.holder3.play();
ete,

this way you can load all the movies at the start but you can start playing when the first is all ready load.

;)

Voetsjoeba
September 14th, 2003, 08:34 AM
^ Yeah, better way. Thanks for that M64, I wasn't thinking clear :) Here's another version:



for(i=0;i<=5;i++){
this.createEmptyMovieClip("holder"+i,i);
this["holder"+i].loadMovie("external"+i+".swf");
this["holder"+i].gotoAndStop(1);
}
holder1.onEnterFrame = function(){
if(this.getBytesLoaded() == this.getBytesTotal()){
delete this.onEnterFrame
this.play();
} else {
trace("Loading "+Math.round(this.getBytesLoaded()/1024)+" KB of "+Math.round(this.getBytesTotal()/1024)+" KB");
}
}


Then, at the end of your external swfs, place this code. This would be the code at the end of external1.swf.



_root.holder1.removeMovieClip();
_root.holder2.swapDepths(1);
_root.holder2.play();


That should also do it ... :) Make sure the first frame of every swf is empty. And that your files are named external1.swf, external2.swf, ...

iLikePie
September 14th, 2003, 09:38 AM
if i load them all at once, will they all be using CPU power? coz a few of my scenes are pretty busy and therefore could have serious frame-rate loss if it's processing them all at once...

also, since i'm not using this online, there won't really be a loading time will there, so it wouldn't be necessary to pre-load them all before i start, right?

thanks for the helps so far :)

Voetsjoeba
September 14th, 2003, 10:02 AM
Yes, it will use some CPU power at the beginning. It shouldn't be a problem though, since it only starts playing when external1.swf is loaded, and at that time, the others should be about loaded too :)

If you're using this local, there is indeed no need for a preloader :)

Johnny64
September 14th, 2003, 10:59 AM
:trout:
onLoad doesn't work :sigh:
with external movies
i know that but just keep for getting it :P

iLikePie
September 15th, 2003, 03:54 AM
Voetsjoeba and co...

when i try to use any loadmovie command - i'm currently working from the first advice i got (because it's only about 5 lines of code :) - but i always get this error:

Error opening URL "file:///C|/DOCUME%7E1/Default/LOCALS%7E1/Temp/Shot1b.swf"

I've put all my .swf files in the same folder, so i thought it would automatically load from there, but it appears to be trying to load from c:drive :\
anyone know what to do?

thanks, Stuart

EDIT: Actually, it's working now, and i haven't changed a thing... that's really weird but i guess it's ok as long as it doesn't happen again :)

Could someone just explain whether the old movie clip (.swf) gets unloaded when a new one comes in? I'm guessing it just replaces the other one right? (i'm using that first method, the one with 5 lines of code :) )

Voetsjoeba
September 15th, 2003, 02:13 PM
You probably had the FLA but didn't compile it yet. So the swf wasn't there yet. At the time you tried again, you probably already compiled that swf so it would work the second time ;)

Yes, the previous one gets unloaded because another one is being loaded into it :)