private var csv:URLLoader = new URLLoader();
private var array:Array = new Array();
private var urlr:URLRequest = new URLRequest();
public function loadRecipe(path:String):void
{
try
{
csv.dataFormat = URLLoaderDataFormat.TEXT;
urlr = new URLRequest(path);
csv.addEventListener(Event.COMPLETE, finishRecipe);
csv.load(urlr);
}
catch (e:SecurityErrorEvent)
{
trace("1");
}
catch (e:IOErrorEvent)
{
trace("2");
}
}
public function finishRecipe(e:Event):void
{
var csvString:String = csv.data as String;
array = csvString.split(",");
}
我正在使用的代码在上面。我无法触发完成事件,也就是说,我的数组永远不会被填充。谁能告诉我为什么?
编辑:我改变以摆脱所有弱引用并检查错误。我没有收到任何错误。