# Passing Variable/Mouse Event through Event

**URL:** <https://forum.kirupa.com/t/passing-variable-mouse-event-through-event/308276>\
**Category:** flash\
**Created:** [April 20, 2010, 2:35pm UTC](https://forum.kirupa.com/t/passing-variable-mouse-event-through-event/308276 "2010-04-20T14:35:05Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![999chris](https://avatars.discourse-cdn.com/v4/letter/9/f17d59/32.png) [@999chris](https://forum.kirupa.com/u/999chris)\
**Post date:** [April 20, 2010, 2:35pm UTC](https://forum.kirupa.com/t/passing-variable-mouse-event-through-event/308276/1 "2010-04-20T14:35:05Z")

</div>

```auto
function brushOn(thisMouse:MouseEvent) {

	if (thisMouse.buttonDown) {
		grid.addEventListener(Event.ENTER_FRAME,painter);
	} else {
		grid.removeEventListener(Event.ENTER_FRAME,painter);
	}
}

function painter(e:Event) {

	var thisX:Number=Math.floor(grid.mouseX/10);
	var thisY:Number=Math.floor(grid.mouseY/10);

	editMap[thisY][thisX][0].gotoAndStop(chooserTile.currentFrame);
	editMap[thisY][thisX][1]=chooserTile.currentFrame;
	editMap[thisY][thisX][2]=true;
	**if (thisMouse.shiftKey) {**
		editMap[thisY][thisX][0].bound.alpha=1;
		editMap[thisY][thisX][2]=false;
	}
}

grid.addEventListener(MouseEvent.MOUSE_DOWN,brushOn);
grid.addEventListener(MouseEvent.MOUSE_UP,brushOn);

```

I used to actuate the **painter** function by using a _MouseEvent_ although I’m prefering to do it this way, but I’m having issues with an error “1120: Access of undefined property thisMouse.”  
**Error in Bold**

I’ve attempted to pass the Mouse Event to the **painter** function but had no luck.  
A simple solution (even potentially dangerous and WRONG) would be fine here, as this is part of University Coursework and I haven’t been taught Classes etc. Its basically an introduction to scripting but im trying to do things slightly out of my depth 😃
