Monday, August 27, 2007

access flash from javascript

access flash from javascript
======================


<object
classid="clsid:d27cdb6e-ae6d-11cf-96b8-
444553540000"
codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash
.cab#version=7,0,0,0"
width="400" height="550" id="flash">
<param name="allowScriptAccess"
value="sameDomain" />
<param name="movie" value="myflash.swf" />
<embed src="myflash.swf" width="400" height="550"
name="flash"
allowScriptAccess="sameDomain"
type="application/x-shockwave-flash"
pluginspage="http://www.macromedia.com/go/getflashplayer" />
</object>
<a href="javascript:document.flash.Play();">
Play</a>
<a href="javascript:document.flash.Rewind();">
Stop</a>
<a href="javascript:document.flash.StopPlay();">
Pause</a>

just look at the following which are key methods to be called:

document.flash.Play();
document.flash.Rewind();
document.flash.StopPlay();




Also look at allowScriptAccess option at object and embed tags. This is necessary to run the movie clip.

No comments: