fscommand 函数
函数使 SWF 文件与 Web 页中的脚本能进行通讯。不过,脚本访问是由 Web 页的 fscommand
()allowScriptAccess
设置控制的。
用法 1:若要使用
将消息发送给 Flash Player,必须使用预定义的命令和参数。下表列出了可以为 fscommand
()
函数的 fscommand
()command
参数和 parameters
参数指定的值。这些值控制在 Flash Player 中播放的 SWF 文件,包括放映文件。(放映文件 是以可作为独立应用程序运行(也就是说,不需要使用 Flash Player 即可运行)的格式保存的 SWF 文件。)
命令 | 参数 | 目的 |
---|---|---|
| 无 | 关闭放映文件。 |
|
| 指定 |
|
| 指定 |
|
| 指定 |
| 应用程序的路径 | 在放映文件内执行应用程序。 |
|
| 指定 |
可用性:
- 表中描述的命令在 Web 播放器中都不可用。
- 所有这些命令在独立的应用程序(例如,放映文件)中都可用。
- 只有
allowscale
和exec
在测试影片播放器中可用。
参数
command:String
- 传递给主机应用程序用于任何用途的一个字符串,或传递给 Flash Player 的一个命令。
parameters:String
- 传递给主机应用程序用于任何用途的一个字符串,或传递给 Flash Player 的一个值。
示例
在下面的示例中,
将 Flash Player 设置为在松开 fscommand
()fullscreen_btn
或 unfullscreen_btn
按钮时将 SWF 文件放大到整个显示器屏幕大小。
this.fullscreen_btn.onRelease = function() { fscommand("fullscreen", true); }; this.unfullscreen_btn.onRelease = function() { fscommand("fullscreen", false); };