I'm trying to program something like a random poetry device, that will start as rollover on a button of my homepage. Therefor I packed the mp3-snippets in different categories (verbs, nouns, adjectives, etc.) and I want to program something that goes like this:
get by random a verb and play
random length break (using myRandom Function, so I can customize in what interval this break should be)
get a random adjective and play
random length break
My plan so far is to make different Movieclips for each word group, where I put each sample on an own keyframe. Then I use myRandom to choose a frame.
This is where my problems start, because I don't get it how to program a break of random lenghth, as I still don't understand how to program breaks at all...
So if anyone of you could give me an example of how to program something like:
Well, I wouldn't do it by putting the sounds on frames, you could do everything while sitting on a single frame using streaming MP3s in a sound object, which will also allow you to do things when the sound stops.
So the code would select a random noun and play it, then when the random noun was done playing it would wait a random amount of time, then pick a random verb and start playing it, etc, etc, etc,. Now for the random amounts of time, why not just have a series of blank MP3's of varying lengths to play, so the delay would work no differently than the words would?
Look in the Flash Help files on the sound object and it should explain how to make a sound object and attach an MP3 file to it. Then look at the onSoundComplete event which will run a block of code once the sound has completed playing. I would suggest also looking into putting the URLs for your sounds into an XML file which could then be loaded into a series of arrays, so to play a random noun, you would just need to select a random number within the length of the array.
I'm filling a need. Without me there would be no bad examples.