easy method for altering questions in a .txt file
A Flash Developer Resource Site

Results 1 to 9 of 9

Thread: easy method for altering questions in a .txt file

  1. #1
    Junior Member
    Join Date
    Dec 2012
    Posts
    5

    easy method for altering questions in a .txt file

    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.
    Attached Files Attached Files

  2. #2
    :
    Join Date
    Dec 2002
    Posts
    3,513
    Are you asking for something other than just editing it in notepad?

  3. #3
    Junior Member
    Join Date
    Dec 2012
    Posts
    5
    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 ?

  4. #4
    :
    Join Date
    Dec 2002
    Posts
    3,513
    Yes. What version of flash and actionscript are you using?

  5. #5
    Junior Member
    Join Date
    Dec 2012
    Posts
    5
    Unfortunately my system has crashed, so nothing at the moment. have to rebuild my P.C - replying to this at work. :-(

  6. #6
    :
    Join Date
    Dec 2002
    Posts
    3,513
    Would something in Flash CS5, actionscript 3 be okay?

  7. #7
    Junior Member
    Join Date
    Dec 2012
    Posts
    5
    It would, if you are still there!

  8. #8
    Junior Member
    Join Date
    Dec 2012
    Posts
    5
    can anyone else help, please?

  9. #9
    . fruitbeard's Avatar
    Join Date
    Oct 2011
    Posts
    889
    Hi,

    Here is a very basic AS3 way of doing it for you,
    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.COMPLETEOnLoad);

    function 
    OnLoad(e:Event):void
    {
        
    TextToSave.text TextLoader.data;
    }

    function 
    GetFile(e:MouseEvent)
    {
        
    TextLoader.load(new URLRequest("MySavedText.txt"));
    }

    LoadButton.addEventListener(MouseEvent.CLICK,GetFile); 
    On stage:
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width


HTML5 Development Center

Poll by Flashkit.com