Thursday, 15 March 2012

Start flash playback from javascript -



Start flash playback from javascript -

i have flash embedded in page:

<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="180" height="76" id="signuptop1" align="middle"> <param name="movie" value="/videos/signuptop1.swf" /> <param name="quality" value="high" /> <param name="bgcolor" value="#ffffff" /> <param name="play" value="false" /> <param name="loop" value="false" /> <param name="wmode" value="window" /> <param name="scale" value="showall" /> <param name="menu" value="false" /> <param name="devicefont" value="false" /> <param name="salign" value="" /> <param name="allowscriptaccess" value="samedomain" /> <!--[if !ie]>--> <object type="application/x-shockwave-flash" data="/videos/signuptop1.swf" width="180" height="76"> <param name="movie" value="/videos/signuptop1.swf" /> <param name="quality" value="high" /> <param name="bgcolor" value="#ffffff" /> <param name="play" value="false" /> <param name="loop" value="false" /> <param name="wmode" value="window" /> <param name="scale" value="showall" /> <param name="menu" value="false" /> <param name="devicefont" value="false" /> <param name="salign" value="" /> <param name="allowscriptaccess" value="samedomain" /> <!--<![endif]--> <div style="height:180px">&nbsp;</div> <!--[if !ie]>--> </object> <!--<![endif]--> </object>

i want start playback of flash film 5 seconds after page loaded. so, do:

settimeout(function () {document.getelementbyid("signuptop1").play();}, 5000);

and, getting error in chrome:

uncaught typeerror: object # has no method 'play'

what proper way start flash playback javascript? code sample appreciated.

thank you

try using,

settimeout(function () {var movie=eval(window.document[\'signuptop1\']); movie.play();}, 5000);

or

settimeout(function () {var movie=eval(document[\'signuptop1\']); movie.play();}, 5000);

javascript flash

No comments:

Post a Comment