Mouse Cursor Recorder
| Category | : Flash | Views | : 32834 | ||
| Version | : 8 | Rating | : | ||
| Type | : Text | Source File | : mouse-cursor-recorder.zip | ||
| Result | : See the result | ||||
var mPosX = new Array();
var mPosY = new Array();
Two arrays used for the _x and _y coordinates.
_root.onEnterFrame = function()
{
if(recording)
{
mPosX[index] = _root._xmouse;
mPosY[index] = _root._ymouse;
If recording store the current position of the mouse in these two arrays.
index++
}
Increases index to record next position.
else if (playing)
{
mouseMC._x = mPosX[index]
mouseMC._y = mPosY[index]
If we are playing set the position of the mouse copy to the position stored in the arrays.
index++;
Increase index by one to go to the next position recorded.
if(index == mPosX.length)
{
Mouse.show();
_root.mouseMC._visible = false;
}
}
}
If we got to the end of the recording show mouse and hide the mouse copy.
recBtn.onRelease = function()
{
Mouse.show();
If the record button is pressed show the mouse.
_root.mouseMC._visible = false;
Hide the mouse copy.
_root.recording = true;
_root.playing = false;
Set recording to true and playing to false.
_root.index = 0;
Set index to 0 to start the recordinh from the beginning.
_root.mPosX = new Array();
_root.mPosY = new Array();
}
When we set these two variables to new arrays we erase then completely so any recording that was there previously is erased.
playBtn.onRelease = function()
{
Mouse.hide();
If the user presses the play button hide the real mouse.