开发者

How to check if a Flex application is run on a developer machine?

I know 开发者_如何学运维I could use "BrowserManager.getInstance()" to find out which from URL is my app running, but it doesn't work as I would expect (you can't read url in one line - you have to wait for an event).

Is it possible to do it in some simple way? Like you do in Flash:

if (this.getDepth() == -16384)


This is how I do it

var lc:LocalConnection = new LocalConnection();
switch ( lc.domain ){
  case "":
  case "localhost":
    trace('on a dev machine')
    break;
  case 'your.domain.com':
  default:
    trace('not dev so fall through')
}

A one liner could be done like

if(new LocalConnection().domain == "localhost" )


import flash.system.Security;

Security.sandboxType == Security.REMOTE

That tells you when it's running on the web.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜