Skip to content
ivancheung edited this page Oct 25, 2011 · 3 revisions

If you only want to use the UDP Native Extension (For iPhone / iPad), you only need the "UDPExtension.ane" and the "UDPExtension.swc". You may take a look at: http://www.adobe.com/go/learn_using_native_extensions_in_apps_en/

Include the SWC as a library in the Flash builder project / Flash project, then you can compile the SWF file.

After you compiled the SWF file, you can compile the .ipa with the ANE.

The code sample (for Flash): import com.yuco.utils.UDPExtension; var p:UDPExtension = new UDPExtension(); p.addEventListener("Received", receiveData); p.addEventListener("StatusCode", onStatusCode); p.addEventListener("ErrorCode", onErrorCode); p.addEventListener("ErrorMessage", onErrorMessage); p.Connect("127.0.0.1", 1234); p.Send("Hello"); function receiveData(e:Event){ //do something with the p.ReceivedText trace('data: '+p.ReceivedText); } function onStatusCode(e:Event){ trace('status code : '+p.StatusCode); } function onErrorCode(e:Event){ trace('error code : '+p.ErrorCode); } function onErrorMessage(e:Event){ trace('error message : '+p.ErrorMessage); }

Clone this wiki locally