2 Replies Latest reply on Feb 6, 2007 3:39 PM by khaledk

    Applying effects between states

      Hi all,

      I have tried to minimize the first panel before I go to next state but I got the following problem message:

      TypeError: Error #1034: Type Coercion failed: cannot convert "panel1" to mx.core.IUIComponent.
      at mx.effects::Effect/captureStartValues()
      at mx.core::UIComponent/::commitCurrentState()
      at mx.core::UIComponent/setCurrentState()
      at mx.core::UIComponent/set currentState()
      at Test9/___Button1_click()

      Here is my simple code:

      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" layout="absolute" currentState="LoginState">

      <mx:State name="LoginState">
      <mx:AddChild position="lastChild">
      <mx:Panel width="250" height="200" layout="absolute" horizontalCenter="0" verticalCenter="-20" id="panel1">
      <mx:Button x="155" y="128" label="Button" click="application.currentState='NavigationState'"/>
      <mx:State name="NavigationState">
      <mx:AddChild position="lastChild">
      <mx:VBox id="panel2">
      <mx:MenuBar id="menu" y="10" right="10" left="10" />

      <mx:Transition fromState="*" toState="NavigationState">
      <mx:Resize duration="400" heightTo="0" widthTo="0" target="{panel1}" />


      Thanks in advance.
        • 1. Re: Applying effects between states
          khaledk Level 1
          It is seem that I forgot to add kerlly bracket to the target, but I have got another problem, there is no effect.
          When I click the button, the application will move to the next stage without any effects. Whats the problem ?
          • 2. Re: Applying effects between states
            khaledk Level 1
            I think I have found the answer for my question. Because my states is based on application component, so any effects will apply on the main application in total and I want it just for the panel (I hope I am right about this).

            For now everything is fine but I will need to add some components to the a specific state programmatically. I wonder how can I do that? I have tried to identify that state by id property but I did not find any method like addChild within that state or lets say in state component in general.