mardi 23 février 2016

How to write multiple files using adobe flex

I have a string array where each object has comma separated and new line delimiters. Now i want to write these string objects to multiple CSV files. But I am able to write only one CSV file as below:-

         * callback method for exportCollection, results are in format of Map<String, String>
        protected function exportListResultHandler(event:ResultEvent):void {
            if (event.result != null )
                for (var key:* in event.result) {
                    var value:String=event.result[key];
                    var fileName:String=key;
                    exportStringToFile(value.toString(), fileName);

        private function exportStringToFile(stringToExport:String, filename:String=null):void
            //file refernce for import/export functionality. 
            var fileRef:FileReference = new FileReference(); 

                fileRef.addEventListener(Event.COMPLETE, finishUpload);            
                fileRef.addEventListener(IOErrorEvent.IO_ERROR, handleError);
      , filename);                
            }catch (error:Error){
                logger.error("Unable to save file. Error: ", error);  


Mine existing codes do not allow me to use File class from flash.filesystem package. Even arrays of FileReference did not helped me. I want to save multiple file at one location.

I am new to Adobe flex and flash builder, Any help would be great. Thanks a a lot

Aucun commentaire:

Enregistrer un commentaire