Custom events AHHHHHHRGH

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. :frowning: :frowning: :frowning:

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

here is my code:

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

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.

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