Hi all,
Hopefully there will be a simple solution to my problem.
I have an onEnterFrame event that happens when I am dragging a wheel. At a certain point during dragging, a boolean statement is set to true, and a mc with 120 (120*3=360) frames is targeted, so that when the user drags a wheel, if rotation is incremented +/-3, the mc._currentframe is +/- one frame.
the mc is 120 slices serving as a mask of a circular bar, which is hidden or exposed depending on the rotation of the wheel by the user.
[COLOR=Red]The problem I have is tracking when the rotation has incremented by +/- 3[/COLOR], since Im using onEnterFrame I cant find out how to store the rotation variable somewhere when it hits the +/-3 mark, and then continuly check for the next increment.
Here is the code :
ActionScript Code:
[FONT=Courier New][LEFT][COLOR=#000000]**function**[/COLOR] move[COLOR=#000000]([/COLOR][COLOR=#000000])[/COLOR] [COLOR=#000000]{[/COLOR]
[COLOR=#0000ff]if[/COLOR] [COLOR=#000000]([/COLOR][COLOR=#0000ff]this[/COLOR].[COLOR=#000080]drag[/COLOR][COLOR=#000000])[/COLOR] [COLOR=#000000]{[/COLOR]
[COLOR=#000000]**var**[/COLOR] dx = _xmouse-[COLOR=#0000ff]this[/COLOR].[COLOR=#0000ff]_x[/COLOR];
[COLOR=#000000]**var**[/COLOR] dy = _ymouse-[COLOR=#0000ff]this[/COLOR].[COLOR=#0000ff]_y[/COLOR];
[COLOR=#000000]**var**[/COLOR] newAngle = [COLOR=#0000ff]Math[/COLOR].[COLOR=#0000ff]atan2[/COLOR][COLOR=#000000]([/COLOR]dy, dx[COLOR=#000000])[/COLOR];
[COLOR=#0000ff]this[/COLOR].[COLOR=#000080]speed[/COLOR] = newAngle-[COLOR=#0000ff]this[/COLOR].[COLOR=#000080]angle[/COLOR];
[COLOR=#0000ff]this[/COLOR].[COLOR=#000080]angle[/COLOR] = newAngle;
[COLOR=#0000ff]this[/COLOR].[COLOR=#0000ff]_rotation[/COLOR] += [COLOR=#0000ff]this[/COLOR].[COLOR=#000080]speed[/COLOR]*[COLOR=#000080]180[/COLOR]/[COLOR=#0000ff]Math[/COLOR].[COLOR=#0000ff]PI[/COLOR];
[COLOR=#0000ff]if[/COLOR] [COLOR=#000000]([/COLOR]clockMove == [COLOR=#000000]**true**[/COLOR][COLOR=#000000])[/COLOR] [COLOR=#000000]{[/COLOR]
[COLOR=#0000ff]clearInterval[/COLOR][COLOR=#000000]([/COLOR]idclock[COLOR=#000000])[/COLOR];
[COLOR=#808080]*//seconds._rotation += this.speed*1440/Math.PI;*[/COLOR]
minutes.[COLOR=#0000ff]_rotation[/COLOR] += [COLOR=#0000ff]this[/COLOR].[COLOR=#000080]speed[/COLOR]*[COLOR=#000080]1080[/COLOR]/[COLOR=#0000ff]Math[/COLOR].[COLOR=#0000ff]PI[/COLOR];
hours.[COLOR=#0000ff]_rotation[/COLOR] += [COLOR=#0000ff]this[/COLOR].[COLOR=#000080]speed[/COLOR]*[COLOR=#000080]90[/COLOR]/[COLOR=#0000ff]Math[/COLOR].[COLOR=#0000ff]PI[/COLOR];
bar.[COLOR=#0000ff]_rotation[/COLOR] += [COLOR=#0000ff]this[/COLOR].[COLOR=#000080]speed[/COLOR]*[COLOR=#000080]90[/COLOR]/[COLOR=#0000ff]Math[/COLOR].[COLOR=#0000ff]PI[/COLOR];
[COLOR=#000000]}[/COLOR]
[COLOR=#0000ff]if[/COLOR] [COLOR=#000000]([/COLOR]alarmMove == [COLOR=#000000]**true**[/COLOR][COLOR=#000000])[/COLOR] [COLOR=#000000]{[/COLOR]
[COLOR=#808080]*//get this._rotation number STORE AND FORGET*[/COLOR]
[COLOR=#000000]}[/COLOR]
[COLOR=#000000]}[/COLOR]
[COLOR=#000000]}[/COLOR]
[COLOR=#000000]**function**[/COLOR] trackrotation[COLOR=#000000]([/COLOR][COLOR=#000000])[/COLOR] [COLOR=#000000]{[/COLOR]
[COLOR=#808080]*// at any time, if this._rotation has increased by 3, ++barslice._currentframe*[/COLOR]
[COLOR=#808080]*// at any time, if this._rotation has decreased by 3, --barslice._currentframe
//update with new this._rotation number
*[/COLOR][COLOR=#000000]}
[/COLOR] [/LEFT]
[/FONT]