Two methods for Flex to output files to local
I currently use two methods to output files to the local in flex, namely File and FieldRefreence
Example:
var exportString:String = "This is a test"
1. File output
var ff:File = File.desktopDirectory.resolvePath("Progress.CSV"); ff.addEventListener(Event.SELECT,exportCSVSelectedHandler); ff.browseForSave("选择路径"); private function exportCSVSelectedHandler(event:Event):void { var dir:String = event.target.nativePath; var writeStream:FileStream = new FileStream(); writeStream.open(new File(dir),FileMode.WRITE); var content:String = "jhfdklahflaksjdhflkasjhflaskjhlf\n"; writeStream.writeMultiByte(content,'utf-8'); writeStream.close(); }
2. FileReference output
var content:String = "jhfdklahflaksjdhflkasjhflaskjhlf\n"; var f:FileReference = new FileReference(); f.save(content,"1.csv");
The difference between File and FileReference is that File can specify the encoding format of the document, while FileReference is relatively simple to use
For more related articles on two methods of Flex outputting files to local area, please pay attention to the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

