Actionscript 检测flash测试播放器

Actionscript 检测flash测试播放器,actionscript,air,flash,Actionscript,Air,Flash,我注意到在flash test player中有一些特定的AIR选项不起作用(当您按住Ctrl+enter键时可以预览电影) 一个例子是 如果从独立播放器调用它(例如双击swf文件),它可以工作,但是如果我在flash ide上测试它,它将抛出一个错误 有没有办法检测我是否在ide中测试电影,从而避免使用该属性?有一个名为playerType的属性,当使用测试播放器时,该属性设置为“外部”,当使用AIR时,该属性设置为“桌面”。所以 import flash.system.Capabilitie

我注意到在flash test player中有一些特定的AIR选项不起作用(当您按住Ctrl+enter键时可以预览电影)

一个例子是

如果从独立播放器调用它(例如双击swf文件),它可以工作,但是如果我在flash ide上测试它,它将抛出一个错误

有没有办法检测我是否在ide中测试电影,从而避免使用该属性?

有一个名为playerType的属性,当使用测试播放器时,该属性设置为“外部”,当使用AIR时,该属性设置为“桌面”。所以

import flash.system.Capabilities;

...

if (Capabilities.playerType != 'External')
  // do stuff that don't work in the test player
if (Capabilities.playerType == 'Desktop')
  // do stuff that works only in AIR

几乎重复:在另一个问题中,没有指定调试播放器。