Type was not found or was not a compile-time constant: DatagramSocketDataEvent

I'm trying to use DatagramSocket in a ActionScript3 project in Flash CS6 but after compiling, I get this error:

DatagramSocketClass.as, Line 24 1046: Type was not found or was not a compile-time constant: DatagramSocketDataEvent.

and this is my DatagramSocketClass.as code:

package com.example.udp
{
    import flash.display.Sprite;
    import flash.events.DatagramSocketDataEvent;
    import flash.events.Event;
    import flash.events.*;
    import flash.net.DatagramSocket;
    import flash.utils.ByteArray;

    public class DatagramSocketClass extends Sprite
    {
        private var datagramSocket:DatagramSocket = new DatagramSocket();

        public function World()
        {

            datagramSocket = new DatagramSocket();
            datagramSocket.bind("1111","127.0.0.1");
            datagramSocket.addEventListener(DatagramSocketDataEvent.DATA, dataReceived );
            datagramSocket.receive();
        }


        private function dataReceived( event:DatagramSocketDataEvent ):void
        {
            //Read the data from the datagram
            log("Received");
        }
    }

}

What's wrong with my code?

Answers


Datagram sockets are only available on AIR2 (and even then only on desktop - not mobile). Are you sure you want to use datagram sockets to begin with? "Regular" TCP sockets are usually sufficient (and safer and easier to use).


Need Your Help

CTP protocol in Castalia OMNET++

makefile make omnet++ ctp

I get this error when I make Castalia-3.2 with CTP https://code.google.com/p/ctp-castalia/. I have omnetpp-4.6.

Making SASL(with GSSAPI) enabled client and server with LDAP+kerberos as authenticator? (Single Sign on SSO sytstem)

c++ c kerberos openldap sasl

I have successfully installed ldap and kerberos. I was also able to make a simple c program with SASL/GSSAPI to search data in my ldapserver?

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.