I followed this tutorial to check whether the swf exists on the remote server. Here is my code:
var url = 'http://' + layer_path;
var flashvars = {};
var params = { scale: "exactFit", wmode: "transparent" , allowscriptaccess: "always" };
var attributes = {class:'flash' ,name: swf_id};
var callback = function(e){
if (hidden) $('#'+conteiner_id).hide();
window.setTimeout(function(){
if (e.ref.PercentLoaded() == 0) {
// File does not exists
}
},1000);
};
swfobject.embedSWF(url, swf_id, "100%", "100%", "9.0.0","expressInstall.swf", flashvars, params, attributes,callback);
The swf is inserted to a div with the is swf_id, which resides in a div with id conteiner_id.
The code works great, except when the hide parameter is set to true, and the parent div is hidden. Then, I get the following error message:
Uncaught TypeError: Object #<HTMLObjectElement> has no method 'PercentLoaded'
How can I achieve this?