PDA

View Full Version : distinguishing upwards and downwards mouse movements


AssMunch
08-25-2005, 02:35 PM
basically, i am trying to build an mp3 player in flash for my website and i want the volume control to be a rotating one. i have tried several ways of making the volume control rotate when you click on it, hold down the mouse and then drag it up and down, but my problem is getting flash to recognise the difference between an upwards movement with the mouse and a downwards movement with the mouse.

posting this was a last resort, and all the code i have tried so far has been deleted, so all i have for the volume control is the movieclip which i want to rotate. also, i need a way of limiting how far the clip can rotate, so that it will not rotate for the whole 360 degrees.

any help would be greatly appreciated, as i am completly stumped :confused: (i have been using flash for about 3 months, but mostly just for animation and simple interactions like buttons, this is all new to me :) )

Sunny13
08-26-2005, 07:53 AM
plz try this code... if u can make use of it ... :).... I will try to send you some better alternative.....:)
var mouseListener:Object = new Object();
mouseListener.onMouseWheel = function(delta:Number) {
trace(delta);
ClipName._rotation = delta;
};
mouseListener.onMouseDown = function() {
trace("Down");
};
Mouse.addListener(mouseListener);

Sunny13
08-26-2005, 08:03 AM
try this one out
var objMain = this;
objMain.OldRotation = 0;
var mouseListener:Object = new Object();
mouseListener.onMouseWheel = function(delta:Number) {
if (delta>0 and objMain.OldRotation<360) {
clip_mc._rotation += delta;
objMain.OldRotation += delta;
}
if (delta<0 and objMain.OldRotation>=0) {
clip_mc._rotation += delta;
objMain.OldRotation += delta;
}
trace(objMain.OldRotation);
};
mouseListener.onMouseDown = function() {
trace("Down");
};
Mouse.addListener(mouseListener);