Wheel of fortune with powerbar

Hi all,

I am currently developing a Wheel of fortune game and I am facing the problems in rotating the wheel depending on the power varible. Here power is a varible that depends upon the time for which the user keeps the mouse on the wheel. I am unable to rotate the wheel smoothly. Can anyone help me in this? Any help would be greatly appreciated. Thank you.

glosrfc - did what you said, and posted the codes

function spinWheel(myTarget) {
wheel_rotation = 0;
myRandom = 0;

//Optional allow press of wheel to spin.
_root.onEnterFrame = function() {
myTarget._rotation -= wheel_rotation;
};
function slowDown() {
myTarget.onEnterFrame = function() {
wheel_rotation -= _root.myRandom;
//trace(_root.myRandom);
if (wheel_rotation<=0) {
wheel_rotation = 0;

}
};
};
speedup = function () {
myTimer = getTimer();
myTarget.onEnterFrame = function() {
wheel_rotation++;

if (wheel_rotation>=10) {
wheel_rotation = 10;
pauseTimer = getTimer();
timeTrace = pauseTimer-myTimer;
//trace(timeTrace);
if (timeTrace>4000) {
slowDown();
}
}
};
};
}

spinWheel(_root.wheel);

// button script
arrow_btn.onRelease = function() {
myRandom = Math.random()*.30;
if (myRandom<=.10) {
myRandom = .10;
}
(myRandom);
speedup();
};

If you replaced . with an example of the code you’re using, you’re far more likely to get a response.

In the meantime, see if this helps:
http://blog.circlecube.com/2008/03/14/interactive-spin-actionscript-tutorial/

In the meantime, see if this helps:
http://blog.circlecube.com/2008/03/1...ript-tutorial/

-> regarding this link, its not totally what i wanted to find, cos its more having like 2 btns, 1 btn for moving clockwise, and the other anti- clockwise. ive tried using both the clockwise but it seems that the codes for clockwise and anti clockwise will clash. And i got another problem is that i need to have an xml which will be used to call pictures and text files onto different sections of the wheel(its like having 12 empty mc and each mc call information from the same xml file) and be able to spin together. any ideas how to do it, cos it seems that i have difficulties inserting the codes for the xml, theres always errors coming up. its like the xml codes and the codes for the wheel to be clashing with each other.

if any doubts can ask again, ill be grateful to reply asap. thanks in advance for any replys to this psot

var maxSpeed:Number = 100;
// fastest possible speed
var maxTime:Number = 10000;
// 10 seconds
function spinWheel(myTarget:MovieClip, clickTime:Number):Void {
	myTarget.speed = clickTime/maxTime*maxSpeed;
	myTarget.onEnterFrame = function():Void  {
		slowDown(this, .9);
		this._rotation += this.speed;
	};
}
function slowDown(myTarget:MovieClip, force:Number):Void {
	myTarget.speed *= force;
}
wheel.onPress = function():Void  {
	startTime = getTimer();
};
wheel.onRelease = wheel.onReleaseOutside=function ():Void {
	spinWheel(this, getTimer()-startTime);
};

?

nice. thanks for the reply. im going to test it out now

oh thats bad, the codes have errors in it. :frowning:

what are the errors?

Error Scene=Scene 1, layer=wheel, frame=1:Line 1: ‘{’ expected
function spinWheel(myTarget:MovieClip, clickTime:Number):Void {
Error Scene=Scene 1, layer=wheel, frame=1:Line 3: ‘{’ expected
myTarget.onEnterFrame = function():Void {
Error Scene=Scene 1, layer=wheel, frame=1:Line 5: Unexpected ‘}’ encountered
this._rotation += this.speed; };
Total ActionScript Errors: 3 Reported Errors: 3

its like simple errors, but it seems i cant solve it, ive checked all the { and } already but theres stil errors. Btw, is it to overwrite all the codes over the codes i have pasted?

what version are you using? :x it should work

im using AS2 ;X is it suppose to work for AS3?

Btw, the codes u haven given me, i have a button that is clickable. When the button is clicked, the wheel will spin.

anyone able to help?