數(shù)據(jù)加載中……
          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 閱讀(278) 評論(0)  編輯  收藏 所屬分類: flex 3 -- blazeds


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


          網(wǎng)站導(dǎo)航:
           
          主站蜘蛛池模板: 南澳县| 沂南县| 龙泉市| 云阳县| 邳州市| 屏东市| 云和县| 南丹县| 吕梁市| 衡南县| 灵武市| 绥滨县| 垦利县| 枝江市| 嘉禾县| 柳州市| 安丘市| 连云港市| 磐石市| 固始县| 南昌县| 浑源县| 科尔| 金乡县| 河东区| 布尔津县| 合阳县| 大邑县| 甘谷县| 深州市| 饶平县| 赤峰市| 黄山市| 资阳市| 新沂市| 奉化市| 肇州县| 柘荣县| 长葛市| 罗定市| 封丘县|