PDA

View Full Version : using a variable to loadMovie



A-Dub
November 6th, 2002, 05:54 PM
simple question, can i use a variable to load a new .swf file? this doesn't seem to work...

function swapMovie (newMovie) {
unloadMovie(10);
newMovie = newMovie + ".swf";
// trace(newMovie);
loadMovie(eval(newMovie), 10);
}

thanks for any help!

Dravos
November 6th, 2002, 06:25 PM
This works:

_root.createEmptyMovieClip("button",10);
newMovie = "hex";
newMovie = newMovie+"swf";
button._x=50;
button._y=50;
//trace(newMovie);
loadMovie(newMovie, button);

By trial and error it seems you can load it into 10 if its given a filename:

loadMovie("hex.swf",10);

but this doesnt work:

loadMovie(newMovie,10);

seems you have to specify the movieclip name when dealing with variables.

Hope this helps

A-Dub
November 6th, 2002, 06:41 PM
ahh... i see.

thanks!