2010-06-27 4 views

Répondre

1

Vous devez créer un rendu d'élément avec le GlowFilter construit dans Voici un exemple:.

Mon application:

<?xml version="1.0" encoding="utf-8"?> 
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" 
       xmlns:s="library://ns.adobe.com/flex/spark" 
       xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600"> 

    <fx:Declarations> 
     <s:ArrayCollection id="dataProvider"> 
      <fx:Object name="Red" color="0xFF0000" /> 
      <fx:Object name="Green" color="0x00FF00" /> 
      <fx:Object name="Blue" color="0x0000FF" /> 
     </s:ArrayCollection> 
    </fx:Declarations> 

    <mx:DataGrid itemRenderer="GlowingRenderer" dataProvider="{dataProvider}" /> 


</s:Application> 

... et voici GlowingRenderer.mxml:

<?xml version="1.0" encoding="utf-8"?> 
<s:MXDataGridItemRenderer xmlns:fx="http://ns.adobe.com/mxml/2009" 
          xmlns:s="library://ns.adobe.com/flex/spark" 
          xmlns:mx="library://ns.adobe.com/flex/mx" 
          focusEnabled="true" creationComplete="trace(this.data)"> 

    <fx:Script> 
     <![CDATA[ 
      import spark.filters.GlowFilter; 
     ]]> 
    </fx:Script> 

    <s:Label id="lblData" top="0" left="0" right="0" bottom="0" text="{dataGridListData.label}" filters="{[new GlowFilter(this.data.color)]}" /> 
</s:MXDataGridItemRenderer> 

Ne semble pas trop beau, mais fait le travail :)

simon

+0

welp j'avais raison. – ufk

Questions connexes