Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 26th, 2012  |  syntax: ActionScript 3  |  size: 2.88 KB  |  hits: 22  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. package
  2. {
  3.     import mx.states.State;
  4.  
  5.     import spark.components.LabelItemRenderer;
  6.  
  7.  
  8.     /**
  9.      *
  10.      * ASDoc comments for this item renderer class
  11.      *
  12.      */
  13.     public class TestSelectedStateItemRenderer extends LabelItemRenderer
  14.     {
  15.         public function TestSelectedStateItemRenderer()
  16.         {
  17.             //TODO: implement function
  18.             super();
  19.         }
  20.  
  21.         override public function set selected(value:Boolean):void
  22.         {
  23.             super.selected = value;
  24.             if(value)
  25.                 labelDisplay.setStyle("color",0x0000FF);
  26.             else
  27.                 labelDisplay.setStyle("color",0x00FF00);
  28.         }
  29.  
  30.         /**
  31.          * @private
  32.          *
  33.          * Override this setter to respond to data changes
  34.          */
  35.         override public function set data(value:Object):void
  36.         {
  37.             super.data = value;
  38.             // the data has changed.  push these changes down in to the
  39.             // subcomponents here              
  40.         }
  41.  
  42.         /**
  43.          * @private
  44.          *
  45.          * Override this method to create children for your item renderer
  46.          */    
  47.         override protected function createChildren():void
  48.         {
  49.             super.createChildren();
  50.             // create any additional children for your item renderer here
  51.         }
  52.  
  53.         /**
  54.          * @private
  55.          *
  56.          * Override this method to change how the item renderer
  57.          * sizes itself. For performance reasons, do not call
  58.          * super.measure() unless you need to.
  59.          */
  60.         override protected function measure():void
  61.         {
  62.             super.measure();
  63.             // measure all the subcomponents here and set measuredWidth, measuredHeight,
  64.             // measuredMinWidth, and measuredMinHeight                 
  65.         }
  66.  
  67.         /**
  68.          * @private
  69.          *
  70.          * Override this method to change how the background is drawn for
  71.          * item renderer.  For performance reasons, do not call
  72.          * super.drawBackground() if you do not need to.
  73.          */
  74.         override protected function drawBackground(unscaledWidth:Number,
  75.             unscaledHeight:Number):void
  76.         {
  77.             super.drawBackground(unscaledWidth, unscaledHeight);
  78.             // do any drawing for the background of the item renderer here                     
  79.         }
  80.  
  81.         /**
  82.          * @private
  83.          *
  84.          * Override this method to change how the background is drawn for this
  85.          * item renderer. For performance reasons, do not call
  86.          * super.layoutContents() if you do not need to.
  87.          */
  88.         override protected function layoutContents(unscaledWidth:Number,
  89.             unscaledHeight:Number):void
  90.         {
  91.             super.layoutContents(unscaledWidth, unscaledHeight);
  92.             // layout all the subcomponents here               
  93.         }
  94.  
  95.     }
  96. }