2 Replies Latest reply on Aug 19, 2008 7:27 AM by Dmitry Sergeev

    Class object from XML.

    Dmitry Sergeev
      Hi.
      I want to create DataGrid with itemReneder for each column.

      This is inline generated itemRenderer:
      DataGridColumn.itemRenderer = new ClassFactory(MyCustomClass);
      // MyCustomClass - it manually generated class which contains some form items(TextInput, Combox..e.t.c.)

      I want to consturct ItemRenderer dynamicly. For this i need to create Class object and send it to itemRenderer:
      var component:DynamicFormClass = new DynamicFormClass();
      var newComponent:Class = component.someMethodWhichWillCreateForm(configData); // - this will return Class which will generate form items that described in configData
      DatagridColumn.itemRenderer = new ClassFactory(newComponent);

      This code is how i see solvetion of this problem, but this doesnt work.
      I really don't know how it to create and will be very thankful for any dicision and answers how to make it.
      Thank you.


        • 1. Re: Class object from XML.
          Level 7

          "Dmitry Sergeev" <webforumsuser@macromedia.com> wrote in message
          news:g8eghj$881$1@forums.macromedia.com...
          > Hi.
          > I want to create DataGrid with itemReneder for each column.
          >
          > This is inline generated itemRenderer:
          > DataGridColumn.itemRenderer = new ClassFactory(MyCustomClass);
          > // MyCustomClass - it manually generated class which contains some form
          > items(TextInput, Combox..e.t.c.)
          >
          > I want to consturct ItemRenderer dynamicly. For this i need to create
          > Class
          > object and send it to itemRenderer:
          > var component:DynamicFormClass = new DynamicFormClass();
          > var newComponent:Class =
          > component.someMethodWhichWillCreateForm(configData);
          > // - this will return Class which will generate form items that described
          > in
          > configData
          > DatagridColumn.itemRenderer = new ClassFactory(newComponent);


          Use getDefinitionByName and ClassFactory to dynamically create your class.
          Just be sure that you actually have at least one "hard" reference to each
          class you intend to use, or the class might not get compiled into your swf.
          Here's a full write-up of how to do that:
          http://www.paulofierro.com/archives/520/



          HTH;



          Amy


          • 2. Re: Class object from XML.
            Dmitry Sergeev Level 1
            Amy Blankenship thank you for answer, it's not what i need. I found answer on this question: it's override DataGrid set ItemRenderer method.