Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can I make an interactive old telephone disc? 2

Status
Not open for further replies.

Ionutzvlad

Technical User
Nov 1, 2002
10
RO
I want to make a telephone disc(old telephones) to rotate when clicking on the numbers 1,2,3...9,0. But not just clicking, but drag the number button. For example to put the mouse on the number 1 hole, and when pressed to drag the #1 hole down and make the whole disc rotate. Imagine an old telephone and you will know What I have in mind. Please help me.
Thanks!
 
Can you post your email address? I made you a sample.

(sorry, my server is down)

frozenpeas
 
I'll just post the code.

On the dial MC I have:

Code:
onClipEvent (load) {
	rest = this._rotation;
	speed = 5;
}
onClipEvent (enterFrame) {
	// drag
	if (pressed == 1) {
		ang = Math.atan2(_ymouse, _xmouse);
		// convert from radians to degrees
		ang = Math.floor(180*ang/Math.PI)+90;
		this._rotation += ang;
	}
	// return dial
	if (pressed == 0) {
		if (this._rotation>rest) {
			this._rotation -= speed;
		}
		if (this._rotation<rest) {
			this._rotation += speed;
		}
	}
	updateAfterEvent();
}

Inside the dial MC is a button whose actions contain:

Code:
on (press) {
	_global.pressed = 1;
}
on (release, dragOut) {
	_global.pressed = 0;
}

Badda bing, badda boom.
 
My e-mail adress is ral.vlad@fx.ro
I voted your tip, and thanks very much.
Though it doesn't seem to work. I don't know why.
If you could give me a &quot;.fla&quot; sample I think would be perfect.
Thank you very much again
Ionutz
 
something like this:

Code:
onClipEvent (load) {
	var rest = _rotation;
	var speed = 5;
	var pressed = false;
}
onClipEvent (enterFrame) {
	if (pressed) {
		Xdiff = _root._xmouse-_x;
		Ydiff = -(_root._ymouse-_y);
		radAngle = Math.atan(Ydiff/Xdiff);
		if (Xdiff<0) {
			corrFactor = 270;
		} else {
			corrFactor = 90;
		}
		_rotation = rot -radAngle*360/(2*Math.PI)+corrFactor;
	} else {
		_rotation += (rest-_rotation)/speed;
	}
}

Regards
David Byng
spider.gif

davidbyng@hotmail.com
 
&quot;Ce faci&quot; IONUTZVLAD?
Sorry guys...out of topic.

Great examples here! Regards,
Dragos.


 
Eu fac bine. Dar as face si mai bine daca m-ai putea ajuta cu primul script al lui frozenpeas. Daca te pricepi...
De ce nu merge? Incearca-l si tu.
Mersi
 
David!
When you press the 3 button for example the wheel isn't supposed to turn to right not to left? Regards,
Dragos.


 
I forgot and saved it as MX - I've just mailed a Flash 5 version to you...
 
Can you send it to me too Wangbar pls?
dragos.bocai@rdsct.ro Regards,
Dragos.


 
Sorry...i have read this thread and get a little hurry!
:)
Thanks a lot David! Regards,
Dragos.


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top