var options:Array = [[Option1, New, true], [Option2, Load, false], [Option3, Exit, true]]
addEventListener(MouseEvent.MOUSE_OVER, MouseHandler)
addEventListener(MouseEvent.MOUSE_OUT, MouseHandler)
addEventListener(MouseEvent.CLICK, MouseHandler)
private function MouseHandler(e:MouseEvent) {
if (e.target == Check()[0] && Check()[2]) {
if (e.type == MouseEvent.MOUSE_OVER) {e.target.filters = null}
if (e.type == MouseEvent.MOUSE_OUT) {e.target.filters = [filter]}
if (e.type == MouseEvent.CLICK) {Check()[1]()}
}
function Check() {for(var i:int = 0; i < options.length; i++) {if (e.target == options[i][0]) {return options[i]}}}
}
I get the error
"TypeError: Error #1010: A term is undefined and has no properties.
at Menus::MainM/MouseHandler()"
whenever one of the 3 eventslistener's events are dispatched
and when I replace "e.target == Check()[0]" with "(e.target == Option1 || e.target == Option2 || e.target == Option3)" I don't get the error.