<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="0" height="0" id="MyFlash">
<param name="movie" value="hh.swf">
<param name="quality" value="high">
<param name="fullscreen" value="true"><param name="scale" value="exactfit">
<embed src="hh.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="800" height="600">
</embed>
</object>
var movie=document.getElementById("MyFlash");
if(movie.CurrentFrame==25)//在25祯处停止
movie.StopPlay();
/*
用户的操作
......
......
...*/
if(用户需要继续播放||用户要播放第n祯)
{
//movie.GoToFrame(n);//用户要播放第n祯
movie.Play();
}
<param name="movie" value="hh.swf">
<param name="quality" value="high">
<param name="fullscreen" value="true"><param name="scale" value="exactfit">
<embed src="hh.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="800" height="600">
</embed>
</object>
var movie=document.getElementById("MyFlash");
if(movie.CurrentFrame==25)//在25祯处停止
movie.StopPlay();
/*
用户的操作
......
......
...*/
if(用户需要继续播放||用户要播放第n祯)
{
//movie.GoToFrame(n);//用户要播放第n祯
movie.Play();
}
解决方案 »
- why the same url is sent to server in add and edit in jqgird inline
- js 关于encodeURI编码问题,急!(有用到JQuery做ajax处理,程序是java开发的)
- ie与火狐获取name长度和checked区别
- 【在线等】如何取得自动生成元素中input的value值?
- document.getelementbyid 和$()疑问
- 图片预加载的问题
- (梅雪香@深圳)的popup日歷控件不支持IE5.5嗎?
- 参数
- javascript可以读取本地文件吗?(客户端)必送分(50分)
- 初学者提问,希望大家帮忙
- div内容复制的问题,急
- 急!求 用javascript 通过 xml 结构 生成 树形菜单
function crossStart(flashId){
var oFlashMovie = document.getElementById(flashId);
oFlashMovie.Play();
if(oFlashMovie.CurrentFrame==25)//在25祯处停止
oFlashMovie.StopPlay();
}
<object type="application/x-shockwave-flash" data="cross.swf" width="18" height="18" id="cross" >
<param name="movie" value="cross.swf"/>
<param name="play" value="false" />
</object>
<br>
<onclick="crossStart('cross')">开始动画</button>
<button onclick="stopMovie('cross')">停止播放</button>
<button onclick="displayFrameCount('cross')">这个动画一共有多少桢</button>
我个人认为外部来控制动画的播放进程不准确,如果要控制最好通过改变动画里的变量参数的方式来控制,而真正的控制由FLASH自己来执行,这样准确一些!if(oFlashMovie.CurrentFrame==25)//在25祯处停止
oFlashMovie.StopPlay();
这里是要求动画刚好在25帧处,才会执行停止,50帧的动画你执行这个函数只有1/50的机会碰到!太难了
<html>
<head>
<title>Flash Example</title>
<script type="text/javascript" src="listutil.js"></script>
<script type="text/javascript">
var aProperties = new Array("X_POS", "Y_POS",
"X_SCALE", "Y_SCALE", "CURRENT_FRAME",
"TOTAL_FRAMES", "ALPHA", "VISIBLE", "WIDTH",
"HEIGHT", "ROTATION", "TARGET", "FRAMES_LOADED",
"NAME", "DROP_TARGET", "URL", "HIGH_QUALITY",
"FOCUS_RECT", "SOUND_BUF_TIME"); function getProperty() {
var oFlashMovie = document.getElementById("ExampleMovie");
var selProperties = document.getElementById("selProperties");
alert(aProperties[selProperties.selectedIndex] + " = " + oFlashMovie.TGetProperty("/", selProperties.selectedIndex));
}
window.onload = function () {
var selProperties = document.getElementById("selProperties");
for (var i=0; i < aProperties.length; i++) {
ListUtil.add(selProperties, aProperties[i]);
}
}
</script> </head>
<body>
<object type="application/x-shockwave-flash" data="ExampleMovie.swf"
width="200" height="200" id="ExampleMovie">
<param name="movie" value="ExampleMovie.swf" />
</object>
<p><select id="selProperties">
</select><input type="button" value="Get Property Value" onclick="getProperty()" /></p>
</body>
</html>
这个是JS返回flash各种状态的例子,可以获得当前运行的帧数。