Re: [Flashcoders] Random Sort of Array

2010-05-11 Thread kennethkawam...@gmail.com
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 dtalc...@mindspring.com 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
 dtalc...@mindspring.com
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Random Sort of Array

2010-05-11 Thread Donald Talcott
Kenneth,
thanks for the response, this should work well.

On May 11, 2010, at 4:53 AM, kennethkawam...@gmail.com wrote:

 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 dtalc...@mindspring.com 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
 dtalc...@mindspring.com
 ___
 Flashcoders mailing list
 Flashcoders@chattyfig.figleaf.com
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Don Talcott
316 Greenwood Ave
Decatur, GA 30030
404 538-1642
dtalc...@mindspring.com



___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


[Flashcoders] Random Sort of Array

2010-05-10 Thread Donald Talcott
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
dtalc...@mindspring.com

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders