1

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?

1 Answer 1

1

Some browsers (like Firefox) have performance optimizations that defer the loading of Flash plugins that are not visible. There is no way around it other than making sure they are at least partially visible.

A popular work-around is to set their size to be very small (only a few pixels) and make sure they are on-screen and then once they load, you can move them off screen or hide them.

Sign up to request clarification or add additional context in comments.

1 Comment

great thanks, used your workaround and it works like a charm!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.