forgot to mention fileToSave = File.desktopDirectory; fileToSave.addEventListener(Event.SELECT, saveFile);
Tushar http://tush.wordpress.com/ On Dec 7, 11:37 pm, Tushar Wadekar <[EMAIL PROTECTED]> wrote: > Well, lets hope that in future we can add typeFilter parameter to > browseForSave!!!http://bugs.adobe.com/jira/browse/FB-11541 > > Meanwhile, here is one ugly workaround... > > private function saveFile(event:Event):void { > var tmpArr:Array = File(event.target).nativePath.split > (File.separator); > var fileName:String = tmpArr.pop(); > var confirmedFileDef:String = confirmExtension(fileName); > tmpArr.push(confirmedFileDef); > var confirmedFile:File = new File("file:///" + tmpArr.join > (File.separator)); > var fileStream:FileStream = new FileStream(); > fileStream.open(confirmedFile, FileMode.WRITE); > if(fileFormat == "Binary") { > fileStream.writeBytes(fileByte); > } else { > fileStream.writeUTFBytes(fileText); > } > fileStream.close();} > > private function confirmExtension(fileDef:String):String { > var fileExtension:String = fileDef.split(".")[1]; > var defaultExtensionList:Array = new Array("vcf"); > for each(var it:String in defaultExtensionList){ > if( fileExtension == it) > return fileDef; > } > return fileDef.split(".")[0] + "." + defaultExtension; > > } > > Tusharhttp://tush.wordpress.com/ > > On Dec 3, 1:14 pm, "sunny ladkani" <[EMAIL PROTECTED]> wrote: > > > Hi, > > > In my flex application, I have a workflow in which the user gets the dialog > > to download file to the local machine. Now suppose the file that use is > > downloading is "123.jpg" and he renames it as "xyz". Is there a way that > > when user clicks on "Save" button, we can add ".jpg" extension to the > > filename? > > > Thanks, > > > Sunny --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Flex India Community" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/flex_india?hl=en -~----------~----~----~----~------~----~------~--~---

