|
|
#1 |
|
Tri-State Post Whore
Join Date: May 2006
Location: Glenside, PA
Member #1962
My Ride: 2001 Audi A6 2.7 Twin Turbo iTrader: (4)
|
Flash programs?
gotoAndPlay(239); function randNum (min:Number, max:Number ):Number { min = 1; max = 6; var randNumber:Number = Math.floor(Math.random() * (max - min + 1)) + min; return randNumber; } var n:int; n = randNum(1, 6); trace(n); if (n == 1) { gotoAndPlay(1); } else if (n == 2) { gotoAndPlay(40); } else if (n == 3) { gotoAndPlay(80); } else if (n == 4) { gotoAndPlay(120); } else if (n == 5) { gotoAndPlay(160); } else if (n == 6) { gotoAndPlay(200); } What im having trouble with is the if-else-if statements. I declare variable n to the random number generator(randNum), then set its value equal to another value in order for the "movie" to start at a certain point on the timeline. The biggest issue im encountering is that the only "if" statement that works is the first! I dont see why non of the other ones are declaring when a random number aside from 1 is calculated. any help would be MUCHHHH appreciated. thanks.
__________________
--Eric '96 Mazda Miata | FM V-Maxx Coilovers | Jackson Racing Exhaust/Intake GONE To view links or images in signatures your post count must be 10 or greater. You currently have 0 signatures. 01' Audi A6 2.7 Twin Turbo | Daily | NoMods |
|
|
|
|
|
#2 |
|
Tri-State Post Whore
Join Date: Jun 2005
Location: Under the bar...
Member #592
My Ride: 2009 Audi A3 Quattro, 2008 BMW X5, 2003 WW Evo8, 2000 Turbo SOHC Civic iTrader: (1)
|
try to output the randNum variable- i bet its constantly return 1. you probably need to edit your rand formula to make it return numbers higher than 1
__________________
BOOST doesn't get you laid. Roofies and some creativity does however Tuned by some white dude @ a shopwithbigtrucks.com "You get what you pay for" - thanks captain obvious, unless you bought rotas and received volks. |
|
|
|
|
|
#5 |
|
Tri-State Post Whore
Join Date: May 2006
Location: Glenside, PA
Member #1962
My Ride: 2001 Audi A6 2.7 Twin Turbo iTrader: (4)
|
No it returns random numbers, between 1 and 6 like its supposed to. Its after i assign the random number to n is where i have the problem. for some reason, the most simplistic part of thing ended up being the one with the problem i cant figure out.
__________________
--Eric '96 Mazda Miata | FM V-Maxx Coilovers | Jackson Racing Exhaust/Intake GONE To view links or images in signatures your post count must be 10 or greater. You currently have 0 signatures. 01' Audi A6 2.7 Twin Turbo | Daily | NoMods |
|
|
|
![]() |
| Bookmarks |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Who programs? CS3, Flash, etc help needed please | Jjaeger240 | Off-Topic | 2 | 04-12-2009 12:08 AM |
| X-mas Eve Volunteer Programs... | ITSTOCK | Off-Topic | 6 | 12-05-2008 01:39 PM |
| Computer Programs | Eclipse GSX 61 | Off-Topic | 8 | 12-03-2008 08:17 PM |
| instant messenger programs | jdm free | Off-Topic | 21 | 04-07-2008 09:45 PM |
| DVD making programs. | Spocknasty | Off-Topic | 6 | 11-21-2007 12:06 PM |