What's a cool way to StopPlay(); a <object id="myflashvideo"> with JavaScript?
I heard that I can control Flash 开发者_如何学编程via Javascript.. but I really need some advice about the possibilitys of it. I have a Flash Video Movie .flv, I dont know if this makes a difference, which contains a navigation .swf.
HTML
<div class="video">
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" style="position:absolute;z-index:0;"width="809" height="459" id="FLVPlayer">
<param name="movie" value="FLVPlayer_Progressive.swf" />
<param name="quality" value="high" />
<param name="wmode" value="transparent" />
<param name="scale" value="noscale" />
<param name="salign" value="lt" />
<param name="FlashVars" value="&MM_ComponentVersion=1&skinName=flash/player&streamName=videos/Bens_neu&autoPlay=true&autoRewind=false;wmode=transparent" />
<param name="swfversion" value="8,0,0,0" />
<!-- Dieses param-Tag fordert Benutzer von Flash Player 6.0 r65 und höher auf, die aktuelle Version von Flash Player herunterzuladen. Wenn Sie nicht wünschen, dass die Benutzer diese Aufforderung sehen, löschen Sie dieses Tag. -->
<param name="expressinstall" value="scripts/expressInstall.swf" />
<!-- Das nächste Objekt-Tag ist für Nicht-IE-Browser vorgesehen. Blenden Sie es daher mit IECC in IE aus. -->
<!--[if !IE]>-->
<object id="FLVPLayer" type="application/x-shockwave-flash" data="FLVPlayer_Progressive.swf" width="809" height="459">
<!--<![endif]-->
<param name="quality" value="high" />
<param name="wmode" value="transparent" />
<param name="scale" value="noscale" />
<param name="salign" value="lt" />
<param name="FlashVars" value="&MM_ComponentVersion=1&skinName=flash/player&streamName=videos/Bens_neu&autoPlay=true&autoRewind=false;wmode=transparent" />
<param name="swfversion" value="8,0,0,0" />
<param name="expressinstall" value="scripts/expressInstall.swf" />
<!-- Im Browser wird für Benutzer von Flash Player 6.0 und älteren Versionen der folgende alternative Inhalt angezeigt. -->
<div>
<h4>Für den Inhalt dieser Seite ist eine neuere Version von Adobe Flash Player erforderlich.</h4>
<p><a href="http://www.adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Adobe Flash Player herunterladen" /></a></p>
</div>
<!--[if !IE]>-->
</object>
<!--<![endif]-->
</object>
</div>
Pseudo Javascript (btw I use JQuery on the website.. maybe we can short code with that, but not required)
GetDocumentObjectID("FLVPlayer").StopPlay();
Is there a cool, easy way to get this done? I prioritize IE 8,7.. but it is okay if it worked in all other browsers too.
i'm no flash expert, but i think that if you want to interact with the swf via javascript, you should have methods built in the swf.
ex : if your flash movie has a method "stop" that stops the movie, you could call the same method from javascript and have the same results :
document.getElementById('FLVPlayer').stop();
I don't know about cool, but this certainly should be easy.
This jQuery plugin (based on the original SWFObject) should be very useful for your purpose
You can easily do stuff like these:
function play() {
flashMovie.flash(
function() {
this.Play();
}
);
}
function pause() {
flashMovie.flash(
function() {
this.StopPlay();
}
);
}
examples taken from http://jquery.thewikies.com/swfobject/examples
精彩评论