A Flash Developer Resource Site

Results 1 to 13 of 13

Thread: reading from TXT file

  1. #1
    Junior Member
    Join Date
    Apr 2001
    Posts
    3
    I am using flash 5. and i want to make it so i can just update a *.txt file and it will edit my flash txt. Just have the text file read the txt from a *.txt file. i have fooled around with some of the tutorials.. but it never seems to work... Please some one give me a good working tutorials or just give me some help on how to do this

    Thanks

  2. #2
    FK Slacker
    Join Date
    Jun 2000
    Location
    vancouver
    Posts
    3,208
    Hi...

    It's pretty easy...First, create a text field on stage. In the Text Options panel, select Dynamic Text, and give it a variable name (ie: text).

    Then, add a frame or button action to load the text...

    loadVariables("text.txt",0);

    Then, create the text file. It should look something like this:

    text=whatever text you want goes here

    Note that you need to begin the file with the same variable name that you gave your text field.Save this as text.txt. Upload the text file and the SWF to the same directory and it should work...

    Hope this helps,

    K>

  3. #3
    Junior Member
    Join Date
    Feb 2001
    Posts
    26
    i tried this out and just got a blank text field...

    if you can get it to work i'd definitely like to know how...

    (by the way, you may want to change the settings for the dynamic text field to multiline with text wrap .... (just an assumption))

  4. #4
    Registered User
    Join Date
    Jan 2001
    Posts
    47
    Hello deadbeat!

    text=whatever text you want goes here

    the book mentioned that the text files should be formatted like this

    &text=this+is+text

    it works with just regular text looking like that? the AS Guide mentioned that the text needs to follow some specific format that looks like the CGI format 'ECM something something'


  5. #5
    Junior Member
    Join Date
    Dec 2000
    Location
    london
    Posts
    14
    the loadVariables works if you load it on to a named movieclip:
    loadVariable ("yourtext.txt","_root.amovieclip")

    and then on that movieclip have a Dynamic text field (multi line, word wrap) with the same variable name as the one use at the begining of your text file.

    hope this helps

  6. #6
    Junior Member
    Join Date
    Apr 2001
    Posts
    3
    None of these are working.. can some one please claify this.. how to make this work exactly.. with some step by step help.. Please that would be great

    Thanks

  7. #7
    Junior Member
    Join Date
    Dec 2000
    Location
    london
    Posts
    14
    let say you create a movieclip called textMC
    It should have a DYNAMIC TEXT FIELD with a variable name for the textfield, say 'myVariables'
    Put that MC on the stage, give it a INSTANCE NAME, say textMOVIE.

    Create a button which will:
    on (Release){
    loadVariables ("anything.txt", "_root.textMovie");
    }

    I am sure this will work for you!

    All you have to make sure is that your TXT file contains the variable name of the your Dynamic Text Field:
    myVariables=text......text...text....

    AND that the text file is saved as textMovie.txt.

    If you are uploading this SWF on the internet, the file path must contain the FULL URL. So in the above example:
    on (Release)}
    loadVaribles "http://www.domainname.com/anything.txt","_root.textMovie");
    }

    When you're trying this out on your PC the full file path does not need to be entered as long as bithe SWF & the TXT file is in the same folder.

    Good Luck



  8. #8
    these are not working because in the text file you must add



    text=


    and the very top for flash to know what to import

    and the actions i used are

    frame 1( Load )
    loadVariablesNum ("/~boomers/text.txt", 0);
    frame 2
    if (text ne "") {
    gotoAndPlay ("end");
    }
    frame 3
    gotoAndPlay ("load");
    frame 4 (end)
    (this is the frame with the text field in it)
    stop ();


    this should do it

    and for scroll buttons

    up
    on (press) {
    text.scroll = text.scroll-2;
    }


    down

    on (press) {
    text.scroll = Number(text.scroll)+2;
    }



    thats it any Q ask me

    (there is an example of this on my menu page!!)

    [Edited by irlmarc on 04-18-2001 at 07:45 PM]

  9. #9
    Junior Member
    Join Date
    Mar 2001
    Posts
    20

    Excellent!

    I've just been trying to figure out how to create a dynamic text field inside a movieclip that reads from a .txt file! Your posts here have been really helpful, thanks!

  10. #10
    Junior Member
    Join Date
    Apr 2001
    Posts
    3
    THANKs a bunch for this.. it worked perfect thanks alot

  11. #11
    No problem just you must includ the

    Text=

  12. #12
    Senior Member
    Join Date
    Feb 2001
    Location
    French Alps
    Posts
    159
    Originally posted by irlmarc
    No problem just you must includ the

    Text=

    on your second line of text in the txt file it should read

    &text2=place your text here
    &text3=
    &text4=

    Thats if you have named the textfields in your flash
    text2
    text3

  13. #13
    no no no you just need the first text=


    i use just the text= once

    here is an example

    text= 03/Apr/2001:18:34:09
    News Today
    Just got word Does not look good on the ASP front !! So dont look the best oh
    well i find out how to do it some other way
    Regards
    Marc
    ICQ : <a href=" http:\\wwp.icq.com/scripts/contact.dll?msgto=77748261">77748261(click here)</a>
    ON Studios The future of web design


    this is the last thing i posted and you just need the thing once

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