FileGetDialog syntax ?

Find out why the . goes before the /

Moderator: Paul Tuersley

Post Reply
lougris
Posts: 12
Joined: March 12th, 2012, 5:29 am

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
micpen
Posts: 7
Joined: May 15th, 2012, 1:54 am

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 ") }

}
Post Reply