1 Reply Latest reply on Oct 11, 2007 10:14 AM by donynam

    Flash 2.0 Datagrid component bug ?

    donynam
      Recently I found a bug in Datagrid component. The swf file which contain datagrid act differely in IE 6, and IE 7.
      This is what I've done:
      1) Compile swf, export it together with html file.
      2) Run the html file
      3)Press on one of the cell,drag it and then release it outside of the browser/flash canvas.
      4)Move the mouse pointer back to flash canvas
      5)The grid will scroll automatically( move the move up and down to test)
      6)After a few times mouse pointer movement, suddenly IE crash, CPU usage 100%

      I have tested the swf file on firefox 2.007 and stand alone flash player, however, none of the flash player have this bug. Therefore I suspect that the ActiveX flash plugin for IE cause this bug.

      ----------------------------------------------------------------------------------------- -----------------------------

      This is the source code, which I use to create the datagrid for testing.
      ps: open one fla file, drag datagrid component from component panel to the stage or it will not run.

      import mx.controls.DataGrid;

      var header = "Stock Code/\nName,Type,Status,Order Date\nTime,Duration,OrderQty/\nPrice,Matched Qty/\nPrice,Trd Curr/\nMatched Value,Account No/\nOrder No";
      var wid = "90,43.2699356842522,91.5969497381748,87.4747020181826,60.4473499934867,67.9851014914014, 90.2231829093762,111.8984058876167,134.104372277509";
      var alig = "left ,left, left , left , left , right , right , right , left ";
      var halig = "center ,center,center , center , center , center , center , center , center ";
      var fxdata:Array = new Array();
      fxdata[0]= new Array("67676 GPACKET","Buy","Expired","05/09/2007 06:04:20 PM","Day","200 4.34","0 0.00","MYR 0.00","423423423432");
      fxdata[1]= new Array("054066 FASTRAK","Buy","Expired","05/09/2007 01:45:18 PM","Day","47,900 0.27","0 0.00","MYR 0.00","fdsfsdfsdf");
      fxdata[2]= new Array("737013 HUBLINE","Sell","Expired","05/09/2007 11:53:19 AM","Day","400 0.69","0 0.00","MYR 0.00","93743");
      fxdata[3]= new Array("31474 L&G","Buy","Expired","03/09/2007 11:35:35 AM","Day","500 0.70","0 0.00","MYR 0.00","389dskjfsd");
      fxdata[4]= new Array("38182 GENTING","Buy","Expired","28/08/2007 11:38:59 AM","Day","500 7.35","0 0.00","MYR 0.00","90sklsdakl");
      fxdata[5]= new Array("05005 PALETTE","Buy","Expired","28/08/2007 11:08:23 AM","Day","500 0.115","0 0.00","MYR 0.00","jsdaflk;as");
      fxdata[6]= new Array("093082 GPACKET","Buy","Expired","27/08/2007 03:49:43 PM","Day","300 3.82","0 0.00","MYR 0.00","jsdafj;sda");
      fxdata[7]= new Array("644769 KELADI","Buy","Expired","27/08/2007 11:05:36 AM","Day","10,000 0.30","0 0.00","MYR 0.00","jsadjf;lkdas");
      fxdata[8]= new Array("676653 KASSETS","Buy","Expired","24/08/2007 06:15:33 PM","Day","500 2.93","0 0.00","MYR 0.00","jlsdf;adas");
      fxdata[9]= new Array("473323 JAKS","Buy","Expired","23/08/2007 04:45:03 PM","Day","100 0.915","0 0.00","MYR 0.00","jjkljsdlfasd");
      fxdata[10]= new Array("03069 IPOWER","Buy","Expired","22/08/2007 10:18:01 AM","Day","9,800 0.365","0 0.00","MYR 0.00","jlajsd;lfjads");
      fxdata[11]= new Array("05025 LNGRES","Buy","Expired","21/08/2007 03:08:06 PM","Day","9,900 0.28","0 0.00","MYR 0.00","jlkjsdafl");
      fxdata[12]= new Array("01308 N2N","Buy","Expired","21/08/2007 10:34:51 AM","Day","200 1.71","0 0.00","MYR 0.00","mjkjadsflasd");
      fxdata[13]= new Array("70069 IPOWER","Buy","Cancelled","21/08/2007 10:02:08 AM","Day","0 0.37","0 0.00","MYR 0.00","jkjasd;fsda");
      fxdata[14]= new Array("03069 IPOWER","Buy","Cancelled","20/08/2007 07:20:54 PM","Day","0 0.38","0 0.00","MYR 0.00","jkjsdlkfjsdaf");
      fxdata[15]= new Array("12651 MRCB","Buy","Replaced","20/08/2007 05:31:59 PM","Day","900 2.35","0 0.00","MYR 0.00","upuewoirwe");

      var mdtgrid:DataGrid;

      _root.createEmptyMovieClip("displayobj1", _root.getNextHighestDepth(),{_x:0,_y:0});
      initial();
      function initial(){
      _root.mdtgrid = _root.createClassObject(mx.controls.DataGrid, "xxx", _root.getNextHighestDepth());
      _root.mdtgrid.doLater(_root,"setData");
      }

      function setData(){ //insert data to datagrid
      var temp:Array = new Array();
      for (var i in _root.fxdata){
      temp = new Object();
      for (var j in _root.fxdata
      ){
      temp [j] = _root.fxdata[j];
      }
      }
      _root.mdtgrid.dataProvider =temp;
      _root.mdtgrid.doLater(_root,"setdgStyle");
      }

      function setdgStyle(){
      var rowhight = 40;
      var noofrow = 8;
      var headerheight = 35;
      var gridheight = (rowhight * noofrow) + headerheight ;
      _root.mdtgrid.setSize(800, gridheight);
      _root.mdtgrid.rowHeight =rowhight;
      _root.setHeader(_root.header.split(","));
      _root.setWidth(_root.wid.split(","));
      _root.setAlign(_root.alig.split(","));
      _root.mdtgrid.invalidate();
      }

      function setHeader(datasource:Array){ //set header label
      var leng:Number = _root.mdtgrid.columnCount;
      var sleng:Number = datasource.length;
      var temp:Object;
      for (i =0 ;i<leng;i++){
      if (i>=sleng){
      break;
      }
      _root.mdtgrid.getColumnAt(i).headerText = datasource ;
      }
      }

      function setWidth(datasource:Array){ //set columns width
      var leng:Number = _root.mdtgrid.columnCount;
      var sleng:Number = datasource.length;
      var temp:Object;
      for (i =0 ;i<leng;i++){
      if (i>=sleng){
      break;
      }
      _root.mdtgrid.getColumnAt(i).width = Number(datasource
      );
      }
      }
      function setAlign(datasource:Array){ //set Alignment
      var leng:Number = _root.mdtgrid.columnCount;
      var sleng:Number = datasource.length;
      var temp:Object;

      for (i =0 ;i<leng;i++){
      if (i>=sleng){
      break;
      }
      temp = _root.mdtgrid.getColumnAt(i);
      temp.setStyle("textAlign",trim(datasource ));
      }
      }