This is a simple test file that shows how to make eyes that follow the position of your mouse cursor.
This particular flash was done in Flash 8, but I don't see why this shouldn't work with ANY other flash version, since it's only 3 lines of code.
Send me a PM if you are interested in the .fla
And this is how I did it:
0) place "stop()" in the first picture of the root timeline
1) create a movie clip with your eye (if you want that the Iris moves seperatly make it into an own movie clip)
2) use the "onClipEvent(enterFrame)" command in the movie clip to initialise the following commands more or less in real time
3) put "this._x = _xmouse/10" and "this._y = _ymouse/10" in the function.
"this._x" sets the x relative x position for the movie clip the code is in.
The "_xmouse" gets the current x position of the cursor.
So basicly what you do is you set the x position of the moviclip = the x position of the cursor (same for y).
But since it would stick to your cursor like this you divide the current x (or y) position of the cursor through 10 (or any other number) so that it only moves by a certain degree to your cursor.
4) repeat this step for the Iris
(depending on how you made your movieclips you might need to set a fixed x and y offset. Also you need to change the factor the mousepositions are divided through to something smaller to get it like in this test. This way the Irsis will move further to the mouse then the eyes.)
5) you should end up with something like this in every eye (and Iris) you made:
this._x = _xmouse/10
this._y = _ymouse/10}
or (If you get a offset from the original position)
this._x = 100 + _xmouse/10
this._y = 100 + _ymouse/10}
where the 100 would be any x or y offset you need to add (I think that you can avoid this if you place your movieclip in a group or another movieclip)
If you find any mistakes in this, or got any questions about the flash feel free to post your questions in the comments. I'm allways happy to help, as far as I'm possible to.
You want to leave me a comment, but don't got an account
or just want to stay anonymous?
Visit my blog at: [link]
Direct link to this flash: [link]