I got a question that is driving me crazy. I have a DIRECTORY_LISTING event, that is executed with the files in a directory. This code is n a method o a class that only does the return a array with this informations (the code is above). How can I add a return of this array on a method in the DocumentClass that invoke and receive this value?
Code:
//Lista arquivos
public function listaArquivos(diretorio:File, nome_arquivo:String, lista_molduras:Array, index:int):Array{
//Tenta fazer tudo isso
try{
//Seta o diretoório de molduras
var directory = diretorio;
directory.getDirectoryListingAsync();
directory.addEventListener(FileListEvent.DIRECTORY _LISTING, listaHandler);
//Percorre arquivos
function listaHandler(evento):void{
//Contador
var i:int = 0;
//Conteúdo
var contents = evento.files;
for (i = 0; i < contents.length; i++) {
var nome:String = contents[i].name;
var nome_array:Array = new Array();
nome_array = nome.split("_");
//Formata para ordenar
arquivos_animacao.push ({nome:contents[i].name, tamanho:contents[i].size, ordem:nome_array[0]});
}
//Ordena para a ordem de númeração
arquivos_animacao.sortOn("ordem", Array.NUMERIC);
lista_molduras[index] = arquivos_animacao;
}
}catch(erro:ReferenceError){
}
return lista_molduras;
}