# Splitting text into an array

**URL:** <https://forum.kirupa.com/t/splitting-text-into-an-array/55547>\
**Category:** flash\
**Created:** [June 25, 2004, 12:07am UTC](https://forum.kirupa.com/t/splitting-text-into-an-array/55547 "2004-06-25T00:07:55Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![steveb1164](https://avatars.discourse-cdn.com/v4/letter/s/c37758/32.png) [@steveb1164](https://forum.kirupa.com/u/steveb1164)\
**Post date:** [June 25, 2004, 12:07am UTC](https://forum.kirupa.com/t/splitting-text-into-an-array/55547/1 "2004-06-25T00:07:55Z")

</div>

In layer 1 I have the following code to pull the variable ‘playerrank’ from my ASP page:  
myData = new LoadVars();  
myData.onLoad = function() {  
playerrank.text = this.playerrank;  
};  
myData.load(“livedraftvar.asp”);  
stop();

In layer 2 I have the following code to split ‘playerrank’ into an array and enter each item into a list box:

var playerrankArray = new Array();  
playerrankArray = playerrank.split(",");  
for(i=0; i\<8; i++) {  
playerlist.addItem(playerrankArray\*);  
}

The list box comes up with 8 commas, that’s it. If I put ‘playerrank’ into a dynamic text box, it comes up exactly how I want it. 102,204,209,308,489,518,555,698. Using playerrank.split(",") should put the eight elements into the array, then enter them into the list box. Why am I getting eight commas instead of the eight numbers. Thanks.
