To register for an Internet.com membership to receive newsletters and white papers, use the Register button ABOVE.
To participate in the message forums BELOW, click here


A Flash Developer Resource Site

Go Back   Flash Kit Community Forums > Flash Help > Flash ActionScript

Reply
 
Thread Tools Search this Thread Display Modes
Old 10-19-2004, 02:35 AM   #1
alpha_centauri
Junior Member
 
Join Date: Apr 2003
Location: vancouver, b.c. (canada)
Posts: 6
custom rotation...

hi everyone... i'm have'n a bit of trouble with a custom graphic...

imagine the recycle'n symbol ( three arrows in a circle ) ... well i'd like to rotate the graphic so that the ' arrow ' that was clicked is on top... and repeat for the other arrows indefinately ... i'm try'n to keep it simple but any ideas are welcome... thanks .. and take care...
__________________
- live long and prosper -
alpha_centauri is offline   Reply With Quote
Old 10-19-2004, 03:16 AM   #2
jbum
Senior Member
 
jbum's Avatar
 
Join Date: Feb 2004
Location: Los Angeles
Posts: 2,920
Call your arrows arrowA, arrowB and arrowC. Implement them as copies of the same arrow graphic movieclip and put them (rotated and positioned) in a container movie called recycle_mc.

Arrow A should be in the 'home position' on the top. Arrow B should be the next arrow, clockwise.

Make sure the arrows are named within the container movie symbol, and that the container movie is named on the stage. This is so that in the following script, references like recycle_mc.arrowA will work.

This script should be attached to the frame where the recycle_mc first appears.

code:

// These 3 functions set the desired
// angle for each arrow (dividing 360
// into 3 slices) when you click on the arrow
recycle_mc.arrowA.onPress = function()
{
recycle_mc.desiredAngle = 0;
}

recycle_mc.arrowB.onPress = function()
{
recycle_mc.desiredAngle = 240;
}

recycle_mc.arrowC.onPress = function()
{
recycle_mc.desiredAngle = 120;
}

// this function keeps the wheel spinning
// until the desired arrow is on top

recycle_mc.onEnterFrame = function()
{
// set desiredAngle to next 'slot' which
// is higher than current _rotation, so that
// we always rotate clockwise
while (this.desiredAngle < this._rotation)
{
this.desiredAngle += 360;
}
// Insure we don't over-rotate
while (this.desiredAngle > this._rotation+360)
{
this.desiredAngle -= 360;
}
var da = this.desiredAngle - this._rotation;
this._rotation += da * .1;
// use higher numbers (.2 .3 etc.)
// for faster speeds
}

// this initializes the wheel
recycle_mc.desiredAngle = 0;




EDIT: Reversed the 120 and 240 after testing - see below.
__________________

Last edited by jbum; 10-19-2004 at 03:26 AM.
jbum is offline   Reply With Quote
Old 10-19-2004, 03:25 AM   #3
jbum
Senior Member
 
jbum's Avatar
 
Join Date: Feb 2004
Location: Los Angeles
Posts: 2,920
Attached is the above script, with an accompanying movie to test it.
Attached Files
File Type: fla recyle.fla (17.0 KB, 583 views)
__________________
jbum is offline   Reply With Quote
Old 10-19-2004, 09:20 PM   #4
alpha_centauri
Junior Member
 
Join Date: Apr 2003
Location: vancouver, b.c. (canada)
Posts: 6
.. thank you my marvelous friend ( i hope i can call you a friend ) ... this works like a charm ( the code ) .. thanks again.. and i owe you one.. take care.. live long and prosper...
__________________
- live long and prosper -
alpha_centauri is offline   Reply With Quote
Old 10-19-2004, 09:23 PM   #5
jbum
Senior Member
 
jbum's Avatar
 
Join Date: Feb 2004
Location: Los Angeles
Posts: 2,920
Coolness - now just don't forget to recycle!
__________________
jbum is offline   Reply With Quote
Reply

Go Back   Flash Kit Community Forums > Flash Help > Flash ActionScript

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 05:32 PM.


internet.commerce
Be a Commerce Partner
 »  »  »  »  »  »  »
 »  »  »  »  »  »
 

    

Acceptable Use Policy


The Network for Technology Professionals

Search:

About Internet.com

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | E-mail Offers


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.