<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();
}

解决方案 »

  1.   

        用movie.CurrentFrame停不了动画啊,我给出我的代码,不知道是不是我的代码的问题
             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>
      

  2.   

    我建议你换一种方法来控制!
    我个人认为外部来控制动画的播放进程不准确,如果要控制最好通过改变动画里的变量参数的方式来控制,而真正的控制由FLASH自己来执行,这样准确一些!if(oFlashMovie.CurrentFrame==25)//在25祯处停止 
     oFlashMovie.StopPlay();
    这里是要求动画刚好在25帧处,才会执行停止,50帧的动画你执行这个函数只有1/50的机会碰到!太难了
      

  3.   

       是用oFlashMovie.GetVariable(),oFlashMovie.TGetProperty(timeline,property_constant)来控制吗?但是我不知道他们里面的timeline是什么,我知道property_constant是控制的代码,4就是current_frame动画中当前帧的位置。不知道怎么用?
      

  4.   


    <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各种状态的例子,可以获得当前运行的帧数。