edit: I reccommend downloading the .SWF file, it doesn’t work well in full screen mode.
Hi there folks.
I’m working on a spinning menu, and it’s almost working. Right now it sort of works… I’m going to just attach the code and the file, and not too much explanation, because I want you flash gurus to come to your own conclusions. The bolded part of the code is what needs to be changed, I think… two things that need changing.
-
You’ll notice that the closer to the center of the circle, the more closely the movement of the objects follow that of your mouse. I need it to be the opposite, but I can’t figure out how to make that work.
-
Obviously, I can’t have the thing freaking out when the user puts their mouse in the top half of the movie…
ActionScript Code:
[FONT=Courier New][LEFT][COLOR=#0000FF]this[/COLOR].[COLOR=#0000FF]onEnterFrame[/COLOR] = [COLOR=#000000]function[/COLOR]COLOR=#000000[/COLOR] [COLOR=#000000]{[/COLOR]
[COLOR=#808080]//variable declarations[/COLOR]
xDistance = [COLOR=#0000FF]this[/COLOR]._xmouse-circle_mc.[COLOR=#0000FF]_x[/COLOR];
yDistance = [COLOR=#0000FF]this[/COLOR]._ymouse-circle_mc.[COLOR=#0000FF]_y[/COLOR];
normalize = [COLOR=#0000FF]Math[/COLOR].[COLOR=#0000FF]abs[/COLOR]COLOR=#000000[/COLOR]+[COLOR=#0000FF]Math[/COLOR].[COLOR=#0000FF]abs[/COLOR]COLOR=#000000[/COLOR];
[COLOR=#808080]//normal[/COLOR]
[COLOR=#0000FF]if[/COLOR] [COLOR=#000000]([/COLOR]COLOR=#000000[/COLOR] & COLOR=#000000[/COLOR][COLOR=#000000])[/COLOR] [COLOR=#000000]{[/COLOR]
mouseDirection = [COLOR=#000080]90[/COLOR]COLOR=#000000[/COLOR];
[COLOR=#000000]}[/COLOR] [COLOR=#0000FF]else[/COLOR] [COLOR=#0000FF]if[/COLOR] [COLOR=#000000]([/COLOR]COLOR=#000000[/COLOR] && COLOR=#000000[/COLOR][COLOR=#000000])[/COLOR] [COLOR=#000000]{[/COLOR]
mouseDirection = -[COLOR=#000080]90[/COLOR]COLOR=#000000[/COLOR]+[COLOR=#000080]90[/COLOR];
[COLOR=#000000]}[/COLOR] [COLOR=#0000FF]else[/COLOR] [COLOR=#0000FF]if[/COLOR] [COLOR=#000000]([/COLOR]COLOR=#000000[/COLOR] && COLOR=#000000[/COLOR][COLOR=#000000])[/COLOR] [COLOR=#000000]{[/COLOR]
mouseDirection = -[COLOR=#000080]90[/COLOR]COLOR=#000000[/COLOR]+[COLOR=#000080]180[/COLOR];
[COLOR=#000000]}[/COLOR] [COLOR=#0000FF]else[/COLOR] [COLOR=#000000]{[/COLOR]
mouseDirection = [COLOR=#000080]90[/COLOR]COLOR=#000000[/COLOR]+[COLOR=#000080]270[/COLOR];
[COLOR=#000000]}[/COLOR]
[COLOR=#808080]//text tracking[/COLOR]
xtext.[COLOR=#0000FF]text[/COLOR] = [COLOR=#FF0000]'x: '[/COLOR]+[COLOR=#0000FF]Math[/COLOR].[COLOR=#0000FF]round[/COLOR]COLOR=#000000[/COLOR];
ytext.[COLOR=#0000FF]text[/COLOR] = [COLOR=#FF0000]'y: '[/COLOR]+[COLOR=#0000FF]Math[/COLOR].[COLOR=#0000FF]round[/COLOR]COLOR=#000000[/COLOR];
ntext.[COLOR=#0000FF]text[/COLOR] = [COLOR=#FF0000]'normalize: '[/COLOR]+normalize;
ttext.[COLOR=#0000FF]text[/COLOR] = [COLOR=#FF0000]'mouseDirection = '[/COLOR]+mouseDirection;
rtext.[COLOR=#0000FF]text[/COLOR] = [COLOR=#FF0000]'rotation: '[/COLOR]+[COLOR=#0000FF]this[/COLOR].[COLOR=#000080]circle_mc[/COLOR].[COLOR=#0000FF]_rotation[/COLOR];
itext.[COLOR=#0000FF]text[/COLOR] = [COLOR=#FF0000]'i: '[/COLOR]+[COLOR=#0000FF]Math[/COLOR].[COLOR=#0000FF]round[/COLOR]COLOR=#000000[/COLOR];
atext.[COLOR=#0000FF]text[/COLOR] = [COLOR=#FF0000]'tester: '[/COLOR]+ tester;
[COLOR=#808080]//rotation[/COLOR]
speed = normalize/[COLOR=#000080]30[/COLOR];
i = COLOR=#000000[/COLOR]/speed;
[COLOR=#0000FF]if[/COLOR] [COLOR=#000000]([/COLOR]mouseDirection != [COLOR=#0000FF]this[/COLOR].[COLOR=#000080]circle_mc[/COLOR].[COLOR=#0000FF]_rotation[/COLOR][COLOR=#000000])[/COLOR] [COLOR=#000000]{[/COLOR]
[COLOR=#0000FF]this[/COLOR].[COLOR=#000080]circle_mc[/COLOR].[COLOR=#0000FF]_rotation[/COLOR] += i;
[COLOR=#000000]}[/COLOR]
[COLOR=#0000FF]this[/COLOR].[COLOR=#000080]circle_mc[/COLOR].[COLOR=#000080]menu1[/COLOR].[COLOR=#0000FF]_rotation[/COLOR] = mouseDirection*-[COLOR=#000080]1[/COLOR];
[COLOR=#0000FF]this[/COLOR].[COLOR=#000080]circle_mc[/COLOR].[COLOR=#000080]menu2[/COLOR].[COLOR=#0000FF]_rotation[/COLOR] = mouseDirection*-[COLOR=#000080]1[/COLOR];
[COLOR=#0000FF]this[/COLOR].[COLOR=#000080]circle_mc[/COLOR].[COLOR=#000080]menu3[/COLOR].[COLOR=#0000FF]_rotation[/COLOR] = mouseDirection*-[COLOR=#000080]1[/COLOR];
[COLOR=#0000FF]this[/COLOR].[COLOR=#000080]circle_mc[/COLOR].[COLOR=#000080]menu4[/COLOR].[COLOR=#0000FF]_rotation[/COLOR] = mouseDirection*-[COLOR=#000080]1[/COLOR];
[COLOR=#808080]//};[/COLOR]
[COLOR=#000000]}[/COLOR];
[/LEFT]
[/FONT]
I really need some help. Thanks in advance.