0 Replies Latest reply on Feb 6, 2011 10:14 PM by jfillman

    Set Spark TabBar ItemRenderer State

    jfillman

      I have a custom ItemRenderer for a tabBar and I need to be able to control the state of each itemRenderer on the tabBar individually. For example, if a change is made to the data in one of the tabs, I want to change the display of the tab to the "unsaved" state, so that a user has a visual cue when there are usaved edits.

       

       

       

      <?xml version="1.0" encoding="utf-8"?>

      <s:ItemRenderer

       

      xmlns:fx="http://ns.adobe.com/mxml/2009"

      xmlns:s="

      library://ns.adobe.com/flex/spark"

      xmlns:mx="

      library://ns.adobe.com/flex/mx"

      top="

      2" width="200" height="34" autoDrawBackground="false" buttonMode="true">

       

       

      <s:states>

       

      <s:State name="normal"/>

       

      <s:State name="selected"/>

       

      <s:State name="hovered"/>

       

      <s:State name="unsaved"/>

       

      </s:states>

       

       

      <!-- background -->

       

       

      <s:Rect left="1" right="1" top="1" bottom="0" radiusX="5" radiusY="5">

       

      <s:fill>

       

      <s:LinearGradient rotation="90">

       

      <s:GradientEntry color="0xffffff"/>

       

      <s:GradientEntry color="0xd8d8d8" alpha="0.85" color.selected="0xf76a6a" alpha.selected="1.0" color.hovered="0x929496" alpha.hovered="0.85"/>

       

      </s:LinearGradient>

       

      </s:fill>

       

      </s:Rect>

       

       

      <!-- border rectangle -->

       

       

      <s:Line left="0" right="0" top="1">

       

      <s:stroke>

       

      <s:SolidColorStroke weight="1" alpha="1.0" color="0x999999"/>

       

      </s:stroke>

       

      </s:Line>

       

       

      <s:Line left="0" bottom="0" top="1">

       

      <s:stroke>

       

      <s:SolidColorStroke weight="1" alpha="1.0" color="0x999999"/>

       

      </s:stroke>

       

      </s:Line>

       

       

      <s:Line right="0" bottom="0" top="1">

       

      <s:stroke>

       

      <s:SolidColorStroke weight="1" alpha="1.0" color="0x999999"/>

       

      </s:stroke>

       

      </s:Line>

       

       

      <s:Line left="0" right="0" bottom="0">

       

      <s:stroke>

       

      <s:SolidColorStroke weight="1" alpha="1.0" color="0x999999" alpha.selected="0.0" color.selected="0xffffff"/>

       

      </s:stroke>

       

      </s:Line>

       

       

      <s:Label left="4" right="20" fontSize="14" text="{data.LastName}, {data.FirstName}"

      verticalCenter="

      0"/>

       

      <s:Label id="closePtX" right="5" top="5" fontSize="14" fontWeight="bold" text="x"/>

      </s:ItemRenderer>