unwrittendevin
03-05-2003, 05:49 PM
I have a question about creating a random image generator. I have 9 pictures I want to randomly appear on the stage, but I am having the hardest time with generating the code for it. I tried creating movie clips, using the Linkage option and exporting for Actionscript, but is this the right way to approach this problem? I've looked in a few books, and they tell me nothing except for how to generate random numbers, which works when I debug, but that's about it. Here's the code I've tried lately, just give me some feedback... Thanks
onClipEvent (enterFrame) {
ymca = new MovieClip();
ymca = 9;
directory = ymca;
loadMovieClip(directory add Math.ceil(Math.random(1)*ymca) . _level0);
randomPic = random(9)+1;
randomLoop = random(2)+1;
ymca.attachMovie("ymca"+randomPic);
ymca.start(0, randomLoop);
}
as you can tell, I haven't been actionscripting for long, it's mostly cut and pastes from books and tutes. Any help would be grateful!!!
Devin
onClipEvent (enterFrame) {
ymca = new MovieClip();
ymca = 9;
directory = ymca;
loadMovieClip(directory add Math.ceil(Math.random(1)*ymca) . _level0);
randomPic = random(9)+1;
randomLoop = random(2)+1;
ymca.attachMovie("ymca"+randomPic);
ymca.start(0, randomLoop);
}
as you can tell, I haven't been actionscripting for long, it's mostly cut and pastes from books and tutes. Any help would be grateful!!!
Devin