PDA

View Full Version : Dispatch Event


Darksydaz
01-20-2011, 10:57 PM
I'm trying to figure out the Add Event Listener conditions for a "Dispatch Event" to work... is it inside the class with the function? the OOP is the confusing part to this entire thing. Egh.. help!!!

package scripts {
import flash.events.Event
...
public function example() {
addEventListener("call", myTest)
}
public function myTest(ev:Event) {

}
}

tadster
01-20-2011, 11:23 PM
If example is the name of the class, in some other class, to dispatch the "call" event on example you do

var ex:example = new example();
ex.dispatchEvent(new Event("call"));