Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Aug 2002
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Text files with Flash MX

    I'm a newbie to Flash so any assistance would be fantastic. What I am looking to do is every time an option is picked from a Combo box, text displays in a text field. Now I have a fair idea of how to do this normally (ie through using ActiveScript), but instead I want it to take the text from a text file (ie. *.txt).

    So basically I click the option, it opens a txt file and displays its contents in a Flash text box. Is this possible to do, and if so would somebody kindly tell me how?

    Thanks for you help.

  • #2
    Regular Coder
    Join Date
    Jun 2002
    Location
    Provo, UT
    Posts
    142
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I know it is possible but I have never done it but I have an example of one way to do it.

    in the html file you put the link
    this at the end of the link

    ?course=course_info.txt

    so it will look like

    <embed src="flash/menu.swf?info=info.txt">

    You will notice that the this like take with it the values in the info.txt and puts them into info. I do not know what how many text files can be put in or how flash reads it. I just know it is possible.

    You should post when you find out exactly how to do it so that we all can know.


  • #3
    New Coder
    Join Date
    Feb 2003
    Location
    Toronto, ON
    Posts
    50
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Text files with Flash MX

    Originally posted by TheDon
    I'm a newbie to Flash so any assistance would be fantastic. What I am looking to do is every time an option is picked from a Combo box, text displays in a text field. Now I have a fair idea of how to do this normally (ie through using ActiveScript), but instead I want it to take the text from a text file (ie. *.txt).

    So basically I click the option, it opens a txt file and displays its contents in a Flash text box. Is this possible to do, and if so would somebody kindly tell me how?

    Thanks for you help.
    Do you want different text diplayed for each option?

    If so...

    Put this actionscript in frame 1:
    Code:
    loadVariablesNum("data.txt", 0); //data.txt is where your data is stored.
    For each check box (we'll say there are three for this example) you will need a different variable defined in your text file. Follow this syntax:

    Code:
    &var1=blahblahblah&var3=blahblahblah&var3=blahblahblah
    Now you need to set up your buttons and text boxes.

    Label your text boxes: box1, box2, box3

    Each of your buttons will now need an action to take the variable from the loaded text file, and apply it to the text box.

    Code:
    on (release) {
        _level0:box1 = _level0:var1; //loads var1 into the first text box
        _level0:box2 = ""; //clears the other two boxes
        _level0:box3 = "";
    }
    And that should do it!

    Cheers.
    Thodyconsulting.com


  •  

    Posting Permissions

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