4 Replies Latest reply on Sep 13, 2011 10:26 AM by Ned Murphy

    problem with array

    lalitha subramanian Level 1

      I have the sentence Like "Hai The problem with spliting the words" in array ,how i can get the width of each word in the array.I have the sentence like this more.

        • 1. Re: problem with array
          Ned Murphy Adobe Community Professional & MVP

          What do you mean when you say you want to know the width of each word in the array?  Words do not have a width until you write them out, and how wide they are depends on the font/size/styles (bold, italics,etc) you use.  So if that is the wdth you are talking about, then you will need to write each word out separately in a TextField and measure its width using the TextField's textWidth property (which indicates pixels).

          1 person found this helpful
          • 2. Re: problem with array
            Ron Colmen Level 2

            I think he is expecting something like this?

             

            sometext="Is this it?";
            var words:Array = sometext.split(" ");
            //trace (sometext.length);
            //or
            //trace(words.length);

            • 3. Re: problem with array
              lalitha subramanian Level 1

              sorry my question was wrong i am trying do this.i have the text in flash file as a static text.i have created one movieclip over the starting text of the paragraph.

              then based on the audio pronuncing i have to move the highlight.i was trying to find the width of each text ,so based on that i can increase the width of movieclip.

              text.jpg

              • 4. Re: problem with array
                Ned Murphy Adobe Community Professional & MVP

                Your question was worded correctly, Ron's interpretation was incorrect.  As I already indicated, if you want to know the width of the text, what you can do is write the word into a separate textfield and use the textWidth property of the textfield to determine hw wide the word is.

                 

                othertextfield.text = "Hai";

                highlight._width = othertextfield.textWidth;

                1 person found this helpful