Adobe Flex Actionscript Question:
Download Questions PDF

I have i input text field on stage and I have a button also, Further i am writing some text in that input text field. I want to save my written data on my local system (on my computer), How can i do this?

Answer:

To achieve this you have to use flash CS4 with Flash Player 10 or above. Using the new method of filereference class you can save you typed text on your computer as a text file.

First create a object of filereference… then use the save method and pass your data to it.
var fR:FileReference =new FileReference()
fR.save("your Written text should be come here.","flexflashforum.txt")

Paste the following code on frame and run a sample application...

Code:
var TxtF:TextField = new TextField();
var BtnMc:TextField = new TextField();
var MyFile:FileReference = new FileReference();

TxtF.border = true;
TxtF.type = TextFieldType.INPUT;

BtnMc.background = true;
BtnMc.backgroundColor = 0xCCCCCC;
BtnMc.x = 150;
BtnMc.height = 20;
BtnMc.text = " Click here to save";

Download Adobe Flex Actionscript Interview Questions And Answers PDF

Previous QuestionNext Question
How can you show a jpg image in Dynamic Text Field?What is the difference in MovieClip and Sprite?