Hi Don,
How are the different animations playing?
Are you having them play to the end of one then bounce over to the next one in your final array? Or is a user clicking a button to send it to the frame to play and the button is just dynamic?

In your function, you can only go play one frame at a time and not all the frames at the same time, so you have to choose one.
EG: If I wanted to play the second item in the final array,

function goOn(){
gotoAndPlay(mOnemTwo[1]);
};
setTimeout(goOn,+8);

I think Keith was using index as a reference to what index you wanted, IE: 0, 1, 2, 3, etc.. not the actual word "index".

HTH

Karl


On May 11, 2010, at 8:24 PM, Donald Talcott wrote:

Keith,
added [index] to the function;
now have the following error:
1120:Access of undefined property index.

Wish I could wrap my head around this. Any thoughts?

On May 11, 2010, at 7:31 PM, Keith Reinfeld wrote:

gotoAndPlay(mOnemTwo);

You need to pass just one element of the mOnemTwo array rather than the
entire array.
So:

gotoAndPlay(mOnemTwo[index]);

Regards,

Keith Reinfeld
Home Page: http://keithreinfeld.home.comcast.net

-----Original Message-----
From: [email protected] [mailto:flashcoders-
[email protected]] On Behalf Of Donald Talcott
Sent: Tuesday, May 11, 2010 5:25 PM
To: [email protected]
Subject: [Flashcoders] gotoAndPlay a sorted array

Have a file with 9 animations, each with a frame label on the timeline I've created 2 arrays, sorted the 2nd one and concat() the two into a
third array.
I'm tracing all arrays and they are working as I'd like. Now I would
like to gotoAndPlay the final array.
Can this be done? See code below:

stop();
var mOne:Array = ["mmPretzel", "3Musketeers_truffle"];
var mTwo:Array = ["MilkyWay_Caramel", "mmCO", "mmCherry", "Twix_java",
"VOTE", "mmPB", "NASCAR"];


function shuffle(mTwo,b):int {
var num : int = Math.round(Math.random()*2)-1;
return num;
}
var b:Array = mTwo.sort(shuffle);
trace(b);

var mOnemTwo:Array = mOne.concat(b);
trace(mOnemTwo);




/*function goOn(){
gotoAndPlay(mOnemTwo);
};
setTimeout(goOn,+8);
*/


When I uncomment the function, I get the following error.

mmCherry,mmPB,mmCO,MilkyWay_Caramel,VOTE,Twix_java,NASCAR
mmPretzel, 3Musketeers_truffle,mmCherry,mmPB,mmCO,MilkyWay_Caramel,VOTE,
Twix_java,NASCAR

ArgumentError: Error #2109: Frame label
mmPretzel, 3Musketeers_truffle,mmCherry,mmPB,mmCO,MilkyWay_Caramel,VOTE,
Twix_java,NASCAR not found in scene Scene 1.
        at flash.display::MovieClip/gotoAndPlay()
        at Mars_2010Test_fla::MainTimeline/goOn()
        at Function/http://adobe.com/AS3/2006/builtin::apply()
        at SetIntervalTimer/onTimer()
        at flash.utils::Timer/_timerDispatch()
        at flash.utils::Timer/tick()

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

_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Karl DeSaulniers
Design Drumm
http://designdrumm.com

_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to