0 Replies Latest reply on Jun 23, 2009 10:12 PM by mandar1980

    Flahs CS3 Datagrid Dynamically align Header Text




      I am getting problem with Flash CS3 Datagrid. I am not able to align Header Text dynamically. Can any one sujest How to set Text Alignment dynamically. I want align first header column Text "left align" and rest of the columns Text are "right align".


      My code as bellow but it is not working


      .as code


      package {


          import fl.controls.dataGridClasses.HeaderRenderer;
          import flash.text.TextFormat;
          public class headerRender extends HeaderRenderer {
              public var headerTxt :TextFormat;
              public function headerRender()
                  headerTxt = new TextFormat();
                  headerTxt.font =  "Verdana";
                  headerTxt.color = 0x000000;
                  headerTxt.align = "right";
                  headerTxt.size = 11;
                  setStyle("textFormat", headerTxt);




      FLA code


      import fl.controls.DataGrid;
      import MyCellRenderer;
      import fl.data.DataProvider;
      import fl.managers.StyleManager
      import fl.controls.dataGridClasses.DataGridColumn;



      var dp:DataProvider = new DataProvider();
      dp.addItem({label:"Item a", data:0});
      dp.addItem({label:"Item b", data:1});
      dp.addItem({label:"Item c", data:2});
      dp.addItem({label:"Item d", data:3});
      dp.addItem({label:"Item e", data:4});
      dp.addItem({label:"Item f", data:5});
      dp.addItem({label:"Item g", data:6});
      dp.addItem({label:"Item h", data:7});
      dp.addItem({label:"Item i", data:8});
      dp.addItem({label:"Item j", data:9});


      var myDataGrid:DataGrid = new DataGrid();
      myDataGrid.dataProvider = dp;
      myDataGrid.width = 200;
      myDataGrid.rowCount = dp.length;
      myDataGrid.move(10, 10);


      //set second header colum right align

      myDataGrid.getColumnAt(1).headerRenderer = headerRenders;




      Please let me know where I am wrong


      Mandar Mukadam

      Sr. Multimedia Developer