Accessing Flash Content


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

Flash movies can also be controlled via JavaScript. Among other things, you can start, stop, and pause the movie. For these purposes, the plug-in exposes the Play(), Rewind(), and StopPlay() methods. The following listing implements a simple control station for the Flash movie:

Accessing a Flash Movie from JavaScript (flash.html)

[View full width]

<object   class   codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash .cab#version=7,0,0,0"   width="400" height="550" >   <param name="allowScriptAccess"     value="sameDomain" />   <param name="movie" value="flash.swf" />   <embed src="/books/3/490/1/html/2/flash.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> 

Note

The allowScriptAccess options set in both the <object> and the <embed> elements allow JavaScript to actually access the Flash movie.





JavaScript Phrasebook(c) Essential Code and Commands
JavaScript Phrasebook
ISBN: 0672328801
EAN: 2147483647
Year: 2006
Pages: 178

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net