02-24-2012 01:14 PM
Hello everyone. I am using a DataGrid to display files and folders and have buttons to add folder, delete folder, delete file but I want to add a confirmation popup dialog for when a delete button is pressed. I found one example but it uses the MX FileSystemDataGrid and I couldn't figure out how to extrapolate from that example and apply it to my use. Below is my code, hoping someone can suggest how I can do it.
protected function deleteFolder_clickHandler(event:MouseEvent):void
{
var dir:File = File.documentsDirectory.resolvePath(folderName.tex t);
dir.deleteDirectory();
folderName.text = "";
file.getDirectoryListingAsync();
folderList.refresh();
list.dataProvider = folderList;
}
protected function deleteFile_clickHandler(event:MouseEvent):void
{
var delFile:File = this.filelist.selectedItem.file as File;
delFile.deleteFile();
currentFile.getDirectoryListingAsync();
fileList.removeAll();
fileList.refresh();
filelist.dataProvider = fileList;
}
Solved! Go to Solution.
03-01-2012 02:33 PM
You have those methods set up as the event handlers for the delete buttons. Why don't you create a different method to sit in-between? So your click handler for the delete button goes to a new showConfirmationDialog() method, with an okay button. The click handler for the okay button should be your current delete method. Make sense?
03-01-2012 02:41 PM
03-01-2012 02:55 PM
You could do either approach. There's the PromptDialog class which would be the native dialog control to use.
03-01-2012 02:57 PM