1 Reply Latest reply on Jun 22, 2007 6:44 PM by Nic01as

    newbie questions about stage.width, removePopUp and transitions

    Nic01as
      i'm a newbie to flex, the questions are:

      1. in the <mx:application creationComplete="creationCompleteHandler();" and i implement function creationcompleteHanlder like this:

      private funciton creationCompleteHandler():void {
      // here i want position the specified component to a new location, but it doesnt work.
      someComponent.x = stage.width - someComponent.width;
      }

      when i run the app, it'll show the error sth about object is null, why i cant use the stage.width property?

      2. by using the PopUpManager.removePopUp method to remove a popup window, if i wanna add an effect such as wipedown
      to it, how can i? all that i do just get the same result, the popup win closed immediately. :(

      3.i define a state named 'login' and transition to it, its ok and show the wipedown effect when i click the login button(from base state to the 'login' state), but when i want switch back to the base state, i've defined another effect of 'wipeup' to it, it doesnt work.
      here is the code:

      <mx:states>
      <mx:State name="login">
      <mx:AddChild>
      <mx:target>
      <mx:TitleWindow id="loginTitle">
      <mx:Form>
      <mx:FormItem label="UserName">
      <mx:TextInput />
      </mx:FormItem>
      <mx:FormItem label="Password">
      <mx:TextInput displayAsPassword="true" />
      </mx:FormItem>
      <mx:Button label="Login" click="currentState=''" />
      </mx:Form>
      </mx:TitleWindow>
      </mx:target>
      </mx:AddChild>
      </mx:State>
      </mx:states>

      <mx:transitions>
      <mx:Transition id="mytran" fromState="*" toState="login">
      <mx:Parallel id="p1" target="{loginTitle}">
      <mx:WipeDown duration="2000" />
      </mx:Parallel>
      </mx:Transition>

      <mx:Transition id="revertran" fromState="login" toState="*">
      <mx:Parallel id="p2" target="{loginTitle}">
      <mx:WipeUp duration="2000" />
      </mx:Parallel>
      </mx:Transition>
      </mx:transitions>

      appreciate for any help.