开发者

Advance flash via javascript

I've been reading that I can simply advance my flash movie using the js play method:

object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="260" height="373" id="myFlashMov">
      <param name="movie" value="myflashmovie.swf" />
      <param name="play" value="true" />
      <param name="loop" value="false" />
      <param name="menu" value="false" />
      <param name="quality" value="high" />
      <param name="scale" value="showall" />
      <param name="wmod开发者_如何学Ce" value="opaque" />
      <param name="bgcolor" value="#FFFFFF" />
      <param name="allowscriptaccess" value="sameDomain" 

var player1 = document.getElementById("myFlashMov");
 player1.play();

But the browser continues to say play is not a function. Do I have to do something specific within the flash to register this js function?


You should check the ExternalInterface class. See the docs

The ExternalInterface class allows for a two way communication between AS3 & JS.


Try:

var player1 = document.getElementById("myFlashMov");
player1.Play();

The capital P should do the trick. It works for me.

Edit:

You may also need to put the <param name="allowScriptAccess" value="sameDomain"/> tag inside your object-tag. I am not sure that this is needed, but it doesn't hurt

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜