I Want To add FileFilter ("*.doc") to save automatic file without type extension

101 Views Asked by At

I want to add my FileFilter in as3. Because there is the main problem of extension typing. I already use this option

(saveFile.save(bytes,_dbookNameFill+".doc"));

but I want to automatically generate this extension when I save my file any names. Please Help Me I am Mini Programmer.

var bytes:ByteArray = document.save(Method.LOCAL);
var saveFile:FileReference = new FileReference()
var _dbookNameFill:String = 
QSTPreviwForStudentMC._bookNameMc.bookNtxt.text;
var fileFilter:FileFilter=new FileFilter("*.doc","*.text;*.RTF;");
saveFile.save(bytes,_dbookNameFill+".doc");
1

There are 1 best solutions below

0
obscure On

I'm afraid this won't work. Using AS3's FileFilter class you're just able to limit what's being displayed on a file dialog you've opened using Filereference.browse(). FileReference.save() isn't affected by a FileFilter and as far as I know there is no way to force a particular file extension - perhaps due to security reasons.