Hi,
I'm looking for an easy method to alter the questions and answers in a .txt file (attached), which realte to an .swf. Would any of you kind people know a way of doing this?
Thank you in advance.
Printable View
Hi,
I'm looking for an easy method to alter the questions and answers in a .txt file (attached), which realte to an .swf. Would any of you kind people know a way of doing this?
Thank you in advance.
Are you asking for something other than just editing it in notepad?
Editing in notepad just seems time consuming and clumsy. I wondered if there was a way of creating 'input question, input multiple choice answers' and then have the resulting .txt file ?
Yes. What version of flash and actionscript are you using?
Unfortunately my system has crashed, so nothing at the moment. have to rebuild my P.C - replying to this at work. :-(
Would something in Flash CS5, actionscript 3 be okay?
It would, if you are still there!
can anyone else help, please?
Hi,
Here is a very basic AS3 way of doing it for you,On stage:PHP Code:
import flash.events.MouseEvent;
import flash.text.TextField;
import flash.net.URLLoader;
import flash.net.URLRequest;
// *** Save part
var TextToSave:TextField;
var FileRef:FileReference;
function SaveFile(e:MouseEvent):void
{
FileRef = new FileReference();
FileRef.save(TextToSave.text, "MySavedText.txt");
}
SaveButton.addEventListener(MouseEvent.CLICK,SaveFile);
// *** Import part;
var TextLoader:URLLoader = new URLLoader();
TextLoader.addEventListener(Event.COMPLETE, OnLoad);
function OnLoad(e:Event):void
{
TextToSave.text = TextLoader.data;
}
function GetFile(e:MouseEvent)
{
TextLoader.load(new URLRequest("MySavedText.txt"));
}
LoadButton.addEventListener(MouseEvent.CLICK,GetFile);
Two movieclips/buttons - Names = LoadButton/SaveButton
One Textfield - Name = TextToSave
and one external text file called MySavedText.txt if you are going to import first.