Thread: Flash programs?
View Single Post
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