# Back to basics, tracking mouse coords into an array

**URL:** https://forum.kirupa.com/t/back-to-basics-tracking-mouse-coords-into-an-array/103839
**Category:** Uncategorized
**Created:** [March 9, 2004, 9:02pm UTC](https://forum.kirupa.com/t/back-to-basics-tracking-mouse-coords-into-an-array/103839 "2004-03-09T21:02:46Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![xMetal](https://avatars.discourse-cdn.com/v4/letter/x/c6cbf5/32.png) [@xMetal](https://forum.kirupa.com/u/xMetal)
#### Post date: [March 9, 2004, 9:02pm UTC](https://forum.kirupa.com/t/back-to-basics-tracking-mouse-coords-into-an-array/103839/1 "2004-03-09T21:02:46Z")

</div>

Hello all,

I’ve been reading through all the various threads related to the drawing API and saving drawings. About a hundred times I’ve seen mention of “log mouse positions into an array” and stuff like that, but I can’t find any clear and simple examples of how to do this.

Let’s take a very simple use of the drawing object to do freeform drawing. What is the AS to capture the mouse XYs as the user draws and put that into an array. I can’t figure out how to get Flash to keep updating things as I go, it invariably grabs the fist point and that’s it.

Could one of you AS gods just write out a super simple routine for this? I know I’m not the only one that needs this (as it seems to be asked every week)

Let’s use the most basic drawing example I can find:

[AS]\_root.createEmptyMovieClip(“line”,1);

\_root.onMouseDown = function(){  
line.moveTo(\_xmouse,\_ymouse);  
line.lineStyle(0,0x000000,100);  
this.onEnterFrame = function(){  
line.lineTo(\_xmouse,\_ymouse);  
}  
}  
\_root.onMouseUp = function(){  
this.onEnterFrame = null;  
}[/AS]

Where/what gets added to just capture all those \_xmouse and \_ymouse?

Thanks a bajillion everyone
