Sunday, November 27, 2016

Menghubungkan 2 Aplikasi AIR Tapi Kok Error 2044

Menghubungkan 2 Aplikasi AIR Tapi Kok Error 2044


coba-coba menggunakan fungsi LocalConnection untuk menghubungkan 2 aplikasi AIR,tetapi setelah di coba kok error....

Error #2044: Unhandled AsyncErrorEvent:. text=Error #2095: flash.net.LocalConnection was unable to invoke callback TampilData. error=ReferenceError: Error #1069: Property TampilData not found on reicever and there is no default value.

coba lihat code di bawah :

 

Aplikasi Air 1 sebagi sender;

<?xml version="1.0" encoding="utf-8"?>
<mx:WindowedApplication quot; layout="absolute">
    <mx:Script>
        <![CDATA[
            private var kirimConn_LocalConnection=new LocalConnection();
             private function kirimData():void
             {
             var namaLengkap_String=nama.text;
            kirimConn.send("_myConnection", "TampilData",namaLengkap)
            }
        ]]>
    </mx:Script>
    <mx:Form x="0" y="0" width="341" height="174">
        <mx:FormItem label="Nama lengkap">
            <mx:TextInput id="nama"/>
        </mx:FormItem>
        <mx:Button label="Kirim Data" click="kirimData()"/>

    </mx:Form>
</mx:WindowedApplication>

 

Aplikasi Air 2 sebagi receiver:

<?xml version="1.0" encoding="utf-8"?>
<mx:WindowedApplication quot;
    layout="absolute" applicationComplete="init();">
    <mx:Script>
        <![CDATA[
            private var terimaConn_LocalConnection=new LocalConnection();
            private function init():void{
            terimaConn.client=this;
            terimaConn.allowDomain("*");
            terimaConn.connect("_myConnection");

            }
            private function TampilData(s:String):void{
            nama.text=s;
            }
        ]]>
    </mx:Script>
    <mx:TextArea x="167" y="88" width="221" height="131" id="nama"/>
</mx:WindowedApplication>

 

Ada yang tahu kenapa???

 

Bacaan Lainnya yang berhubungan dengan AIR Connection

  1. http://blog.everythingflex.com/2008/01/11/more-fun-with-air-localconnection-source-included/
  2. http://www.lonhosford.com/lonblog/2008/03/13/flex-liveconnection-and-legacy-flash-swfs/
  3. http://blog.kazumakzak.com/2008/11/26/flex-actionscript-project-sandbox-error-error-2044/

Available link for download