Have two arrays - first one with 2 products and second one with 7
products. Randomise the 2nd array  (with Fisher-Yates shuffle ;) and
concat() the two arrays to produce the array with 9 products.
-- 
Kenneth Kawamoto
http://www.materiaprima.co.uk/

On 11 May 2010 01:44, Donald Talcott <[email protected]> wrote:
> Last year I created a small timeline based intro of products for a client
> that used Math.random to produce a random start of the animation sequence.
> This year they would like two specific product animations to always start in
> the #1 and #2 position and the remaining 7 products to play in a random
> order. I have given this some thought and am not sure how to go about it.
> Any ideas out there? If I contain the two specific products to the # 1 and #
> 2 positions, and procede randomly to the rest, how might I get all 7
> remaining products to play before replaying #1 and #2?
>
> Last years code below:
>
> stop();
> var minList:Array = ["mmPretzel", "3Musketeers_truffle", "MilkyWay_Caramel",
> "mmCO", "mmCherry", "Twix_java", "VOTE", "mmPB", "NASCAR"];
> var minStart:Number = Math.floor(Math.random()*9);
> trace(minStart);
> trace(minList[minStart]);
>
> function goOn(){
> gotoAndPlay(minList[minStart]);
> };
> setTimeout(goOn,+8);
>
>
>
>
>
> Don Talcott
> 316 Greenwood Ave
> Decatur, GA 30030
> 404 538-1642
> [email protected]
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to