<!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>
从新浪微博的发布魔法表情学到的
最新推荐文章于 2025-09-24 11:16:07 发布
本文介绍了一个使用JavaScript控制Flash动画播放的实例,通过按钮实现动画的开始、停止和重置功能,并实时显示当前帧数比例。
177

被折叠的 条评论
为什么被折叠?



