I’m using loadmovie and I’d like to be able to detect if it succeeded or failed. If it fails, I’d like to load a different movie.
I haven’t found anything in the AS dictionary so any help on this would be appreciated.
Thanks,
Lex
I’m using loadmovie and I’d like to be able to detect if it succeeded or failed. If it fails, I’d like to load a different movie.
I haven’t found anything in the AS dictionary so any help on this would be appreciated.
Thanks,
Lex
It can be done (Thanks goes tov FlashGuru for pointing that out) using the following script:
fileExists = new LoadVars();
fileExists._parent = this;
fileExists.onLoad = function(success) {
//success is true if the file exists, false if it doesnt
if (success) {
//the file exists
var nm = this._parent.createEmptyMovieClip("swfHolder", 1);
//so create a movieclip
nm.loadMovie("myfile.swf");
//and load our .swf file into it
} else {
trace("error");
}
};
fileExists.load("myfile.swf");
//initiate the test
I think that the code is clear enough to be understood, hope it helps.
cheers;
:: Copyright KIRUPA 2024 //--