PDA

View Full Version : MX|unspecified number of characters...



hihabyte
June 12th, 2003, 05:49 PM
I don't really know how to translate my problem in understandable text, but I'll try.
I want to be able to check if a filename ends with a specific word or string and if it does, something must happen.

EG: 2 movies: muse_guitar.swf and audioslave_guitar.swf
If I load one of these movies into a movieclip in another swf, a script in that swf should check if the movie that has loaded, ends with the string _guitar.swf and if it does, the guitar-menu must load, for example.

So I'm looking for something like:

If loadedmovie = *&"_guitar.swf" then ...

but I don't know the correct symbols or code that I should use.

Thanks for the help!:)

kode
June 12th, 2003, 06:53 PM
why don't you just define a variable in muse_guitar.swf and audioslave_guitar.swf?
then you can check that variable and do whatever you need to do...

example:

// muse_guitar.swf and audioslave_guitar.swf first frame actions
var myVar = "guitar";
// in the other swf
myMovieClip.loadMovie("audioslave_guitar.swf");
if (myMovieClip.myVar == "guitar") {
// load guitar menu
}
however, you could try this:

myMovieClip.loadMovie("audioslave_guitar.swf");
var url = myMovieClip._url;
if (url.substr(url.lastIndexOf("_"), url.length) == "_guitar.swf") {
// load guitar menu
}
hope it helps... =)