2013-02-05 36 views
0

我已经使用我的flex 3应用程序与facebook共享一个链接。在flex中与facebook分享链接

我的代码是:

<mx:Button id="btnFb" click="fbShare(event)" /> 

    protected function fbShare(event:MouseEvent):void 
    { 
    openPage('http://www.facebook.com/sharer/sharer.php?u='+getPublicationUrl(),"_popup"); 
    } 

    private function getPublicationUrl():String 
    { 
     return "http://domain.com/index.html?userid=3&pubid=10"; 
    } 

现在,当我分享与Facebook这(上述)链接,然后它会只共享“http://domain.com/index.html?userid=3”这个环节。它将跳过& pubid = 10

感谢,

+0

可能有逃避和 – 2013-02-05 14:53:33

+0

是的,但我想通过和发布商ID = 10,网址呢? – ketan

回答

0

你将要使用encodeURIComponent函数的getPublicationURL函数的返回数据:

private function getPublicationUrl():String 
{ 
    return encodeURIComponent("http://domain.com/index.html?userid=3&pubid=10"); 
} 

的核心问题是,原来的URL正在采取的& PubID的参数,因为它没有被编码。逃生,是encodeURI和encodeURIComponent方法更多信息,请访问:

When are you supposed to use escape instead of encodeURI/encodeURIComponent?

+0

Ohh非常感谢您的帮助 – ketan