View Full Version : open swf if exist
alflashy
07-21-2005, 07:27 PM
Hi
can anybody tell how can i write a code to open a file(swf or text or jpg) from "A" location and if the file is not there than try to open it from location "B"
somethig like
mc.onRelease = function(){
loadMovie("folderA/open.swf",2)
//if the loadMovie function fail then
loadMovie("folderB/open.swf",2)
}
thanks
deathpie
07-21-2005, 07:41 PM
Funny, just a few days ago, I asked how I could detect if a JPG couldn't be found via loadMovie. Anyway, this link should help you out. I'm pretty sure it will work for a JPG, SWF, text file, etc.:
http://www.flashguru.co.uk/checking-if-a-file-exists/
alflashy
07-21-2005, 08:19 PM
o.k.
i checked that but i don't how can i put that code in my case
i was able to open a file which exist but not able to look for the file in another location
can you please explain me how to do that
here is the code
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
}
}
fileExists.load('myfile.swf') //initiate the test
thanks
|
vBulletin® v3.8.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.