數據加載中……
          use localConnection to comunicate between SWF
          Flex local connection is an amazing functionality. With it, you can have two SWF comunicate easily.

          Here is a simple example to demonstrate how it work base on Adobe training and my practice.

          On Sender(client) side:
           <mx:Script>
            <![CDATA[
             import flash.net.LocalConnection;   //do the import
             private var conn:LocalConnection; 
             
             private function init():void{
              conn = new LocalConnection();  // create a new local connection instance
              conn.send("_mylocalconnection", "doCloseAgentPopup");  //send request to receiver(server) side. "_mylocalconnection" is kind of connection node. 
                                                                                                      // "doCloseAgentPopup" is the function to call. you can also use some parameters followed it
             }
            ]]>
           </mx:Script>

          On Receiver(server) side:
              import flash.net.LocalConnection;
              private  var conn:LocalConnection;
                     
             private function initLocalConn():void
             {
              conn = new LocalConnection();
              conn.client = this;    // notice that this is called "client" here. I think it mean it is a client to provide service to other side.
              conn.connect("_mylocalconnection");    // connect to the node "_mylocalconnection" and wait call from other side
             }
             
             public function doCloseAgentPopup():void{        //this is the function to call from sender side. in this function, do general flex funtion as you like
              if(MyTitleWindow != null){
               PopUpManager.removePopUp(agentTitleWin);
               agentTitleWin = null;
               checkAgentStatus();
              }
             }

          That is it. simple but work well. Enjoy it!

          posted on 2009-07-02 21:27 yellowstone 閱讀(277) 評論(0)  編輯  收藏 所屬分類: flex 3 -- blazeds


          只有注冊用戶登錄后才能發表評論。


          網站導航:
           
          主站蜘蛛池模板: 茂名市| 凤冈县| 韶关市| 辰溪县| 大荔县| 翁源县| 泽普县| 图们市| 凤庆县| 盐山县| 铜梁县| 济阳县| 化隆| 铁岭市| 马山县| 安吉县| 罗山县| 兰溪市| 五常市| 巴马| 石泉县| 周口市| 鹤岗市| 兰坪| 正安县| 汶上县| 嘉兴市| 营山县| 潍坊市| 黄龙县| 珲春市| 威信县| 南汇区| 泸水县| 托克托县| 定安县| 华亭县| 高安市| 长宁县| 千阳县| 楚雄市|