关于Fscommand和Javascript的配合

在网页里面,flash播放器是能够和浏览器通讯的。您能够在flash里面用Fscommand()发送参数给浏览器, 然后在浏览器里面用Movie1_DoFscommand()获得参数。movie1是您在html里面给这个swf文档的ID名。

  新建一个flash,插入一个按钮

  在按钮上添加AS

  

on(release){

  fscommand("press");

  }

  ?作用为当鼠标按下这个按钮时,发出一个名字叫"press"的FSCommand

  ?然后把他插进网页中,给他起一个ID的名字,如"jimsons";

  ?然后在中加进如下的代码:

  

  functionjimsons_DOFSCommand(command,args)

  //上面的一般是调用FSCommand所需要的格式,其中"jimsons"就是给插入网页中的FLASH动画的ID名字

  {

  if(command=="press")

  //当fscommand="press"时(按钮被按下时发出这个FSCommand)

  alert("呵呵,不要碰我啦!");

  //弹出警告菜单,这是属于JAVASCRIPT里的语句

  }

  

  

  Subjimsons_FSCommand(ByValcommand,ByValargs)

  calljimsons_DoFSCommand(command,args)

  endsub

  

  //运用VBScript,当FLASH发出FSCommand时,执行flash1_DoFSCommand(command,args);

  //flash1为FLASH动画的id,这也是运用FSCommand时一般所需要的格式

  将flash插入到网页中,将其ID号命名为jimsons如下

   ="vbscript">="javascript">

="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"

  codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0"

  name="jimsons"width="300"height="300">

  

  

  

  pluginspage="http://www.macromedia.com/go/getflashplayer";type="application/x-shockwave-flash"

  name="jimsons">

="jimsons.swf"width="300"height="300"quality="high"

="quality"value="high">="movie"value="jimsons.swf">