2013-02-05 35 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