Welcome, Guest
  • Author Topic: Importing text from a text file  (Read 3424 times)

    MarkEmerson

    • Server what's that
    • *
    • Posts: 44
    • Don't mind me, I'm new
      • MSN Messenger - Mark_Emerson83@Hotmail.com
      • AOL Instant Messenger - MarkEmerson83
      • View Profile
      • Email
    Importing text from a text file
    « on: 01/28/02, 07:47 »
    Just a quick one

    How do I import text from a txt file into a text field in Flash,  I'm not 100% sure on the code any quick help will be appriciated.  

    thnx, Mark

    flashswami

    • Jr. Programmer
    • **
    • Posts: 55
    • vene vidi vector
      • View Profile
      • Flashswami
    Re:Importing text from a text file
    « Reply #1 on: 01/28/02, 09:25 »
    Go here and download the 'dynamic text tutorial'.

    http://www.dotdragnet.co.uk/index2.asp?action=02&cat=3&downloads=true

    Flash-db

    • Administrator
    • Systems Administrator
    • *****
    • Posts: 1876
      • View Profile
      • Flash-db.com
    Re:Importing text from a text file
    « Reply #2 on: 01/28/02, 12:39 »
    To import a Text file into a dynamic Text box in your Flash Movie.  An example:

    1) Create a New Movie.

    2) Create a dynamic Text box named "TheText"  - you can name this anything but for now keep it at that.  Make sure to make it Multi-line with word wrap.

    3) Add this Code to the first Frame of your movie.

    loadVariablesNum ("TextFile.txt", 0);

    4)  Create a text file with Notepad and name it 'TextFile.txt'.  

    5)  Type in the following words into TextFile.txt.  
         TheText=This is the text that I want to load into my movie - This can be any text at all.  

    6)  Put the Text File and new Movie you just created in the same directory.  Then when you run the movie it will load the Text after the '=' sign into the Text box you named "TheText" in the Flash movie.

    7) if you have any questions let me know.
     

    Flash-DB

    MarkEmerson

    • Server what's that
    • *
    • Posts: 44
    • Don't mind me, I'm new
      • MSN Messenger - Mark_Emerson83@Hotmail.com
      • AOL Instant Messenger - MarkEmerson83
      • View Profile
      • Email
    Re:Importing text from a text file
    « Reply #3 on: 01/30/02, 06:36 »
    thanks guys thats working now and i bet you guessed that this was coming next, but now i need to scroll it.  

    I have found loads of tutorials that tell you how to do it with an up arrow and a down arrow but i want a scroller like the ones on this site,  so the user can see where they are in a document.  If you know of a good tutorial for this or dont mind helping me out that would be appreiciated  ;D

    thnx yet again
    Mark

    Flash-db

    • Administrator
    • Systems Administrator
    • *****
    • Posts: 1876
      • View Profile
      • Flash-db.com
    Re:Importing text from a text file
    « Reply #4 on: 01/30/02, 14:54 »
    Hey Mark,

    You can try to download the GuestBook tutorial and use the Scroll bar from their.  Their are a couple of numbers that you will have to change around to fit the area your scroll bar is located.  Also a couple numbers to change if you will be scrolling a really large area.

    I also attached a Zip file to this Post with a scroll Box and a basic setup for one.  I have yet to attach anything - but hopefully it will work.
    Flash-DB

    MarkEmerson

    • Server what's that
    • *
    • Posts: 44
    • Don't mind me, I'm new
      • MSN Messenger - Mark_Emerson83@Hotmail.com
      • AOL Instant Messenger - MarkEmerson83
      • View Profile
      • Email
    Re:Importing text from a text file
    « Reply #5 on: 01/31/02, 04:15 »
    Thanks Jeff the attachment worked great, and it helped me get my head round the concept.
    I'm now tring to work out how to update the scrollbar if the content is changed so that the size of the scrolbar reflects where abouts in the document you are viewing.  I have manged to do this with a first .txt file but as soon as I change the content, by using a button, the scrollbar stays the same.  I have only just started trying to do this so might be able to work it out.

    Thanks for your time
    Mark