Seems to me you guys are doing this the hard way. Why not just draw a curved line (with the line tool) then use code to attach/snap the handle to the line, and then just use actionscript to track the Y position of the handle and scroll accordingly? Trig for a simple scroller seems a little convoluted way of going about this simple thing...The end user will never know or appreciate the difference anyway.
On 5/24/07, Ash Warren <[EMAIL PROTECTED]> wrote:
Thank you both! This is great. I will try and apply the scroller to this code today. Ash -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Matthias Dittgen Sent: Thursday, May 24, 2007 1:35 AM To: flashcoders@chattyfig.figleaf.com Subject: Re: [Flashcoders] Need help creating an old-skool arc or circularscrollbar Mark is true. Respect! :-) I used Math.atan(), too and if/else to know, in which quadrant of the circle the drag element is moved. I uploaded my quick&dirty source now. Please be kind! :-) http://lizu.net/circle.swf http://lizu.net/circleSrc.zip it consists of the circle drag mechanism, but I think, the scrolling can be easily applied then with a 'rule of three' and the angle. hth, Matthias 2007/5/23, Mark Winterhalder <[EMAIL PROTECTED]>: > On 5/23/07, Jesse Graupmann <[EMAIL PROTECTED]> wrote: > > > > Trigonometry > > No need, apart from Math.atan2() to get the result -- assuming the > anchor point of the container is in the middle, just normalize the > vector from the centre to the mouse and then scale it to the desired > radius, that's the position of the handle. > > About like this: > > var xmouse = ... > var ymouse = ... > var radius = ... > > var magnitude = Math.sqrt( xmouse * xmouse + ymouse * ymouse ); > > var x = xmouse / magnitude * radius; > var y = ymouss / magnitude * radius; > var angle = Math.atan( ymouse, xmouse ); // devide by Math.PI * 180 if you wish > // now set the position of the handle to x, y and broadcast an event > with the angle. > > If you want to set it to a certain angle (in radians), it should be > something like... > > var x = Math.cos( angle ) * radius; > var y = Math.sin( angle ) * -radius; > > ...which might turn into the wrong direction or be set off by > Math.PI/2, in that case, flip the sign of y and/or add/subtract > Math.PI/2 to the angle. > > HTH, > Mark > _______________________________________________ > Flashcoders@chattyfig.figleaf.com > To change your subscription options or search the archive: > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders > > Brought to you by Fig Leaf Software > Premier Authorized Adobe Consulting and Training > http://www.figleaf.com > http://training.figleaf.com > _______________________________________________ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com _______________________________________________ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
-- Carl Welch http://www.carlwelch.com [EMAIL PROTECTED] 805.403.4819 _______________________________________________ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com