co-pas script di bawah ini sebagai action pada sebuah frame
cekX = function (dx, lama, baru) {
if (lama<baru) {
trace("ke kanan -->");
} else if (lama>baru) {
trace("<-- ke kiri");
}
return baru;
};
cekY = function (dy, lama, baru) {
if (lama<baru) {
trace("ke bawah vvv");
} else if (lama>baru) {
trace("ke atas ^^^");
}
return baru;
};
this.watch("xdir", cekX); // watch content of xdir variable then call cekX
this.watch("ydir", cekY); // watch content of ydir variable then call cekY
// event handler of mouse movement
this.onMouseMove = function() {
xdir = _xmouse;
ydir = _ymouse;
};
trace() function can be replaced with commands to make animation or something else. Fungsi trace() dapat digantikan dengan perintah-perintah lain.
Tidak ada komentar:
Posting Komentar