Copy link to clipboard
Copied
Hi
My ball turns just once and stops where it began after one circle.Meaning 360 degrees; what if I want it to stop at 275, or 160. Help, suggestions, will be appreciated. Thank you. I can make it turn as many times I want to, but the ball always end up at the origin of mouvement. Timer ??? And Randomize it ?
Copy link to clipboard
Copied
not enuff info.
how are you making it turn just once? and by turn, do you mean rotate (like the hands of a clock)?
Copy link to clipboard
Copied
Yes. I click on a button, and the ball turns a full 360 degrees in a circle. I want it to stop anywhere in the circle randomly. Sorry for the choice of words, I mean rotate along a circonférence.
Copy link to clipboard
Copied
how does the ball rotate? timeline tween or code?
Copy link to clipboard
Copied
code. I am thinking of using frames to solve my problem, although it want be as elegant as something happening randomly. I am going to choose 7 situations ( frames ) each with a different currantAngle
currentAngle<-.5;
currentAngle<-.7;
currentAngle<-.9;
currentAngle<-1.5;
-------
--------
and so on. Each click will take me to different frame.The user won't notice a thing hopefully.
Copy link to clipboard
Copied
var newRotation:Number;
var myTween:Tween
myButton.addEventListener(MouseEvent.CLICK, onClick);
function onClick(e:MouseEvent){
newRotation = Math.random() * 360;
myTween = new Tween(myBall, "rotation", Strong.easeOut, myBall.rotation, newRotation, .5, true);
}
Copy link to clipboard
Copied
Giving me error messages. What did I do wrong? I copied, pasted the script and drew a ball and a button.
Scene 1, Layer 'as3', Frame 1, Line 7 1046: Type was not found or was not a compile-time constant: Tween.
Scene 1, Layer 'as3', Frame 1, Line 9 1180: Call to a possibly undefined method Tween.
Scene 1, Layer 'as3', Frame 1, Line 9 1120: Access of undefined property Strong.
Copy link to clipboard
Copied
i thought you would know to have this up at the top of your code if you didnt already:
import fl.transitions.Tween;
import fl.transitions.easing.*;
Copy link to clipboard
Copied
Hi
Thank you for your help, but that was not what I was looking for. I am trying to make a roulette, but the ball stops always at the same place, as you can see below. I will do some fine tuning for the sound later.
Copy link to clipboard
Copied
i cant help unless you show your code and explain the setup. without that we can only guess
whats the code for your button?