如何使用 JS 控制 flash 从指定位置进播放.

zhouheng123456 2010-01-13 04:58:11
我在网上查到的是 使用 GotoFrame方法,但没有效果..
我使用的是adobe flash player 10
IE 7

请问有人知道怎么解决不..其它方法都运行正常.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN " "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
<html xmlns= "http://www.w3.org/1999/xhtml ">
<head>
<meta http-equiv= "Content-Type " content= "text/html; charset=gb2312" />
<title> </title>
<script type="text/javascript">
function flash(ur,w,h){
document.write('<object classid="clsid:D27CDB6E-AE6D-11CF-96B8-444553540000" id="obj1" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" border="0" width="'+w+'" height="'+h+'">');
document.write('<param name="movie" value="'+ur+'">');
document.write('<param name="quality" value="high"> ');
document.write('<param name="wmode" value="transparent"> ');
document.write('<param name="menu" value="false"> ');
document.write('<embed src="'+ur+'" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" name="obj1" width="'+w+'" height="'+h+'" quality="High" wmode="transparent">');
document.write('</embed>');
document.write('</object>');
}

</script>
</head>
<body>

<script language="javascript" type="text/javascript">flash('200910160847047.swf','529','600');</script>


<input type="button" onclick="obj1.Play();" value="Play"/>
<input type="button" onclick="obj1.stop();" value="Play"/>
<input type="button" onclick="alert(obj1.CurrentFrame());" value="CurrentFrame"/>
<input type="button" onclick="alert(obj1.totalframes);" value="totalframes"/>
<input type="button" onclick="obj1.GotoFrame(100);" value="GotoFrame"/>

</body>

</html>
...全文
178 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
qianzhimeiying 2010-01-13
  • 打赏
  • 举报
回复
在flash中注册回调方法供JavaScript调用
initialize="init()"

private function init(): void
{
ExternalInterface.addCallback("callActionScript", xxMethod);
}

private function xxMethod(position: String): void
{
....
}

qianzhimeiying 2010-01-13
  • 打赏
  • 举报
回复
也许你可以通过js调用actionScript的方式实现,大致意思如下
<script type="text/javascript">
46 function callActionScript(value)
47 {
48 //根据id获取flash实例,在这里id是CallAsFromJs,可以从Embed
49 var flash = (navigator.appName.indexOf ("Microsoft") !=-1)?window["obj1"]:document["obj2"];
50 //调用ActionScript注册的回调方法
51 flash.callActionScript(value);
52 }
53</script>
zhouheng123456 2010-01-13
  • 打赏
  • 举报
回复
up~~

87,901

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧