Question
This is a question about AS3.0 split
I wrote the code as below, but the list is not separated and saved in the array sm.
What's wrong with my code?
Any help would be appreciated.
var sm:Array = [];
var request:URLRequest = new URLRequest("http://.............../Text/soundList.txt");
// txt file : "a,b,c,d,.........."
var loader:URLLoader = new URLLoader();
loader.load(request);
loader.addEventListener(Event.COMPLETE, completeHandler);
function completeHandler(event:Event):void {
var str:String = event.target.data;
//trace(str); // "a,b,c,d,..............."
sm = str.split(","); // comma
//trace(sm); // "a,b,c,d,..............."
}
trace(sm.length); // result => 0
