SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    SitePoint Zealot
    Join Date
    Jan 2003
    Location
    New York, NY
    Posts
    125
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Glitch loading text from external txt file

    I am trying to load text from an external txt file into an area of my flash mx movie. I created a new layer and used the text tool to draw a text box, then gave it the variable name "welcomeMsg". I specified it as being multiline dynamic text. Then I gave the first frame of the layer the following actionscript:

    loadVariablesNum("welcome.txt", 0);

    When I test the movie, the text loads into the box, but it gets cut off when it reaches the width of the text box instead of wrapping and expanding the height of the box.

    I tried to insert \n characters into the text file, but flash just displayed "\n".

    I also tried to use the free transform tool to make the text box bigger, but that just caused the size of the font characters to scale very large.
    So I says to him, I says, Hey! Llama! How about a little something, you know, for the effort, you know?

  2. #2
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Make the text box multiline

  3. #3
    SitePoint Zealot
    Join Date
    Jan 2003
    Location
    New York, NY
    Posts
    125
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I did. That's why this glitch is giving me trouble.
    So I says to him, I says, Hey! Llama! How about a little something, you know, for the effort, you know?

  4. #4
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Okay then let's do this the right way. Take the variable name away from the text field and give it an instance name instead. Let's call it myText. Now use LoadVars to load the text and use actionscript to set the wordWrap property of the text field.
    Code:
    myText.wordWrap = true;
    myVars = new LoadVars();
    myVars.load("welcome.txt");
    myVars.onLoad = function() {
      myText.text = this.welcomeMsg;
    }

  5. #5
    SitePoint Zealot
    Join Date
    Jan 2003
    Location
    New York, NY
    Posts
    125
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I still get the exact same display error.

    I followed your instructions to the T; the text box is set to dynamic multiline, and has the instance name 'welcome'. I put the following actionscript in the first frame of the layer that contains the text box:

    Code:
    welcome.wordWrap = true;
    myVars = new LoadVars();
    myVars.load("welcome.txt");
    myVars.onLoad = function() {
     welcome.text = this.welcomeMsg;
    }
    So I says to him, I says, Hey! Llama! How about a little something, you know, for the effort, you know?

  6. #6
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Not too sure why you are having a problem. I have attached a sample of this which works.
    Attached Files Attached Files

  7. #7
    SitePoint Zealot
    Join Date
    Jan 2003
    Location
    New York, NY
    Posts
    125
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I actually just got it to work. I'm not sure what I did, whatever it was, it did it. Thanks.
    So I says to him, I says, Hey! Llama! How about a little something, you know, for the effort, you know?


Bookmarks

Posting Permissions

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