2 Replies Latest reply on Sep 21, 2010 6:03 PM by w.johnson

    Can we add Text to UIComponent ???

      Hi All,

      I am creating a application in which I am drawing Rectangle, Line, Ellipse, etc. with UIComponent.graphics methods.

      Now if I want to write some text in this UIComponent is it possible ?

      Or can we bind a Text Area with a UIComponent ??

      Please Help,
      Thanks in Advance.
        • 1. Re: Can we add Text to UIComponent ???
          buabco Level 1
          I had the same problem, since the UIComponent is not a container it has no measure and layout functions in it. I was able to add a Label component into it but it was a pain to resize it so the text will actually show correctly.

          Finally I desided to use a normal TextField and the TextLineMetrics and some code of my own to correctly size and position the textField where I wanted.

          To add any Object to the UIComponent just override the createChildren method, and add to the stage the extra elements.

          To layout this elements within the UIComponent override the updateDisplayList method.
          • 2. Re: Can we add Text to UIComponent ???

            I have the same question but don't want to resort to a text object model because I'm panning and zooming through hundreds of data values (numbers) that need to be rendered quickly if the user wants to see them.


            What I want is similar to the approach suggested here:


            .beginFill(0, 1);
            new Arial(10.0).print("0.78", 100, 100);


            without all the external libraries. Is there a way to do this with what comes with FB4?