J'avais signalé il y a quelque temps, dans un post d'humeur, un bug dans le SDK Flex au niveau du composant AdvancedDataGrid.
Si une valeur est affectée à la propriété backgroundColor d'une colonne (AdvancedDataGridColumn), il se produit une erreur d'exécution au moment où l'application est réduite (mode AIR, je n'ai pas testé en mode web).

Au cas où cela intéresse quelqu'un voici une solution pour contourner ce bug :

Définir une nouvelle classe dérivée de AdvancedDataGrid et surchargée la méthode drawColumnBackground :

Code flex : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
package fr.proxiflex.flex.controls
{
    import flash.display.Sprite;
 
    import mx.controls.AdvancedDataGrid;
    import mx.controls.advancedDataGridClasses.AdvancedDataGridColumn;
 
    public class PXADG extends AdvancedDataGrid
    {
 
        override protected function drawColumnBackground(s:Sprite, columnIndex:int,
            color:uint, column:AdvancedDataGridColumn):void
        {
            if ( rowInfo
[listItems.length - 1] != null )
                  super.drawColorBackground( s, columnindex, color, column ) ;
            }
    }
}
Si vous souhaitez par ailleurs pouvoir utiliser la transparence dans ce cas (ce que ne propose pas le composant par défaut) il est possible de profiter de l'occasion pour ajouter cette possibilité. La transparence est codée dans la propriété backgroundColor dans l'octet de poids fort, la couleur étant codée sur les 3 autres octets :

Code flex : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
package fr.proxiflex.flex.controls
{
    import flash.display.Graphics;
    import flash.display.Shape;
    import flash.display.Sprite;
 
    import mx.controls.AdvancedDataGrid;
    import mx.controls.advancedDataGridClasses.AdvancedDataGridColumn;
    import mx.controls.advancedDataGridClasses.AdvancedDataGridHeaderInfo;
    import mx.core.FlexShape;
    import mx.core.mx_internal;
 
    use namespace mx_internal ;
 
    public class PXADG extends AdvancedDataGrid
    {
 
        override protected function drawColumnBackground(s:Sprite, columnIndex:int,
            color:uint, column:AdvancedDataGridColumn):void
        {
            var background:Shape;
            background = Shape(s.getChildByName(columnIndex.toString()));
            if (!background)
            {
                background = new FlexShape();
                s.addChild(background);
                background.name = columnIndex.toString();
            }
 
            var g:Graphics = background.graphics;
            g.clear();
 
            if(columnIndex >= lockedColumnCount && 
               columnIndex < lockedColumnCount + horizontalScrollPosition)
                return;
 
            // PX: ajout transparence (octet de poids fort de backgroundColor) 
            //g.beginFill(color);
            g.beginFill( color & 0xffffff, ( color >> 24 ) / 100 ) ;
 
            var lastRow:Object = rowInfo
[listItems.length - 1];
            var headerInfo:AdvancedDataGridHeaderInfo = getHeaderInfo(getOptimumColumns()[columnIndex]);
            var xx:Number = headerInfo.headerItem.x;
            if(columnIndex >= lockedColumnCount)
                xx = getAdjustedXPos(xx);
            var yy:Number = headerRowInfo[0].y;
 
            if (headerVisible)
                yy += headerRowInfo[0].height;
 
            // BUG: lastRow est null quand on réduit l'application (dans AIR au moins)
            var height : Number = listContent.height - yy ;
            if ( lastRow != null )
            {
            // Height is usually as tall is the items in the row, but not if
            // it would extend below the bottom of listContent
                height = Math.min(lastRow.y + lastRow.height, height);
            }
 
            g.drawRect(xx, yy, headerInfo.headerItem.width,
                       listContent.height - yy);
            g.endFill();            
 
        }
 
    }
}