Change control color in State : State « Effects « Flex






Change control color in State

Change control color in State
          


<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
    <mx:states>
        <mx:State name="landState">
            <mx:SetStyle target="{aa}" name="color" value="0xFF0000" />
            <mx:SetStyle target="{b}" name="color" value="0xFF0000" />
            <mx:SetStyle target="{c}" name="color" value="0xFF0000" />
        </mx:State>
        <mx:State name="airState">
            <mx:SetStyle target="{d}" name="color" value="0xFF0000" />
            <mx:SetStyle target="{e}" name="color" value="0xFF0000" />
        </mx:State>
    </mx:states>
    <mx:VBox id="vbox">
        <mx:HBox>
            <mx:Button id="land" label="ABC" click="currentState='landState'" />
            <mx:Button id="air" label="DE" click="currentState='airState'" />
        </mx:HBox>
        <mx:CheckBox id="aa" label="A" />
        <mx:CheckBox id="b" label="B" />
        <mx:CheckBox id="c" label="C" />
        <mx:CheckBox id="d" label="D" />
        <mx:CheckBox id="e" label="E" />
    </mx:VBox>
</mx:Application>

   
    
    
    
    
    
    
    
    
    
  








Related examples in the same category

1.Add child to StateAdd child to State
2.Add child before in a StateAdd child before in a State
3.Add child to position in a StateAdd child to position in a State
4.Add or remove childrenAdd or remove children
5.Using different creation policiesUsing different creation policies
6.Setting overrides on component propertiesSetting overrides on component properties
7.Change the enabled property for two Button controls, setting one false, and the other trueChange the enabled property for two Button controls, setting one false, and the other true
8.View defining two states
9.View StatesView States
10.Setting event handlers with StateSetting event handlers with State
11.Change control property in state changingChange control property in state changing
12.Remove a child in state changingRemove a child in state changing
13.Create State based on existing StateCreate State based on existing State
14.Set current state to nullSet current state to null
15.Add child relative to an existing control in StateAdd child relative to an existing control in State
16.Use two statements in click event inlineUse two statements in click event inline
17.Add child and change property when state changedAdd child and change property when state changed
18.Change view stateChange view state
19.Creating a simple view stateCreating a simple view state
20.Set Transition stateSet Transition state
21.Two statements in the click attributeTwo statements in the click attribute
22.Adding and removing components with StateAdding and removing components with State
23.Adding and removing components by changing stateAdding and removing components by changing state
24.Adding and removing components in State with RemoveChildAdding and removing components in State with RemoveChild
25.Applying statesApplying states
26.Using states to control the display of the popup component.Using states to control the display of the popup component.
27.Validate either a United States ZIP code or a Canadian postal codeValidate either a United States ZIP code or a Canadian postal code
28.Define StatesDefine States
29.States Event HandlersStates Event Handlers
30.States Includes and ExcludesStates Includes and Excludes
31.Deferred view state, and you cannot access it until after the first switch to the Deferred view stateDeferred view state, and you cannot access it until after the first switch to the Deferred view state
32.Use the Reset button to restore the collection view to its original state.Use the Reset button to restore the collection view to its original state.