Re: [Flashcoders] gotoAndPlay a sorted array

2010-05-12 Thread Donald Talcott
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


RE: [Flashcoders] gotoAndPlay a sorted array

2010-05-12 Thread Keith Reinfeld
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


Re: [Flashcoders] gotoAndPlay a sorted array

2010-05-12 Thread Donald Talcott
Keith,
That did it. I shortened the delay and all is working well. Thank you. My 
example cited in this post was last years project, I wanted to work out the 
code first using it.
Now it's time to build this years project. I owe you.

On May 12, 2010, at 10:09 AM, Keith Reinfeld wrote:

 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

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] gotoAndPlay a sorted array

2010-05-12 Thread Karl DeSaulniers

Very nice. Good work Keith.
Good luck Don.

Karl

Sent from losPhone

On May 12, 2010, at 11:04 AM, Donald Talcott dtalc...@mindspring.com  
wrote:



Keith,
That did it. I shortened the delay and all is working well. Thank  
you. My example cited in this post was last years project, I wanted  
to work out the code first using it.

Now it's time to build this years project. I owe you.

On May 12, 2010, at 10:09 AM, Keith Reinfeld wrote:


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


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


RE: [Flashcoders] gotoAndPlay a sorted array

2010-05-12 Thread Keith Reinfeld
Glad I could help. Good luck!

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 11:05 AM
 To: Flash Coders List
 Subject: Re: [Flashcoders] gotoAndPlay a sorted array
 
 Keith,
 That did it. I shortened the delay and all is working well. Thank you.
 My example cited in this post was last years project, I wanted to work
 out the code first using it.
 Now it's time to build this years project. I owe you.
 
 On May 12, 2010, at 10:09 AM, Keith Reinfeld wrote:
 
  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
 
 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

RE: [Flashcoders] gotoAndPlay a sorted array

2010-05-11 Thread Keith Reinfeld
 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: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-
 boun...@chattyfig.figleaf.com] On Behalf Of Donald Talcott
 Sent: Tuesday, May 11, 2010 5:25 PM
 To: Flashcoders@chattyfig.figleaf.com
 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
 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


Re: [Flashcoders] gotoAndPlay a sorted array

2010-05-11 Thread Donald Talcott

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: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-
boun...@chattyfig.figleaf.com] On Behalf Of Donald Talcott
Sent: Tuesday, May 11, 2010 5:25 PM
To: Flashcoders@chattyfig.figleaf.com
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
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


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


Re: [Flashcoders] gotoAndPlay a sorted array

2010-05-11 Thread Karl DeSaulniers

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: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-
boun...@chattyfig.figleaf.com] On Behalf Of Donald Talcott
Sent: Tuesday, May 11, 2010 5:25 PM
To: Flashcoders@chattyfig.figleaf.com
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
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


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


Karl DeSaulniers
Design Drumm
http://designdrumm.com

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


RE: [Flashcoders] gotoAndPlay a sorted array

2010-05-11 Thread Keith Reinfeld
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