• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Random problem

Contributor ,
May 07, 2012 May 07, 2012

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 ?

TOPICS
ActionScript

Views

1.3K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
May 07, 2012 May 07, 2012

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)?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
May 07, 2012 May 07, 2012

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
May 07, 2012 May 07, 2012

Copy link to clipboard

Copied

how does the ball rotate? timeline tween or code?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
May 07, 2012 May 07, 2012

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
May 07, 2012 May 07, 2012

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);
}

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
May 07, 2012 May 07, 2012

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
May 07, 2012 May 07, 2012

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.*;

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
May 08, 2012 May 08, 2012

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.

http://www.er.uqam.ca/nobel/m340201/test/roulete.html

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
May 08, 2012 May 08, 2012

Copy link to clipboard

Copied

LATEST

i cant help unless you show your code and explain the setup. without that we can only guess

whats the code for your button?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines