I tried it like you said, putting them in different frames, and it works
fine for me.  

Frame 1:
_root.cat_colors = new Array();
_root.cat_colors[0] = "bob,john,betty";

Frame 3:
for (i=0; i<_root.cat_colors.length; i++) {
    trace("String: "+_root.cat_colors[i]);
    var tempColor:Array = _root.cat_colors[i].split(",");
    trace("Total: "+tempColor[i]);
    for (j=0; j<tempColor.length; j++) {
       trace("Color: "+tempColor[j]);
    }
}
stop();

Trace result:

String: bob,john,betty
Total: bob
Color: bob
Color: john
Color: betty

As expected.

Jason Merrill   |   E-Learning Solutions   |  icfconsulting.com










>>-----Original Message-----
>>From: [EMAIL PROTECTED] [mailto:flashcoders-
>>[EMAIL PROTECTED] On Behalf Of Mike Boutin
>>Sent: Tuesday, December 20, 2005 6:41 PM
>>To: Flashcoders mailing list
>>Subject: [Flashcoders] Wierd split
>>
>>Im having a wierd problem with using .split on an array.  I create an
>>array 3 frames before in the same timeline like so:
>>
>>_root.cat_colors = new Array();
>>_root.cat_colors[0] = "bob,john,betty";
>>
>>
>>Then 2 frames down the timeline I run a loop like so:
>>
>>for (i=0; i<_root.cat_colors.length; i++) {
>>
>>    trace("String: "+_root.cat_colors[i]);
>>   // The string traces properly here ex. bob,jim,john etc...
>>
>>    var tempColor:Array = _root.cat_colors[i].split(",");
>>    trace("Total: "+tempColor[i]);
>>    // traces out undefined for the next loop never happens
>>
>>    for (j=0; j<tempColor.length; j++) {
>>       trace("Color: "+tempColor[j]);
>>    }
>>
>>}
>>
>>
>>Anyone know why this doesnt work? is there another way to achieve
this?
>>If i create the array on the same frame as the loop, everything works
>>like it should.
>>
>>
>>Thanks!
>>_______________________________________________
>>Flashcoders mailing list
>>Flashcoders@chattyfig.figleaf.com
>>http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
NOTICE:
This message is for the designated recipient only and may contain privileged or 
confidential information. If you have received it in error, please notify the 
sender immediately and delete the original. Any other use of this e-mail by you 
is prohibited.
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to