I’m still having trouble with custom events and data parameters.
I have a custom event class:
package customEvents
{
import flash.events.Event;
public class Di_Event extends Event
{
public static const DI_LOAD:String = 'Di_Load';
public var data: Object;
public function Di_Event(type:String, data: Object, bubbles:Boolean=false, cancelable:Boolean=false)
{
super(type, bubbles, cancelable);
this.data = data;
}
override public function clone():Event
{
return new Di_Event (type, data, bubbles, cancelable);
}
}
}
I dispatch a new Di_Event with a second parameter that i assume is being passed to the data object in the custom event class.
dispatchEvent(new Di_Event(Di_Event.DI_LOAD, event.currentTarget.name));
I listen for the custom event.
addEventListener(Di_Event.DI_LOAD, di_load);
private function di_load(e:Event){
//this does not work!!!
trace(e.data);
}
how do i get the string data that should be in the data object passed with the event object?
thanks for any help
B