<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="zh-CN" xml:lang="zh-CN">
<head><title>用js代码控制flash的播放</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style type="text/css" media="screen">
html, body { height:100%; background-color:#5E4A09;}
body { margin:0; padding:0; overflow:hidden; }
</style>
</head>
<body>
    <input type="button" value="播放" onclick="myflash.Play()"/><!-- flash会从暂停的那一帧开始播放-->
    <input type="button" value="暂停" onclick="myflash.StopPlay()"/><!-- flash暂停在当前帧-->
    <input type="button" value="停止" onclick="StopPlay()"/>
    <input type="button" value="播放状态" onclick="alert(myflash.IsPlaying())"/><!--flash 的播放状态 true || false-->
    <br/>进度控制:
    <input type="button" value="返回首帧" onclick="myflash.Rewind()"/><!-- flash暂停在当前帧-->
    <input type="button" value="前进" onclick="goForward()"/>
    <input type="button" value="后退" onclick="backOff()"/>
    <input type="button" value="当前帧" onclick="alert(myflash.CurrentFrame())"/><!--从0开始-->
    <input type="button" value="总帧数" onclick="alert(myflash.TotalFrames())"/><!--返回总帧数-->
    <br/>其它控制:
    <input type="button" value="已加载" onclick="alert(myflash.PercentLoaded()+'%')"/>

<embed style="display:block;"
 type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" src="test.swf" id="_AdSame_Flash650"
 name="_AdSame_Flash650" allowscriptaccess="always" quality="high" width="1000" height="300" swliveconnect="false" wmode="opaque" flashvars="name=pmx&age=44">

    <script>
        var myflash = document.getElementById('_AdSame_Flash650');

        function StopPlay(){
            myflash.GotoFrame(0);//flash调到第一帧并停止播放
        }
        function goForward(){
            myflash.GotoFrame(myflash.CurrentFrame()+10);//flash跳转到当前帧+10帧,并停在该帧
        }
        function backOff(){
            myflash.GotoFrame(myflash.CurrentFrame()- 10);
        }
    </script>
</body>
</html>

JS控制flash的播放的更多相关文章

  1. JS控制flash的方法

    JS控制flash的一些方法:Play() ---------------------------------------- 播放动画 StopPlay()---------------------- ...

  2. JS控制音频顺序播放

    做一项目,用到“叫号功能”,网页上有一“叫号”按钮,点击后就读数据库中存的号码,如123号, 然后就发声音出来, 思路是网上下载0123456789的叫号声音,然后按钮点击事件里就在JS里写用那个HT ...

  3. JS控制视频的播放

    在用js定时器控制视频时, html部分: <video id="video_1"> <source id="source_1" src=&q ...

  4. js控制swf播放

    <html> <head> <title>用js代码控制flash的播放</title> <meta charset="utf-8&qu ...

  5. JS实现控制HTML5背景音乐播放暂停

    首先在网页中嵌入背景音乐,html5代码为: <script src="http://wuover.qiniudn.com/jquery.js"></script ...

  6. 31.JS实现控制HTML5背景音乐播放暂停

    实现控制网站背景音乐的播放暂停在html5中是非常容易和简单的,仅仅几行代码即可实现.首先在网页中嵌入背景音乐,html5代码为: <script src="http://wuover ...

  7. 自定义css样式结合js控制audio做音乐播放器

    最近工作需求需要播放预览一些音乐资源,所以自己写了个控制audio的音乐播放器. 实现的原理主要是通过js调整audio的对象属性及对象方法来进行控制: 1.通过play().pause()来控制音乐 ...

  8. Js与flash交互:在html页面中用js与MyReport插件交互

    Html页面与flash的加载 如下图,flash是html页面的一个插件节点. js与flash进行交互,首先要处理好html页面和swf的加载问题. Swf调用外部js方法,要确保js方法已存在, ...

  9. js控制Bootstrap 模态框(Modal)插件

    js控制Bootstrap 模态框(Modal)插件 http://www.cnblogs.com/zzjeny/p/5564400.html

随机推荐

  1. salt执行报错一例

    执行报错: 查看服务端日志: 认证有问题 重新认证吧!!! minion端: [root@super66 ~]# cd /etc/salt/[root@super66 salt]# lsminion ...

  2. 启动Automatic Updates出现0x80004015错误的解决办法

    前几天我的本本加入到AD里面了,并且换了个用户名,结果昨天就发现升级出毛病了,Automatic Updates服务无法启动,启动时候出现0x80004015错误:Automatic Updates  ...

  3. $_ 与 $PSItem

    PowerShell 3.0 中的$PSItem 此文章于2012年11月4日发表在PowershellPowershell小技巧并加以Powershell 3.0管道的标签 by Mooser Le ...

  4. HashTable的典型用法以及参考实例

    Get-ADComputer -Identity "cnhzpd-f7sc83x" | select -property @{name="computername&quo ...

  5. 配置SMarty解析

    在 common/main.php中配置 View 组件 'view' => [ 'renderers' => [ 'tpl' => [ 'class' => 'yii\sma ...

  6. NBOJv2 1004 蛤玮打扫教室(线段树区间更新区间最值查询)

    Problem 1004: 蛤玮打扫教室 Time Limits:  1000 MS   Memory Limits:  65536 KB 64-bit interger IO format:  %l ...

  7. SVN配置管理(trunk、branches、tags)

    利用SVN的分支,合理地管理项目代码 由于SVN固有的特点,目录在SVN中并没有特别的意义,但是这三个目录却在大多数开源项目中存在,这是因为这三个目录反映了软件开发的通常模式. trunk是主分支,是 ...

  8. Grand Theft Auto V (侠盗列车手5)图形研究

    原文地址:http://www.adriancourreges.com/blog/2015/11/02/gta-v-graphics-study/   原文的简介: GTA(侠盗猎车)系列自从1997 ...

  9. 【翻译】CEDEC2014 CAPCOM 照相机正确的照片真实的制作工作流

     这次带来的翻译是Capcom在CEDEC2014上发表的技术美术相关的资料.资料的目的,就是在已经拥有了一套基于物理的渲染引擎的前提下,如何进行图片真实的材料的拍摄并制作为引擎里的材质,以及如何正确 ...

  10. smoke

    1.Have a smoke? 2.Would you like a cigarette? 3.Cigarettes? 4.Let's go have a smoke. 5.Do  you smoke ...