0 Replies Latest reply on Nov 3, 2006 8:47 AM by Newsgroup_User

    Resizing TextField objects problem

    Level 7
      Hi there,

      I am writing an AS3.0 application, which arranges TextField objects in a grid
      format. These may be of variable width and height, so each row/column works
      out how large it needs to be, by polling its contents for the largest
      width/height. (I was unable to find a pure AS3.0 object that does this sort of
      thing, but that's another story). The TextFields update over time, so their
      widths/heights change, and the grid dimensions with it. This is all working
      fine.

      However, what I am having a problem with, is I am trying to make the
      TextFields resize to fill the area of their "Cell" in the grid, if they are too
      small. This is because I am doing some highlighting with background/foreground
      colours, and want the effect to fill the whole cell. So for instance, if the
      Textfields in a column are 100, 100, 50 and 100 pixels wide, I want to make the
      50-pixel wide one 100 pixels wide as well, so if its background colour changes,
      it affects the same width as the rest of them and looks right :)

      If I try to force the TextField's width property, it doesn't cooperate very
      well - sometimes it simply ignores it (I guess the rendering tells it what to
      do). I currently have the autoSize feature turned to TextFieldAutoSize.LEFT so
      it trims off from the default (100,100) dimension. I understand this may be
      what is interfering with the resizing I am trying to do. However, with
      autoSize set to TextFieldAutoSize.NONE, it seems to resize the entire text
      object (eg if it is 10 pixels wide, resizing it to 80 pixels wide makes the
      text 8 times bigger!!), which is obviously not what I'm after.

      I'm trying to do this TextField resize so I can keep all the highlight
      formatting in one place (ie I can just set the TextField forground and
      background, rather than its foreground and call some other object to set the
      background). Does anyone have any tips how I can accomplish this resizing of
      the TextFields to fit in the grid structure?

      Thanks very much in advance! :)

      DavidW