<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Insert title here</title> </head> <body> <script type="text/javascript" src="js/swfobject.js"></script> <script type="text/javascript" src="js/jquery.js"></script> <div id="aini"></div><br /> <button id="btn">开始播放</button> <button id="stop">停止播放</button> <button id="rewind">重置</button> <script> $(function() { var flashParams = { id: "view_ani", quality: "high", allowScriptAccess: "always", wmode: "transparent", allowFullscreen: true, allownetworking: "internal", play:false }; swfobject.embedSWF('swf/2.swf', 'aini', "440", "360", "10.0.0", null,null, flashParams); var timer; $("#btn").click(function() { var swf = swfobject.getObjectById('aini'); swf.Play(); timer = setInterval(function() { var CurrentFrame = swf.CurrentFrame(); var totalFrame; try{ totalFrame = swf.TotalFrames(); }catch(e) { totalFrame = swf.TotalFrames; } console.log((CurrentFrame * 100 / totalFrame).toFixed(2)); } , 1000); }); $("#stop").click(function() { clearInterval(timer); var swf = swfobject.getObjectById('aini'); swf.StopPlay(); }); $("#rewind").click(function() { clearInterval(timer); var swf = swfobject.getObjectById('aini'); swf.Rewind(); }); }); </script> </body> </html>