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.

viagra europe adobe photoshop teacher discount