AS3.0 退出Flash播放器
可能的重复:
AS3.0 重播整部电影(*SWF 文件)
我用 Actionscript 3.0 和 flash 制作了一个小游戏。
当玩家赢得游戏或“游戏结束”时,我的玩家应该有 2 个选择。除了重播之外,我希望玩家能够从游戏中退出游戏。那么有没有办法用actionscript关闭/退出/杀死Flash播放器?
Possible Duplicate:
AS3.0 Replay the whole movie (*SWF file)
I made a small game in Actionscript 3.0 and flash.
When the player wins the game or is 'game over' my player should have 2 options. Besides replay i want the player to be able to quit the game from wihin the game. So there a way to close/quit/kill the flash player with actionscript ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
那么,您有 2 个选择:
如果您想杀死网页内的 Flash 对象,可以使用 JavaScript,使用 swfobject.removeSWF。 此处有一个示例。
Well, you have 2 options:
If you want to kill the flash object inside the web page, that would be possible using JavaScript, using swfobject.removeSWF. There is a sample here.
不可以。您无法使用操作脚本终止虚拟机。有一些 AS3 命令可以暂停/恢复(睡眠)Flash Player VM,但这些命令仅在调试模式下工作,只能从 IDE 本地启动。可以使用某些服务器端或客户端 HTML/JS 或其他东西来删除该项目,但绝对不能从虚拟机本身内部删除该项目。
No. You cannot kill the VM with actionscript. There are some AS3 commands to pause/resume (sleep) the flash player VM but these ONLY work in debug mode, which can only be launched locally from the IDE. It may be possible to remove the item using some server side or client side HTML/JS or something but absolutely not from within the VM itself.
嗯,是的,您可以使用 Flash 调用 JavaScript 并删除保存它的 div/span(请参阅
fscommand
和ExternalInterface
),但我认为这不是你最好的选择——它太容易失败,而且太容易受到环境的影响。如果可以的话,只需使用 离开该页面即可
navigateToUrl(new URLRequest(), "_self")
Well, yes, you could use Flash to call JavaScript and remove the div/span which is holding it (see
fscommand
andExternalInterface
), but I don't think that is your best option -- it is too prone to failure and it is too subject to its environment.If you can, just navigate away from that page using
navigateToUrl(new URLRequest(<ip>), "_self")