![]() |
|
||||||||||
|
|||||
|
Регистрация: Jan 2006
Сообщений: 9
|
в следующем коде нужно чтобы в какую-нибудь переменную сохранялась сумма всех длинн. т.е. есть переменная dlinna и надо например в переменную dlinnasum сохранять длины всех векторов.
this.createEmptyMovieClip("canvas_mc", this.getNextHighestDepth());
var mouseListener:Object = new Object();
mouseListener.onMouseDown = function() {
this.isDrawing = true;
this.orig_x = _xmouse;
this.orig_y = _ymouse;
coordinatex = _xmouse;
coordinatey = _ymouse;
this.target_mc = canvas_mc.createEmptyMovieClip("", canvas_mc.getNextHighestDepth());
};
mouseListener.onMouseMove = function() {
if (this.isDrawing) {
this.target_mc.clear();
this.target_mc.lineStyle(1, 0xFF0000, 100);
this.target_mc.moveTo(this.orig_x, this.orig_y);
this.target_mc.lineTo(_xmouse, _ymouse);
this.target_mc.lineTo(this.orig_x, this.orig_y);
}
updateAfterEvent();
};
mouseListener.onMouseUp = function() {
coordinatex1 = _xmouse;
coordinatey1 = _ymouse;
katety = Math.abs(coordinatey-coordinatey1);
katetx = Math.abs(coordinatex-coordinatex1);
dlinna = Math.sqrt(katetx*katetx+katety*katety);
this.isDrawing = false;
};
Mouse.addListener(mouseListener);
заранее спасибо. Последний раз редактировалось Antares; 29.01.2006 в 16:09. |
|
|||||
|
Banned
[+1 16.05.2006]
[++1 16.05.2006] [+ 1 21.05.06] [++ за хамство] [+1 21.05.2006] Регистрация: Dec 2003
Сообщений: 3,925
|
Пользуемся тэгом code
|
|
|||||
|
Регистрация: Dec 2002
Адрес: Живу вот где-то
Сообщений: 493
|
this.createEmptyMovieClip("canvas_mc", this.getNextHighestDepth());
var dlinasum:Number=0;
var mouseListener:Object = new Object();
....
mouseListener.onMouseUp = function() {
coordinatex1 = _xmouse;
coordinatey1 = _ymouse;
katety = Math.abs(coordinatey-coordinatey1);
katetx = Math.abs(coordinatex-coordinatex1);
dlinna = Math.sqrt(katetx*katetx+katety*katety);
dlinasum+=dlinna;
this.isDrawing = false;
};
Mouse.addListener(mouseListener);
|
![]() |
![]() |
Часовой пояс GMT +4, время: 04:45. |
|
|
« Предыдущая тема | Следующая тема » |
|
|