my intention:
creating a sketchpad that records mouse movements so the drawing can be played back.
problem:
_xmouse and _ymouse are not being saved in the array. i get an ‘undefined’ error when trying to read a position that should exist somewhere in the array.
code:
history = new Array();
history[0] = new Array();
history[0][0] = new Array();
history[0][0][0] = new Array();
var i = 0;
var j = 0;
_root.createEmptyMovieClip(“line”, 1);
_root.onMouseDown = function() {
line.moveTo(_xmouse, _ymouse);
line.lineStyle(1, 0x000000, 100);
this.onMouseMove = function() {
line.lineTo(_xmouse, _ymouse);
updateAfterEvent();
history*[j][0] = _xmouse;
history*[j][1] = _ymouse;
j += 1;
};
i += 1;
j = 0;
};
_root.onMouseUp = function() {
this.onMouseMove = null;
};
this.button.onPress = function() {
line.clear();
for (a=0; history[a][0][0] != null; a++) {
line.moveTo(history[a][0][0], history[a][0][1]);
for (b=1; history[a][0] != null; b++) {
line.lineTo(history[a][0], history[a]**[1]);
updateAfterEvent();
}
}
};