PDA

View Full Version : mouse problem



TimisNew
January 17th, 2007, 10:46 AM
hey everyone.
i tryed to make a flash game and encountered some problems using my mouse.
the game works completely fine if the user uses the arrow keys on his keyboard but when it comes to using the mouse, 20 seconds before the game quits everything jiggles around and the performance becomes really bad.

is there anyone who knows why this could occur?


here is the script thats on the movieclip following the mouse or the key which is pressed:


onClipEvent(load){
speed = 35;
}
onClipEvent (enterFrame) {
var noise = new Object();
noise.onMouseMove = function (){
_x = _root._xmouse;
}
Mouse.addListener(noise);
//
if((Key.isDown(Key.RIGHT))){
this._x += speed;
}
else if((Key.isDown(Key.LEFT))){
this._x -= speed;
}
//
if (_x <= 140) {
_x = 140;
}
if (_x >=750) {
_x = 750;
}
}
i'd be gratefull for any help provided.
tim.

SacrificialLamb
January 17th, 2007, 02:52 PM
where are you puting this code coz i just copy pasted it (on to a MC in _root) and it's working for me

TimisNew
January 18th, 2007, 06:00 AM
the code is on the movieclip following the mouse or the key which is pressed...

anyhow i was able to solve the problem myself. i just removed the listener and replaced it with onMouseMove... i don't really know why this works better.
thanks scrificiallamb for taking time to look into the matter.
tim.