Don, Okay, if I understand you correctly, you could insert a keyframe at the end of each animation which will allow you to place some code: stop(); setTimeout(goOn,1000);// that's a one second delay This will call the goOn function which in turn will direct the playhead to each animation in the desired (randomized) order. If you use the if/else block (from the code in my previous post) to manage the index then the animations will repeat, continuously.
Regards, Keith Reinfeld Home Page: http://keithreinfeld.home.comcast.net > -----Original Message----- > From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders- > boun...@chattyfig.figleaf.com] On Behalf Of Donald Talcott > Sent: Wednesday, May 12, 2010 7:58 AM > To: Flash Coders List > Subject: Re: [Flashcoders] gotoAndPlay a sorted array > > Keith, Karl, > thanks, I have a clearer understanding now. > > File structure; Frame labels on timeline order = mmPretzel, > 3Musketeers_truffle, MilkyWay_Caramel, mmCO, mmCherry, Twix_java, VOTE, > mmPB, NASCAR. > Animations are setup to play to the end of one then bounce over to the > next one in the final array. > What I am trying to get on gotoAndPlay is "mmPretzel" and > "3Musketeers_truffle" always play 1st and 2nd, then a random pick from > the remaining 7 would play as 3rd, followed by the 4th item in the > array and so forth. > > My current trace statements = > trace(b) = mmCherry, mmPB,mmCO, MilkyWay_Caramel, VOTE, Twix_java, > NASCAR. > trace(mOnemTwo) = mmPretzel, 3Musketeers_truffle, mmCherry, mmPB, mmCO, > MilkyWay_Caramel, VOTE, Twix_java, NASCAR. > > play result = mmPretzel, 3Musketeers_truffle, MilkyWay_Caramel, mmCO, > mmCherry, Twix_java, VOTE, mmPB, NASCAR (original order on timeline) > > On May 11, 2010, at 11:56 PM, Keith Reinfeld wrote: > > > Don, > > > > Yes, Karl is correct. In my post 'index' is a variable of type Number > which > > you would increment upon successive calls to function goOn(). You > access > > elements of an array by using the array access operator '[]'. The > indices of > > arrays are zero based, so the index of the first element is 0, the > index of > > the second element is 1, the index of the third element is 2, and so > on. You > > can use the length property of an array to find out how many elements > there > > are in the array. In your case you have an array with 9 elements so > you > > would want to use index values between 0 and 8. Note that > mOnemTwo.length > > (9) is one higher than the highest index value you can use with this > array > > (8). The sample code below includes an if/else block to manage index > values. > > > > > > // initialize index > > var index:Number = 0; > > function goOn(){ > > gotoAndPlay(mOnemTwo[index]); > > // manage the index > > if(index < mOnemTwo.length - 1){ > > // increment index by one > > index++; > > }else{ > > // set index back to zero > > index = 0; > > } > > }; > > > > I have to echo Karl's questions about how you are planning to make > > subsequent calls to function goOn(). What you have, > setTimeout(goOn,+8), > > will kick off the first one (although I don't understand the '+8' in > the > > delay parameter) but what about the rest? Any suggestions I could > make here > > would be pure guesswork without knowing more about the structure of > your > > file. > > > > HTH > > > > Regards, > > > > Keith Reinfeld > > Home Page: http://keithreinfeld.home.comcast.net > > > > > > > > _______________________________________________ > > 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 mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders