user1985037
user1985037

Reputation: 1

Cant get swfobj.TotalFrames and swfobj.TCurrentFrame('/')

I am trying to get current frames or even total frames from my swf object but I continuously get undefined.

// swfObject
var flashvars = {};
var params = {};
var params = {};
var attributes = {
  id: 'flashDiv'
};

swfobject.embedSWF("/static/diag/countdown.swf", "flashDiv",
                  "550", "400", "8.0.0", "expressInstall.swf", flashvars,
                  params, attributes);

var swfobj = $('#flashDiv').get(0);
setInterval(function(){console.log("TotalFrames: " + swfobj.TotalFrames)},1000);

I will just get undefined well after the the swf is finished playing. I also can not get swfobj.TCurrentFrame('/') work either. I would appreciate any help anyone can give on this.

Upvotes: 0

Views: 444

Answers (1)

Sam
Sam

Reputation: 2970

Use the callback function, like this

function callbackfunc(e){
  setInterval(function(){console.log("TotalFrames: " + e.ref.totalFrames)},1000);
}
swfobject.embedSWF("/static/diag/countdown.swf", "flashDiv",
              "550", "400", "8.0.0", "expressInstall.swf", flashvars,
              params, attributes, callbackfunc);

Upvotes: 1

Related Questions