TriStateTuners.com :: Home of Tristate Auto Enthusiast  

Go Back TriStateTuners.com :: Home of Tristate Auto Enthusiast > Community > Off-Topic
Register Rules & Info

Notices

Reply
 
Thread Tools Display Modes
Old 03-20-2008, 12:25 PM   #1
Erik
Tri-State Post Whore
 
Erik's Avatar
 
Join Date: May 2006
Location: Glenside, PA
Member #1962

My Ride:
2001 Audi A6 2.7 Twin Turbo

iTrader: (4)
Flash programs?

hey guys. In college, im taking multimedia and one of the classes im taking called multimedia concepts. Its actually Adobe Flash programming. If you are relatively familiar with the newest form of Flash code, actionscript 3.0, pleaseeee help me out. This isnt to cheat in anyway, the teacher just says it is a little too advanced for me, although after taking VB, C++, HTML&XHTML, code does not worry me.

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
Erik is offline   Reply With Quote
Old 03-20-2008, 01:40 PM   #2
igo4bmx
Tri-State Post Whore
 
igo4bmx's Avatar
 
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)
Send a message via AIM to igo4bmx
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.
igo4bmx is offline   Reply With Quote
Old 03-20-2008, 02:01 PM   #3
Scapegoat
TST Ruined My Life!
 
Scapegoat's Avatar
 
Join Date: Dec 2005
Location: stop looking at my gold
Member #1208

 
iTrader: (1)
use a switch noob
Scapegoat is offline   Reply With Quote
Old 03-20-2008, 02:08 PM   #4
Scapegoat
TST Ruined My Life!
 
Scapegoat's Avatar
 
Join Date: Dec 2005
Location: stop looking at my gold
Member #1208

 
iTrader: (1)
my coworker > me gotoAndPlay(Math.max(1, (n - 1) * 40))
Scapegoat is offline   Reply With Quote
Old 03-20-2008, 03:30 PM   #5
Erik
Tri-State Post Whore
 
Erik's Avatar
 
Join Date: May 2006
Location: Glenside, PA
Member #1962

My Ride:
2001 Audi A6 2.7 Twin Turbo

iTrader: (4)
Quote:
Originally Posted by igo4bmx View Post
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
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
Erik is offline   Reply With Quote
Reply

Bookmarks


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


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


All times are GMT -4. The time now is 03:13 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.