我正在使用SWFObject 2.2在页面上嵌入三个Flash电影,然后使用JavaScript的SetTimeout尝试使用ExternalInterface播放和暂停电影。它在OS X上的Firefox和Safari中工作,但在Windows上的Firefox或Internet Explorer 8中不起作用。 SWF嵌入很好,但不响应播放或暂停。
var params = {
wmode: "transparent",
bgcolor: "#000000"
};
var attributes1 = {};
attributes1.id = "movie01_swf";
var attributes2 = {};
attributes2.id = "movie02_swf";
var attributes3 = {};
attributes3.id = "movie03_swf";
swfobject.embedSWF("movie_one.swf","movie01_movie","650","275","10.0.0",null,null,params,attributes1,null);
swfobject.embedSWF("movie_two.swf","movie02_movie","650","275","10.0.0",null,null,params,attributes2,null);
swfobject.embedSWF("movie_three.swf","movie03_movie","650","275","10.0.0",null,null,params,attributes3,null);
function pause_movie01(){
var movie01 = document.getElementById('movie01_swf');
movie01.pause();
}
function play_movie02(){
var movie02 = document.getElementById('movie02_swf');
movie02.play();
}
function pause_movie02(){
var movie02 = document.getElementById('movie02_swf');
movie02.pause();
}
function play_movie03(){
var movie03 = document.getElementById('movie03_swf');
movie03.play();
}
setTimeout("play_movie02()",3000);
setTimeout("pause_movie01()",4500);
setTimeout("play_movie03()",6000);
setTimeout("pause_movie02()",9000);
我也使用jQuery和easySlider为页面上的幻灯片制作动画;电影嵌入在不同的幻灯片中。
<ul>
<li>
<div class="movie"><div id="movie01_movie"></div></div>
</li>
<li>
<div class="movie"><div id="movie02_movie"></div></div>
</li>
<li>
<div class="movie"><div id="movie3_movie"></div></div>
</li>
</ul>