SwishTalk.com
 

Go Back   SwishTalk.com > .:: THE HELP DESK ::. > Actionscript Help

Reply
 
Thread Tools Display Modes
#1   Solve random  

Name: 
pelucas
Status: Offline
Rank: SWiSHer
Posts: 12
Old 01-30-2012, 12:16 AM Reply With Quote


Possible values ​​of X
X = 0
X = 90
X = 180
X = 270

How to solve for X to choose randomly one of the possible values?


onSelfEvent (load) {
x =?;
_root.movieclip._rotation + = x;
}





Last edited by pelucas; 01-30-2012 at 12:51 AM..
 
View Public Profile Send a private message to pelucas Find all posts by pelucas Add pelucas to Your Contacts
#2    
 
cycle1500's Avatar

Name: 
cycle1500
Status: Offline
Rank: Oberlin, Ohio, USA
Posts: 1,493
Mood: MEAN: Do's not play well
Old 01-30-2012, 07:33 AM Reply With Quote


Please in the future don't post so many version of basically the same problems.
This has been answered in a couple of your posts.
Hope this helps you to work through what you are doing.
Come on back with all your problems and we will see what we can do.

Good Luck.

Wayne


__________________
The Hairy One
Wayne helps those that helps themselves.

Last edited by cycle1500; 01-30-2012 at 07:40 AM..
 
View Public Profile Send a private message to cycle1500 Find all posts by cycle1500 Add cycle1500 to Your Contacts
#3    

Name: 
NewYuecas
Status: Offline
Rank: Registered User
Posts: 1
Old 01-30-2012, 09:02 AM Reply With Quote


Sorry forum, pelucas is my fahter, he is 60 years old, he is starting programming now and his knowledge is very low, moreover he cant speak english

I never code in this langueage but code a lot in python, java... I think that you want is:

ran = new array;
ran = [0 , 90 , 180, 270];
number = ran[Math.random(ran.length)];

Sorry to all forum for the behavior of my dad, but dont be rude with him, he is just.... excited




 
View Public Profile Find all posts by NewYuecas Add NewYuecas to Your Contacts
#4   reply  
 
cycle1500's Avatar

Name: 
cycle1500
Status: Offline
Rank: Oberlin, Ohio, USA
Posts: 1,493
Mood: MEAN: Do's not play well
Old 01-30-2012, 09:51 AM Reply With Quote


You and your father are both welcome. I myself am 63. We will work to help anyone as needed. I have given the script in another post but here we have the basic working:
Code:
onSelfEvent (load) {
   cy = new Array;
    cy = ["0","180","270","90"];
    tt = cy[Math.random(cy.length)];     
    trace(tt);
}
onFrame (1) {
    _root.arrow._rotation = tt;
}
Here is also another way:
Code:
onSelfEvent (load) {
    var myArray:Array = Array();
    myArray[1] = 0;
    myArray[2] = 90;
    myArray[3] = 180;
    myArray[4] = 270;

    x = myArray[Math.round(Math.randomRange(1, 4))];
    trace(x);
    _root.movieclip._rotation += x;
}
Put this script in the movie clip of the arrow.

Mine goes on the time line.

Hope this helps.
Good Luck:
Wayne


__________________
The Hairy One
Wayne helps those that helps themselves.
 
View Public Profile Send a private message to cycle1500 Find all posts by cycle1500 Add cycle1500 to Your Contacts
Advertisement:





Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump