# Send data object with Custom event

**URL:** <https://forum.kirupa.com/t/send-data-object-with-custom-event/331737>\
**Category:** flash\
**Created:** [October 9, 2013, 4:16pm UTC](https://forum.kirupa.com/t/send-data-object-with-custom-event/331737 "2013-10-09T16:16:45Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![bonassus](https://avatars.discourse-cdn.com/v4/letter/b/ea5d25/32.png) [@bonassus](https://forum.kirupa.com/u/bonassus)\
**Post date:** [October 9, 2013, 4:16pm UTC](https://forum.kirupa.com/t/send-data-object-with-custom-event/331737/1 "2013-10-09T16:16:45Z")

</div>

I’m still having trouble with custom events and data parameters.

I have a custom event class:

```auto
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.

```auto
dispatchEvent(new Di_Event(Di_Event.DI_LOAD, event.currentTarget.name));

```

I listen for the custom event.

```auto
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
