I have a cocktail application - whatever alphabet key is hit (k, for example), one of 3 cocktail recipie swf’s (k1.swf, k2.swf, k3.swf) is loaded into the content MC.
It may always load the same one initially, or randomly one of the three - either way, it cycles through those 3 if you hit that key repeatedly.
Same goes for any other keys.
I’ve got the listeners etc in place, and the code set out, I just don’t know what exactly to chuck in, so that it for example calls from an array a1.swf, a2.swf, a3.swf from the same directory, when hit.
Would be lovely to be kicked in the right direction.
if (Key.getAscii() == 65, 97) {
loaded_mc.loadMovie(‘a1.swf’)
}
…to instead load a2.swf if a1.swf is already loaded, then a3.swf if a2.swf is already loaded when a is pressed again (ie, cycling through those 3 only if repeatedly pressed)?
first of all the var root.theAKey is set to 0.
Then if a key is hit, he checks if root.theAKey is 3, if so he makes it 0 again.
Next this he does, is adding 1 to root.theAKey using the ++
And then finally it loads the swf like this:
If root.theAKey = 1, then it will load a1.swf… and so on…
Till root.theAKey will become 3, then its reset to 0 so it you will load a1.swf again.
It was the [COLOR=Red]“Key.getAscii() == 97 || Key.getAscii() == 65”[/COLOR]
** edit:**
Oh and you maybe want to replace the [COLOR=Red]“trace”[/COLOR] with [COLOR=Red]“loaded_mc.loadMovie”[/COLOR]
[COLOR=DarkSlateGray][COLOR=Red]
[/COLOR][/COLOR]
One last thing, if anyone is willing. I have an intro and outro for all of the loaded clips - the intro is easy, but i’d like the outro of the currently loaded clip to be played before the next one is when the key is pressed (and also stop any keys from being activated during this transition).
Just so aesthetically, it wll works smoothly.
I imagine something will be needed in the LoadMC function?