View Full Version : dial like a phone
jrdollesin
08-05-2006, 06:35 AM
i'm mimicing the classic telephone.
when the user dial inot the gear it roatets and register the number to be parse into the server. this is a log in page.
there's a problem, the gear always snaps into a certain angle with repsect to the mouse, what i want it as i press the gear it simply rotates(no need to follow mouse orientation) and switch back(easing) to 0 degrees when released which i had done so far.
jrdollesin
08-05-2006, 05:31 PM
can anyone help me to improve this!
sorry for that one i lost my thought i'd forgot to drop my question.
jrdollesin
08-05-2006, 05:33 PM
by the way, here's the script
<pre>_root.onLoad = function() {
var logoAngle = _root.logo_mc._rotation = 0;
var cursorAngle;
var newYPos;
var newXPos;
var pressing = false;
var newRotation;
}
function getAngle() {
radarY = _ymouse - _root.logo_mc._y;
radarX = _xmouse - _root.logo_mc._x;
radarAng = Math.atan((radarY*-1)/radarX)/(Math.PI/180);
if (radarX < 0) {
radarAngDis = radarAng + 180
} else {
radarAngDis = radarAng;
}
}
function rotateLogo() {
if (!pressing) {
_root.logo_mc._rotation *= .76;
if ((_root.logo_mc._rotation < .1 && _root.logo_mc._rotation > 0) || (_root.logo_mc. _rotation > -.1 && _root.logo_mc._rotation < 0)) {
_root.logo_mc._rotation = 0;
}
}
else {
//get angle from cursor to magnetic north, source point: logo's registration point.
newYPos = _ymouse - _root.logo_mc._y;
newXPos = _xmouse - _root.logo_mc._x;
cursorAngle = Math.atan(newYPos/newXPos)/(Math.PI/180);
logoAngle = Math.atan(newYPos/newXPos)/(Math.PI/180);
if (newXPos < 0) {
_root.logo_mc._rotation = logoAngle + 180;
} else {
_root.logo_mc._rotation = logoAngle;
}
}
}
function displayAngle() {
_root.angle = logo_mc._rotation;
}
_root.onEnterFrame = function() {
rotateLogo();
displayAngle();
getAngle();
}
</pre>
<pre>
and the script for object named logo_mc:
on (press) {
_root.pressing = true;
}
on (release, releaseOutside) {
_root.pressing = false;
}
</pre>
|
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.