| Previous | Next |
Choose Files
This sample shows how to use the mSystem.chooseFiles() command to enable the user to select multiple files.
Mac and Windows OS use similiar but different parameters in the choose file dialog. Windows doesn't require a file description and a default file type. Use mSystem.isMac() and mSystem.isWindows() in an if statement to handle the platform differences.
The code below enables the user to pick multiple JPEGs.
var chooseFileTitle = "Select JPGs";
var initFileName = "test.jpg";
var initFolderName = mSystem.getSpecialFolder("PICTURES");
var fileFilter:String;
var defaultFileType:String;
var fileMustExist = true;
var saveFile = false;
var selectedFiles:String;
if (mSystem.isMac()) {
fileFilter = "jpg";
defaultFileType = "";
} else if (mSystem.isWindows()){
fileFilter = "JPEG Files (*.jpg)|*.jpg";
defaultFileType = "jpg";
}
chooseFiles_btn.onRelease = function() {
var selectedFilesArray:Array = mSystem.chooseFiles(chooseFileTitle, initFileName, initFolderName, fileFilter, defaultFileType);
selectedFiles = "";
for (i=0; i<selectedFilesArray.length; i++) {
selectedFiles = selectedFiles+selectedFilesArray[i]+newline;
}
};
You can download this sample, "loadSWF", from the mProjector Samples page -- /software/flash-projector/flas.html#chooseFiles.
| Questions or Feedback? | Previous | Next |
More Information
Getting Started
ActionScript 3.0 Support
- AS2 Migration
- Getting Started - Flash
- Debugging in Flash
- Building your application from inside Flash
- Getting Started - Flex
- Debugging in Flex
ActionScript 3.0 Samples
Using mProjector
- Using mProjector - Compile Your SWF into an Appli
- Customizing The About Window
- Debugging Your Application
- Launching Application at Startup
- Mac vs. Windows Application Development
- Menus
- Dynamic Window Creation
ActionScript 2.0 Samples
- Application Basics
- mProjector Class Basics
- Add Remove Programs Control Panel
- Fullscreen and Center
- Check Connection and Download File
- Choose Files
- Creating an Installer
- Creating and Controlling Multiple Windows
- Cut, Copy, and Paste (Windows)
- Desktop Shortcut and Start Menu Support
- Drag and Drop Files
- Embedding HTML and other Media types
- Flash-Shaped Windows
- Message Box
- Open Documents
- Project Files
- Reading and Writing to Hard Drive
- Startup Application
- Wallpaper and Screensaver
- Window to Window Communications
- Working with Included Files
- Context Sensitive Menus
- Alert User
- Screen Resolution
