一段在Flash中涂鸦的代码

在flash player 6,7,8中都能用:
var drawObj = new Object();
var idx = 1;
var pressed = false;
drawObj.onMouseDown = function() {
createEmptyMovieClip("line"+idx, idx);
pressed = true;
with ("line"+idx) {
lineStyle(1, 0x000000, 100);
moveTo(_xmouse, _ymouse);
}
};
drawObj.onMouseMove = function() {
if (pressed) {
with ("line"+idx) {
lineTo(_xmouse, _ymouse);
}
}
};
drawObj.onMouseUp = function() {
pressed = false;
idx++;
};
Mouse.addListener(drawObj);

你可能感兴趣的:(Flash)