1 Reply Latest reply on Aug 11, 2008 8:03 AM by Newsgroup_User

    Cyclically changing label in datagrid

    flexgent
      I am a flex newbie, so excuse me :)

      I have created an MXML component which extends from Label. The purpose is as follows. It will be used as an itemrenderer in a DataGrid to cycle through multiple values. This is controlled by the texts property

      If texts has a single value, the label text will remain

      If texts has more than a single value, each of the values will appear and then disappear

      All multilabels will cycle their text synchronously, ie. they all share the same effect


      The concept works well in general, but when the data of the grid changes (rows can get inserted, added, deleted etc), I get all kinds of problems

      Some labels disappear

      Some labels appear twice


      The typical usage scenario is :

      MultiLabel.clearAll();
      // code to update the data grids model
      MultiLabel.startAll();

      Can someone tell me what I am doing wrong? Or, is there a better way to do this?
        • 1. Re: Cyclically changing label in datagrid
          Level 7

          "flexgent" <webforumsuser@macromedia.com> wrote in message
          news:g7pcpt$9t3$1@forums.macromedia.com...
          >I am a flex newbie, so excuse me :)
          >
          > I have created an MXML component which extends from Label. The purpose is
          > as
          > follows. It will be used as an itemrenderer in a DataGrid to cycle through
          > multiple values. This is controlled by the texts property
          >
          >
          If texts has a single value, the label text will remain

          >
          If texts has more than a single value, each of the values will
          > appear
          > and then disappear

          >
          All multilabels will cycle their text synchronously, ie. they all
          > share the same effect

          >
          > The concept works well in general, but when the data of the grid changes
          > (rows
          > can get inserted, added, deleted etc), I get all kinds of problems
          >
          >
          Some labels disappear

          >
          Some labels appear twice

          >
          > The typical usage scenario is :
          >
          > MultiLabel.clearAll();
          > // code to update the data grids model
          > MultiLabel.startAll();
          >
          > Can someone tell me what I am doing wrong? Or, is there a better way to do
          > this?

          I don't see anything in your itemRenderer code that reacts to a change in
          data or listData.

          http://blogs.adobe.com/aharui/2007/03/thinking_about_item_renderers_1.html
          http://blogs.adobe.com/aharui/2007/04/more_thinking_about_item_rende.html