Bonjour,

Je voudrais mettre un degradé de couleur, en couleur de fond de ma panel.
LA propriété "backGroundGradientColors" n'existant pas pour un panelj 'ai essayé de faire une extension de la classe mais cela ne fonctionne pas.
Voicile code du package :
Code : 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
69
 
package  com.tiria.components
{
 
 
	import mx.containers.Panel;
    import mx.styles.StyleManager;
    import mx.styles.CSSStyleDeclaration;
    import flash.display.GradientType;
    import mx.controls.Alert;
 
    [Style(name="backgroundGradientColors",type="Array",format="Color",inherit="no")]
 
    public class superPanel extends Panel
    {
        private static var inited:Boolean = initStyle();
        private var bBackgroundGradientColorsChanged:Boolean = true;
        private var colors:Array = [];
 
        public function superPanel() {
            super();
        }
 
        protected override function measure():void {
            super.measure();
 
            measuredWidth = measuredMinWidth = 100;
            measuredHeight = measuredMinHeight = 100;
        }
 
        override public function styleChanged(styleProp:String):void {
            super.styleChanged(styleProp);
 
            if (styleProp == "backgroundGradientColors") 
            {
                bBackgroundGradientColorsChanged=true; 
                invalidateDisplayList();
                return;
            }
        }
 
        override protected function updateDisplayList(unscaledWidth:Number,
                unscaledHeight:Number):void {
            super.updateDisplayList(unscaledWidth, unscaledHeight);
            trace("updateDisplayList");
 
            if (bBackgroundGradientColorsChanged) {
                colors = getStyle("backgroundGradientColors");
 
                graphics.beginGradientFill(GradientType.LINEAR, 
                    colors, [1.0,1.0], [0x00,0xFF]);  
                graphics.drawRect(0, 0, unscaledWidth, unscaledHeight);
                graphics.endFill();
            }
        }
 
        private static function initStyle():Boolean {
            trace("init");
            if(!StyleManager.getStyleDeclaration("superPanel")) {
                var monStyle:CSSStyleDeclaration = new CSSStyleDeclaration();
                monStyle.setStyle("backgroundGradientColors",[0x8080ff, 0xc0c0c0]);
                StyleManager.setStyleDeclaration("superPanel",monStyle,true);
            }
 
            return true;
        }
    }
 
}
Voici comment je l'appelle dans mon fichier mxml :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
 
<comps:superPanel x="10" y="0" width="264" height="494" layout="absolute"  id="SuperPanelListMenu" title="Menu Existant" backgroundGradientColors="[color1,color2]" />
Lorsque je fais ca le background de ma panel ne change pas, alors si quelqu'un peut m'aider à trouver l'erreur?
Merci,