I have got two players in a test page. The one is included with an embed tag:
<embed
src="player.swf"
width="480"
height="360"
allowscriptaccess="always"
allowfullscreen="true"
wmode="opaque"
id="zzz"
name="zzz"
flashvars="file=items/05_atletico_seat_believe.flv&autostart=false&controlbar=over"
/>The other is embedded with Swfobject:
<span id="video_08_content3">Sorry, you need Adobe Flash to view this video. Please install it.</span>
<script type="text/javascript">
/* Filename, ID, width, height, Flash version */
var so = new SWFObject('player.swf','xxx','480','360','8');
/* Allow full screen */
so.addParam("allowfullscreen","true");
/* Allow other layers to appear above Flash */
so.addParam("wmode", "opaque");
/* Media file to display */
so.addVariable("file","items/05_atletico_seat_believe.flv");
/* Start playing on load */
so.addVariable("autostart","false");
/* false - play only one playlist item, list - play all once, true - loop all */
so.addVariable("repeat","false");
/* Height and width again for IE */
so.addVariable("height","360");
so.addVariable("width","480");
/* Video display area - minus playlist */
so.addVariable("displayheight","360");
/* Number of seconds of video to buffer - default 3 */
so.addVariable("bufferlength","6");
/* Number of seconds images are shown */
so.addVariable("rotatetime","5");
/* Control bar appears over video */
so.addVariable("controlbar","over");
/* Hide play icon in middle of screen */
so.addVariable("showicons","false");
/* Don't shuffle playlist items */
so.addVariable("shuffle","false");
/* Default image when flvplayer inactive */
so.addVariable("image","items/05_atletico_seat_believe.jpg");
so.write('video_08_content3');
</script>
I'm telling each player to stop using a pair of links. For one, I'm getting the player element first with var mplayer = document.getElementById('xxx'); and then using it in the link <a href="javascript:mplayer.sendEvent('stop');">Stop 1</a>. For the other I'm putting the whole reference directly in the link: <a href="javascript:document.getElementById('xxx').sendEvent('stop');">Stop 2</a>.
Neither of these links works in Firefox 3 or IE7. In Firefox I get the Javascript error document.getElementById("xxx").sendEvent is not a function.
Can anybody please suggest what I am doing wrong?
Thanks!
Aethaelwaerd
Please see this thread http://www.jeroenwijering.com/?thread=12482 for a tested and proven method for getting the reference object for two or more v4.x players.
The embed element should have the "name" attribute only, not the "id" attribute. Reference: http://kb.adobe.com/selfservice/viewContent.do?externalId=tn_12701