-
How to check to see if .swf file is present
Hi,
I'm loading up my movie, and when that movie has loaded, I want to check to see if another specific .swf is in the same directory.
What's the easiest way to check to see if that .swf is there? I guess I could do a "If Getbytestotal < 1" to see if it's there, but thought there might be a better way of doing it.
Maria
-
Can't be done with Flash on its own - the only way Flash can tell if a file is there, is to load it.
-
Thanks.
Any idea why the following isn't working?
loadMovieNum("dc.swf", 2);
// This checks to see that dc.swf is present.
if (_level2.GetBytesTotal()<1) {
_root.gotoandstop(25); // jumps to end frame if dc.swf not there
}
Last edited by mvmartin; 08-27-2003 at 08:24 PM.
-
shorter than most, but not all
getBytesTotal is a method of Movieclip and therefore needs to be written like this:
getBytesTotal()
i still don't think the script will work though. it may work locally, but on a server, you need to make allowances for the delay in sending a request and receiving a 404 not found error.
-
Originally posted by mvmartin
Thanks.
Any idea why the following isn't working?
loadMovieNum("dc.swf", 2);
// This checks to see that dc.swf is present.
if (_level2.GetBytesTotal()<1) {
_root.gotoandstop(25); // jumps to end frame if dc.swf not there
}
What you could do is use a serverside script and then have it look in the directory for .swf files and if any return send the info to flash. Don't know how comfortable you are with Scripting though.
-
Senior Member
What about something like this ?
code:
//frame 1
var check = MyClip.getBytesTotal(); // size of empty container
//frame 2
MyClip.loadMovie(ClipName,ClipDepth);
var count = 0;
var MaxCountCheck = 50;
//frame 3 - empty
//frame 4
if(count > MaxCountCheck){ gotoandPlay("Failed"); }
if(MyClip.getBytesLoaded() <= check) {
count++;
gotoAndPlay(_currentframe-1); //loop back to 3
}
//normal preloader code here//
If the clip bytes remain inactive for MaxCountCheck
the file is either lagging or isn't there.
MaxCountCheck would need to be large enough to 'know'
it isn't just a server lag.
Chris.
Last edited by FPChris; 08-27-2003 at 11:15 PM.
http://www.**********-dms.com
-
The basic problem is the same, and no matter how you dress it up, a Flash only solution is going to be disappointing: simply, Flash doesn't have any capacity to do what you are looking for. Therefore, any function you do eventually come up with will at best be slow and cumbersome. It will also cause a lot of headaches with, for example, hogging bandwidth downloading files you don't need, long delays experienced by the user, and fundamentally unreliable working.
If it were me, I would approach the problem from a different side, either:
1. (as per Astro_sk) Write the two line server script needed to return true or false when asked to check for a specific filename.
Or:
2. Use an XML file-listing (generated at file upload time, or by a server script)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|