2 Replies Latest reply on Jun 12, 2006 3:20 PM by Newsgroup_User

    XML and infinity text (k)

    Level 7
      I am brand new to XML and pulling in text to Flash from it. So far so
      good. The text shows. The only thing I'm having trouble with is the
      height of the text box the imported text sits in. I want it to
      dynamically expand if the text is long.

      How can I go about importing text into a text Dynamic text box and have
      the box expand if the text is too long for the manual setting?

      -Kirk
        • 1. Re: XML and infinity text (k)
          blemmo Level 1
          Check out the TextFormat class and its getTextExtent method. It calculates the size of a textfield for a given string and a given textfield width. With that, it's easy to resize or create a textbox with the right size.

          cheers,
          blemmo
          • 2. Re: XML and infinity text (k)
            Level 7
            Okay found this:
            [Dynamic Text Box Name].autoSize = "center";
            [Dynamic Text Box Name].wordWrap = true;

            however, the height really doesn't adjust when the copy does. If I start
            off with the dynamic text box at 50 pixels high, it remains that way
            when calculated in ActionScript using the [MovieClip]._height even
            though it is much taller than 50 pixels with the copy in there.

            So I'm back to the drawing board. I want to have an XML file with
            Headline, BodyCopy, and disclaimer copy. I want to call the nodes into
            Flash and stylize them.

            I DO NOT want to use CSS since I am using funky fonts that will not be
            available on all machines. Want those fonts embedded in Flash so it
            shows the same on any computer.

            -Kirk


            W. Kirk Lutz wrote:
            > I am brand new to XML and pulling in text to Flash from it. So far so
            > good. The text shows. The only thing I'm having trouble with is the
            > height of the text box the imported text sits in. I want it to
            > dynamically expand if the text is long.
            >
            > How can I go about importing text into a text Dynamic text box and have
            > the box expand if the text is too long for the manual setting?
            >
            > -Kirk