# Custom events AHHHHHHRGH

**URL:** <https://forum.kirupa.com/t/custom-events-ahhhhhhrgh/225708>\
**Category:** Uncategorized\
**Created:** [May 15, 2007, 2:03am UTC](https://forum.kirupa.com/t/custom-events-ahhhhhhrgh/225708 "2007-05-15T02:03:00Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![designcliche](https://avatars.discourse-cdn.com/v4/letter/d/ac91a4/32.png) [@designcliche](https://forum.kirupa.com/u/designcliche)\
**Post date:** [May 15, 2007, 2:03am UTC](https://forum.kirupa.com/t/custom-events-ahhhhhhrgh/225708/1 "2007-05-15T02:03:00Z")

</div>

I’ve learned that working with events along with dynamic content is tricky in as3.  
all I need is to pass a number to an event so I can access my arrays and I cannot get it to work. ☹ ☹ ☹

If someone has time to help or explain what I’m doing wrong thanks ahead of time 🙂

here is my code:

```auto
package Classes.Events {
    import flash.events.Event;
    
    public class CustomEvent extends Event {
        
        public static const MY_ROLLOVER:String = "myRollOver";
        
        public var inter:Number;
        
        public function CustomEvent(inter:Number):void
        {
            super(MY_ROLLOVER);
            this.inter = inter;
        }
        override public function clone():Event {
            return new CustomEvent(inter);
        }
    }
}

```

In the other script

```auto
squareArr[counter].addEventListener(CustomEvent,rollover); 
squareArr[counter].dispatchEvent(MouseEvent.MOUSE_OVER,CustomEvent(counter));

private function rollover(events:CustomEvent)
{
    trace("Ahh");
}

```

and i am getting this error.

```auto
TypeError: Error #1034: Type Coercion failed: cannot convert 0 to Classes.Events.CustomEvent.
    at Classes::BuildHome/::fillTheBoard()
    at Classes::BuildHome$iinit()

```
