开发者

Cannot retrieve the browser URL for Mac OS users with Flex

开发者 https://www.devze.com 2023-03-22 05:58 出处:网络
I have a very weird problem. I\'m developing a very simple flex application on Windows 7 64 Bits. It retrieves the user url and then show it:

I have a very weird problem. I'm developing a very simple flex application on Windows 7 64 Bits. It retrieves the user url and then show it:

   public var bm:IBrowserManager;
    protected function button1_clickHandler(event:MouseEvent):void{
      bm= BrowserManager.getInstance();
      bm.init();
      Alert.show("Your URL is : " + bm.url);
    } 

On my Windows 64 Bits machine (Chrome, FF), it works fine and returns the URL. But, when I run my project on a Mac OS X machine (Safari, Chrome, FF) : it shows:

Alert.show(Your URL is : Null);

I think that it cannot retrieve the browser instance or cannot init the browser manager. I don't know.

Is it a known problem? Is it related to the OS? Is there a workaround?

开发者_高级运维Thanks


I vaguely remember having a problem with browser manager before too. Try moving the getInstance() outside of the function call. I think I remember that fixed it for me.

i.e.

public var bm:IBrowserManager = BrowserManager.getInstance();
protected function button1_clickHandler(event:MouseEvent):void{
  bm.init();
  Alert.show("Your URL is : " + bm.url);
} 

If that fails, try moving the init() outside of the handler as well. That could be asynchronous for Mac.

0

精彩评论

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