A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: Loading text from a .txt file ?? help!

  1. #1
    Junior Member
    Join Date
    Jul 2000
    Posts
    15
    ok, i have a quote section in my flash movie which I would like to update every so often but i would like to do this using a text file and not the actual .fla file. I can do it by pulling in variables using the html file and so on but it won't let me put any spaces unless i insert '+' everywhere i need a space. How do i do this using the "load variable" feature in flash? PS. - I would like the .txt file to be clean (just the quote that I want) because i have an html version and a flash version of this site and i want them both to use the same txt file for the quotes.

    Thanx a million

  2. #2
    *create a text file in notepad.
    *save it as a .txt
    *go to your action script and say load/unload movie
    *check the load variables
    *in the url type the name of the .txt file and check the target box
    *put where you want it to go

    GOOD LUCK

  3. #3
    HELP>>>ACTIONSCRIPT DICTIONARY
    Join Date
    Feb 2000
    Location
    In the Present Moment
    Posts
    1,041
    In order for Flash to read the text in your textfile you will need to define the variable within the textfile i.e.

    quote1="Four Score and seven years ago our Forefathers..."&quote2="I'd buy that for a dollar."&quote3=etc...

    within the textfile you do not need to add the + for spaces

    Then you would select the Load Movie command and check the Load Variables button.

    In the URL box you would have something like-

    myTextfile.txt

    choose zero for your level (if you want to store the variables on the maintimeline), and leave the default Variables selection on Don't Send, so your script would look like this if a frame action:

    Load Variables ("myTextfile.txt", 0)

    or if the action is on a button:

    On(Release)
    Load Variables ("myTextfile.txt", 0)
    End On

    The textfile and .swf file need to be in the same directory on your web server.

    I don't know that using one text file for the html and flash movie will work seeing as Flash requires a specific formatting for reading in variables.

    Hopefully this helps out.

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