[thelist] Randomly Play Flash Scenes
Jono Young
jono at charlestonwebsolutions.com
Wed Jun 22 12:14:16 CDT 2005
Using Flash MX 2004 Professional, I need to create a 2 (or more)
scene Flash movie that will play each scene randomly each time the
Flash (swf) file is loaded in a browser.
For example if you visit the website you see scene 1 of the flash
movie play, but if you reload or revisit the same website, you see a
different scene. I am very good with the animation in Flash, I just
haven't devoted enough time to learning the scripting available in MX
2004.
What is the best way to accomplish this in Flash MX2004 Professional?
I found this in the Flash help files, but action scripting is not my
forté:
------------------------------------------------------------------------
----------------------------------
Math.random()
Availability
Flash Player 5. In Flash Player 4, the methods and properties of the
Math class are emulated using approximations and might not be as
accurate as the non-emulated math functions that Flash Player 5
supports.
Usage
Math.random() : Number
...
Example
The following example returns a random number between two specified
integers.
function randRange(min:Number, max:Number):Number {
var randomNum:Number = Math.round(Math.random()*(max-min))+min;
return randomNum;
}
for (var i = 0; i<25; i++) {
trace(randRange(4, 11));
}
------------------------------------------------------------------------
----------------------------------
More information about the thelist
mailing list