Hello,
I use the function fileGetDialog(title, filelist), and i would like to know the syntax to list lots of files type in the filelist parameter ?
Exemple : JPEG (*.jpg,*.jpeg)
TIFF (*.tiff)
TARGA (*.tga)
Thanks for advance
Frédéric
FileGetDialog syntax ?
Moderator: Paul Tuersley
Hi, with File.openDialog :
var targetFile = File.openDialog("Import File");
if (targetFile) {
var dot = targetFile.toString().lastIndexOf(".");
var extension = targetFile.toString().substr(dot,targetFile.length);
if(extension.match(new RegExp ("(png|jpg|swf)", "i")))
{
targetFile.open("r");
var TypeOfImg = targetFile.read();
LoadFile(targetFile); // function to load files
} else { alert("Invalid image format. Only these formats are accepted : .png .jpg .swf ") }
}
var targetFile = File.openDialog("Import File");
if (targetFile) {
var dot = targetFile.toString().lastIndexOf(".");
var extension = targetFile.toString().substr(dot,targetFile.length);
if(extension.match(new RegExp ("(png|jpg|swf)", "i")))
{
targetFile.open("r");
var TypeOfImg = targetFile.read();
LoadFile(targetFile); // function to load files
} else { alert("Invalid image format. Only these formats are accepted : .png .jpg .swf ") }
}