Change the enabled property for two Button controls, setting one false, and the other true : State « Effects « Flex






Change the enabled property for two Button controls, setting one false, and the other true

Change the enabled property for two Button controls, setting one false, and the other true
            
<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
  <mx:states>
    <mx:State name="NewButton">
      <mx:AddChild relativeTo="{v1}">
        <mx:Button id="b3" label="New Button" />
      </mx:AddChild>
      <mx:SetProperty target="{b1}" name="enabled" value="false" />
      <mx:SetProperty target="{b2}" name="enabled" value="true" />
    </mx:State>
  </mx:states>
  <mx:VBox id="v1">
    <mx:Button id="b1" />
    <mx:Button id="b2" enabled="false" />
    <mx:Button label="Change to NewButton state" click="currentState = 'NewButton';" />
    <mx:Button label="Change to base view state" click="currentState = '';" />
  </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.View defining two states
8.View StatesView States
9.Setting event handlers with StateSetting event handlers with State
10.Change control property in state changingChange control property in state changing
11.Remove a child in state changingRemove a child in state changing
12.Create State based on existing StateCreate State based on existing State
13.Set current state to nullSet current state to null
14.Change control color in StateChange control color in State
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.