Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

HELP me !!! Radom Scene Selection script

Status
Not open for further replies.

blackstar

Technical User
May 25, 2001
2
BE
Hi my name is david ( Belgium Europe)and I'm trying out my verry first actionscript in flash5 , but it doesn't seem to work. i wan't to write an action script that radomly chooses a new scene. Please help out this
first timer !!! THANX .

This is what I have up till now:
ifFrameLoaded (14) {
set (number, "random (15)");
if (number=1) {
gotoAndPlay ("Scene 3", 1);
} else if (number2) {
gotoAndPlay ("Scene 4", 1);
} else if (number=3) {
gotoAndPlay ("Scene 5", 1);
} else if (number4) {
gotoAndPlay ("Scene 6", 1);
} else if (number=5) {
gotoAndPlay ("Scene 7", 1);
} else if (nuber=6) {
gotoAndPlay ("Scene 8", 1);
} else if (number=7) {
gotoAndPlay ("Scene 9", 1);
} else if (number=8) {
gotoAndPlay ("Scene 10", 1);
} else if (number=9) {
gotoAndPlay ("Scene 11", 1);
} else if (number=10) {
gotoAndPlay ("Scene 12", 1);
} else if (number=11) {
gotoAndPlay ("Scene 13", 1);
} else if (number=12) {
gotoAndPlay ("Scene 14", 1);
} else if (number=13) {
gotoAndPlay ("Scene 15", 1);
} else if (number=14) {
gotoAndPlay ("Scene 16", 1);
} else if (number=15) {
gotoAndPlay ("Scene 17", 1);
}
}
 
I know absolutely nothing about actionscripts, but there was a post in here a couple days ago that might help ya....sorry if I'm way off on this.

thread250-86017
 
without checking this script you should try changing the following line before doing anything else:

Code:
set (number, "random (15)");

changes to:

Code:
number = random(14)+1;

First of all, you don't have the random statement set to an expression. Second, the random function is zero-base, so random(15) will pick a number between 0 and 15. Hence, if you write random(14)+1, Flash will output a number between 1 and 15.

dave
dave@pinkzeppelin.com

^^^^^^^^^^^^^^^^^^^^^​
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top