Degrees Flash Rotate
![]() Flash Bracket with 90 degrees Camera Rotate feature US $44.95
|
![]() Flash Bracket with 90 Degrees Flash Rotate feature US $39.95
|
| Powered by phpBay Pro |

How do I make a flash object in a fixed position rotate to follow the mouse direction?
What I'm aiming for is an object that remains in a fixed position but rotates to face the mouse pointer's current location. I would also like to limit the rotation degree if possible.
I'm completely new at Flash; tutorials or code examples would be greatly appreciated. Thanks!
Use geometry.
I'm just going to assume you're using Actionscript 2. Actionscript 3 should probably come with a similar approach but with slightly different syntax.
You have both the coordinates of your object and the mouse:
The object's coordinates can be called using objectinstancename._x and objectinstancename._y.
The mouse coordinates can be called using this._xmouse and this._ymouse Using a simple tangent rule (find some info on Math.tan in the first source) you could calculate the angle between the object and your mouse.
The next thing you'd have to do is use objectinstancename._rotation = angle to turn the object towards the proper angle. That's all!
Obviously you would have to redo these calculations every time the mouse moves, so wrap it up inside an onMouseMove event. (info in source 2)
Items Recently Purchased From This Site:
| Powered by phpBay Pro |
Best Posts
- Series Service Repair
- Battery Sony Ccd
- Replacement Lcd Screen
- Vision Waterproof Wireless
- Cover Parts Repair
- Zeiss Jena Tessar
- Telephoto Tele Lens
- Dual Charger Canon
- Top Cover Plate
- Jvc Minidv Digital
- Dock Insert Adapter
- Nikon Lens Cap
- Red Yellow Green
- Camera Parts Oem
- Camera Hood Petal
Categories
- Camcorder Accessories (973)
- Camera Parts (309)
- Film Cameras (375)
- Flashes (540)
- Lenses And Filters (2031)
- Updates (1)
Tags
Recently Added
- Flexible Camera Tripod
- Digital Flip Mino
- Parts Body Front
- Ttl Bounce Flash
- Canon Minidv Camcorder
- Zoom Lcd Screen
- Leica Screw Mount
- Extended Battery Canon
- Cable Sony Digital
- Movie Camera Lens
Calender
| M | T | W | T | F | S | S |
|---|---|---|---|---|---|---|
| « Apr | ||||||
| 1 | 2 | 3 | 4 | 5 | 6 | |
| 7 | 8 | 9 | 10 | 11 | 12 | 13 |
| 14 | 15 | 16 | 17 | 18 | 19 | 20 |
| 21 | 22 | 23 | 24 | 25 | 26 | 27 |
| 28 | 29 | 30 | 31 | |||
Archives
- April 2011 (5)
- March 2011 (154)
- February 2011 (170)
- January 2011 (164)
- December 2010 (181)
- November 2010 (168)
- October 2010 (213)
- September 2010 (167)
- August 2010 (155)
- July 2010 (171)
- June 2010 (167)
- May 2010 (173)
- April 2010 (174)
- March 2010 (168)
- February 2010 (82)
- January 2010 (75)
- December 2009 (81)
- November 2009 (84)
- October 2009 (88)
- September 2009 (86)
- August 2009 (80)
- July 2009 (83)
- June 2009 (80)
- May 2009 (77)
- April 2009 (90)
- March 2009 (90)
- February 2009 (37)
- January 2009 (30)
- December 2008 (47)
- November 2008 (53)
- October 2008 (44)
- September 2008 (36)
- August 2008 (33)
- July 2008 (47)
- June 2008 (51)
- May 2008 (30)
- April 2008 (30)
- March 2008 (30)
- February 2008 (43)
- January 2008 (45)
- December 2007 (42)
- November 2007 (30)
- October 2007 (39)
- September 2007 (32)
- August 2007 (42)
- July 2007 (44)
- June 2007 (41)
- May 2007 (44)
- April 2007 (34)
- March 2007 (47)
- February 2007 (40)
- January 2007 (12)




