PDA

View Full Version : multi loadMovie prob


aeon
07-22-2003, 08:58 PM
I've thought of a way to load multiple movies in the background while the user is browsing other areas. When a user eventually comes to a section, that swf has either loaded or in the cache. It's a way to speed up overall browsing.

// main loadMovie function
function loadMulti(movieName,lvl){
loadMovieNum(movieName,lvl); //movieName and lvl depends on array index
lvl = "_level"+lvl;
lvl._visible=0; //hide loaded movies
lvl.stop(); //so they won't play
}

//builds array for movie names, arrays start at index [0] don't forget
//enter your own file names
multiMovies = new Array("amp.swf","contact.swf","data.swf","love.swf","root.swf","type.swf");

//start loading the 6 movies from level 11 to 16
for(i=0;i<=multiMovies.length;i++){
loadMulti(multiMovies[i],i+11); //adds 11 to load to lvl 11,12,13, etc...
}

The problem is I can see the loaded movies pile up on the upper levels and the stop(0 and _visible=0 doesn't work.

It's 4.30AM now... feelin cranky...

Anyone??

If I can get this working, it'll be a cool idea i guess.

Billy T
07-22-2003, 09:03 PM
try putting the visible and stop in the first frame of the external movie

cheers

pixelwit
07-22-2003, 09:55 PM
This post has been identified as a 'crosspost', that is, it has been posted multiple times on the forums. Please post each question just once and we will do our best to answer it. Thanks.

Since this is a crosspost and this thread has little or nothing to do with Animation and Effects, your other thread has been deleted.

-PiXELWiT
http://www.pixelwit.com

aeon
07-23-2003, 06:16 AM
Sorry about that! I posted at the wrong forum so I reposted at the right one.
Thanks for deleting the wrong one.
I don't it'll work id I put the stop and _visible on the 1st frame of the movie...
:confused:

Billy T
07-23-2003, 06:19 AM
did you try?

aeon
07-23-2003, 11:10 AM
Yeh I tried but I need to make it play when I actually load it from navigation.
Didn't succeed.
// main loadMovie function
function loadMulti(movieName,lvl){
loadMovieNum(movieName,lvl); //movieName and lvl depends on array index
lvl = "_level"+lvl;
lvl._visible=0; //hide loaded movies
lvl.stop(); //so they won't play
trace(lvl);
}

//builds array for movie names, arrays start at index [0] don't forget
//enter your own file names
multiMovies = new Array("amp.swf","contact.swf","data.swf","love.swf","root.swf","type.swf");

//start loading the 6 movies from level 11 to 16
for(i=0;i<=multiMovies.length;i++){
loadMulti(multiMovies[i],i+11); //adds 11 to load to lvl 11,12,13, etc...
}

the trace output for the variable lvl is _level11, _level12, _level13... so I don't know why

lvl._visible=0;
and
lvl.stop();

doesn't work...

Billy T
07-23-2003, 11:53 AM
because your setting the values before the movie has even started loading...

as for making them play, set a var with your buttons as well as the loadMovie

eg

playMovie=true;

then in frame one of the movie have

if(_level0.playMovie!=true){
stop();
}

cheers

aeon
07-23-2003, 12:28 PM
// main loadMovie function
function loadMulti(movieName, inst) {
inst = "MC"+inst;
_root.createEmptyMovieClip(inst, random(9));
loadMovie(movieName, inst);
//loads movieName into inst
_root.inst.stop();
//so they won't play
trace(mNamesArray[i]+" is loaded into "+inst);
trace(inst);
inst._visible = 0;
trace(inst._visible);
}
//builds array for movie names, arrays start at index [0] don't forget
//enter your own file names
mNamesArray = new Array("memo.swf", "contact.swf", "data.swf", "love.swf", "root.swf", "type.swf");
//start loading the 6 movies into MC1 to MC6
for (i=0; i<=mNamesArray.length-1; i++) {
loadMulti(mNamesArray[i], i+1);
//add 1 so instance name start at 1 not 0
}

trace(inst); returns undefined...

why?

Billy T
07-23-2003, 12:35 PM
trace(inst._visible);

returns undefined - not inst

when you provide inst to the function its a number...then in the first line you change it to a string...then you attempt to use it as the depth parameter in the loadMovie which needs a number not a string...