Change control property in state changing : State « Effects « Flex






Change control property in state changing

Change control property in state changing
          

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
    layout="absolute">
    <mx:Script>
        
        import mx.effects.easing.Bounce;
      
    </mx:Script>
    <mx:states>
        <mx:State name="bookDetails" basedOn="">
            <mx:AddChild relativeTo="{bookForm}" position="lastChild" creationPolicy="all">
                <mx:FormItem id="isbn" label="new Label" />
            </mx:AddChild>
            <mx:SetProperty target="{title}" name="text" value="New Details" />
            <mx:RemoveChild target="{bookLink}" />
        </mx:State>
    </mx:states>
    <mx:transitions>
        <mx:Transition fromState="*" toState="*">
            <mx:Parallel targets="{[book, bookLink, title, isbn]}">
                <mx:Resize duration="5000" easingFunction="Bounce.easeOut" />
            </mx:Parallel>
        </mx:Transition>
    </mx:transitions>
    <mx:Panel title="XML Book" id="book" horizontalScrollPolicy="off" verticalScrollPolicy="off">
        <mx:Form id="bookForm">
            <mx:FormItem label="Label 1" fontWeight="bold" /> 
            <mx:FormItem label="Label 2" fontStyle="italic" />
        </mx:Form>
        <mx:ControlBar>
            <mx:LinkButton label="Click" id="bookLink" click="currentState = 'bookDetails' " />
            <mx:Spacer width="100%" id="spacer1" />
            <mx:Label text="Title" id="title" />
        </mx:ControlBar>
    </mx:Panel>
</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.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.