Razdom
Razdom

Reputation: 13

AS3 dispatchEvent not working on class

i created this event class:

package com.site {
    import flash.events.Event;

    public class clientEvent extends Event {
        public static const connectionSucceeded: String = "connectionSucceeded";

        public var prams: Object;

        public function clientEvent(type: String, prams: Object) {
            super(type);
            this.prams = prams;
        }
        override public function clone(): Event {
            return new clientEvent(type, prams);
        }
    }
}

and on other class (Not main) im writed:

dispatchEvent(new clientEvent(clientEvent.connectionSucceeded, new Object()));

Im import the class and its return this error: 1180: Call to a possibly undefined method dispatchEvent.

Upvotes: 0

Views: 562

Answers (1)

Petr Hrehorovsky
Petr Hrehorovsky

Reputation: 1153

The other class should extend EventDispatcher class.

See: http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/events/EventDispatcher.html

Upvotes: 1

Related Questions