English 中文(简体)
SWF装载时间
原标题:Load timer on SWFObject for SWF load time

有一些人抱怨说,在南盟的装货时间过慢,但看来是罚款的。

我愿在SWFObject javascript中增加一个装载时间,这样它要花多长时间才能装上SWF,然后把它送回我们(我通过AJAX这样做)。

我审视了“SWFO目标呼吁”的可能性,这一呼吁从每1 000万智商开始时间,然后一旦成功就停止。 但是,从这一点看,这只是一个开关,如果被embe住成功,而不是负荷。

    function loadSWF(playURL){
      swfobject.embedSWF(playURL, "playdiv", "170", "90", "9.0.0", "expressInstall.swf", color:face00}, {wmode:"opaque",allowfullscreen:"true",allowScriptAccess:"always"},   , function(e) { 

        var loadTimer = window.setInterval(function() {

            if(e.success) {

                milSeconds = milSeconds+10;
                clearInterval(loadTimer); alert( TIME   + milSeconds);
            } else {

                milSeconds = milSeconds+10;

            }
        },10);          


    });
    }

这符合我现在的事情。 奥夫赢得了我们所需要的努力。

还有一条路要走吗?

最佳回答

您还可以询问SWF sPercentLoaded,但无需在SWF本身添加任何法典。 这里可以迅速(但徒劳地)这样做:

var start_time, end_time, total_time;

function getCurrentTime(){ return new Date(); }

function checkSWFStatus(swf){
    if(swf.PercentLoaded() !== 100){
        setTimeout(function (){
            checkSWFStatus(swf);
        }, 50);
    } else {
        end_time = getCurrentTime();
        total_time = end_time-start_time;
        console.log("Ended: " +end_time);
        console.log("Total load time: approximately " +total_time +" milliseconds");
    }
}

var callback = function (e){

    if(e.success && e.ref){

        if(!start_time){
            start_time = getCurrentTime();
            console.log("Started: " +start_time);
        }

        //Ensure SWF is ready to be polled
        setTimeout(function checkSWFExistence(){
            if(typeof e.ref.PercentLoaded !== "undefined"){
                checkSWFStatus(e.ref);
            } else {
                checkSWFExistence();
            }
        }, 10);

    }

};

swfobject.embedSWF("yourmovie.swf", "targetelement", "550", "400", "9", false, false, false, false, callback);
问题回答

对于那些感兴趣的人来说,解决这一问题的唯一途径是唤醒人们:

ExternalInterface.call("some_js_function()", "the-argument");

然后,一些“js_Function(机)”可以停在一页装时。





相关问题
selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

How to fire event handlers on the link using javascript

I would like to click a link in my page using javascript. I would like to Fire event handlers on the link without navigating. How can this be done? This has to work both in firefox and Internet ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Clipboard access using Javascript - sans Flash?

Is there a reliable way to access the client machine s clipboard using Javascript? I continue to run into permissions issues when attempting to do this. How does Google Docs do this? Do they use ...

javascript debugging question

I have a large javascript which I didn t write but I need to use it and I m slowely going trough it trying to figure out what does it do and how, I m using alert to print out what it does but now I ...

Parsing date like twitter

I ve made a little forum and I want parse the date on newest posts like twitter, you know "posted 40 minutes ago ","posted 1 hour ago"... What s the best way ? Thanx.

热门标签