Pyroclasm
Pyroclasm

Reputation: 31

Create new specified folder with AS3 and AIR

I am relatively new to the AIR world and need some help (on Windows 7 operating system). I tried searching for help, but I am dumbfounded as what to do. My knowledge of ActionScript 3 is fundamental and I am completely new to working with Adobe AIR. I will keep this thread short and not go into great detail about the rest of my application.

Any help is appreciated, I am completely lost.

Steps:

  1. The user runs my Adobe Air application. (and it does open, just the buttons don't work yet)

  2. User clicks the "Save As" button and is prompted with a window to choose the desired directory.

  3. After they choose the directory the directory path is stored in a String variable.

  4. Then the user clicks the "OK" button. This will grab the path directory variable and create a new folder. The folder will have the name from a variable string.

Upvotes: 0

Views: 887

Answers (1)

simion314
simion314

Reputation: 1394

Here is a sample code for selecting a directory

    protected function browseBtn_clickHandler(event:MouseEvent):void
    {
        var browseFile:File = FileUtils.documentsDirectory();
        browseFile.addEventListener(Event.SELECT, fileSelected);
        browseFile.browseForDirectory("Select Local Folder");
        function fileSelected(e:Event):void {
            browseFile.removeEventListener(Event.SELECT, fileSelected);
            if(localDirPath.text != browseFile.nativePath){
                localDirPath.text = browseFile.nativePath;
                changed=true;
            }

        }
    }

this is a sample, localDirPath is a TextInput where I display the selected path, changed is a flag, so you use the File class in AIR for Desktop.Check the documentation File Class Reference check the methods that contain "browse" like browseForOpen, browseForSave, createDirectory

Upvotes: 2

Related Questions