Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

loadVars vs loadMovie crossdomain?

Status
Not open for further replies.

Leozack

MIS
Oct 25, 2002
867
GB
I'm stumped on this one here ... I use a loadVars setup to check if a file exists before going on and using loadMovie on it (since I can't error trap that it seems).

However though this works locally, if I do it from an online server and point to a jpg on another server the loadVars now fails! If I bypass it and loadMovie anyway it works no problems!

So why is loadVars being anti-cross-domain and loadMovie isn't? Like I said I could just skip the file check but then I won't know if loadMovie has worked or not until it's too late really.

Is there any better way to check a file exists cross-domain safely? Or a way to make loadVars work cross-domain? x_x

_________________________________
Leozack
Code:
MakeUniverse($infinity,1,42);
 
I only use loadvars to import data 'printed' from an external script. The returned data is available as key/data pairs in the _root.

What is returned when you call a .swf movie and how do you read it?

Keith
 
The code I'm using as a "does files exist" test (which works fine for everything other than online cross-domain testing it seems is this
Code:
function checkFileExists(fileName, successFunction, failFunction, functionArgs) {
fileName+", "+successFunction+", "+failFunction+", "+functionArgs);
    fileExists = new LoadVars();
	thisVal = this;
    fileExists.onData = function(src) {
        if (src != undefined) {
            thisVal[successFunction](functionArgs);
        } else {
			thisVal[failFunction](functionArgs);
			//thisVal[successFunction](functionArgs);
        }
    };
    fileExists.load(fileName);
};
Took a while to hone that function and it works beautifully all except this newfound issue -_- Like I said it's weird cos I can loadMovie cross-domain fine, but I think this is part of the protection to stop 3rd-party shared object stuff :(

_________________________________
Leozack
Code:
MakeUniverse($infinity,1,42);
 
It seems loadVars won't work crossdomain so they'll ahve to have any XML on the same domain anyway. But to support images/souns from another domain I've implimented a fileCheck variable they can set to false and then if the filename isn't .xml and loadVars fails it will go ahead and try to loadMovie or whatever anyway. Seems to do the job though a bit disappointing :(

_________________________________
Leozack
Code:
MakeUniverse($infinity,1,42);
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top