Actually, just for kicks:

public function filterFolderFromPath(fullPath:String,
children:Vector.<Folder>):Folder
{
for each (var currentFolder:Folder in children)
{
if (currentFolder.path === fullPath) return currentFolder;
else if (currentFolder.children.length)
{
currentFolder = this.filterFolderFromPath(fullPath, currentFolder.children);
if (currentFolder) return currentFolder;
}
}
return null;
}

you can save that local variable, but I wouldn't do it this way as it makes
the code harder to read. :)

Reply via email to