1 Reply Latest reply on Aug 31, 2007 12:08 AM by ctzn99

    Newbie Q

    ProjectedSurplus Level 1
      I am working on my first flex app. I have a component which builds a (say) browser bar at the top and another component (say) main window and want to be able to have a click on a button click on the browserbar change the state(?) view(?) of the main window (note I can change states within the component no prob so I know a little of what I am doing but).

      Also, how can I then change the main window state to say state1 via a button click inside (say) main window (base state)

      I've been through help and my flex books and must either be missing something or . . . . to this end I would also be interested in hiring someone for say 15 min a day to provide learned guidance as I bludgeon my way through the learning curve -- email me if interested
        • 1. Re: Newbie Q
          ctzn99 Level 1
          Assuming your main window is a component in and off itself make a public function in the main window called "SetState" or "ToggleState" or something to that affect.

          i.e. (assuming you've got an "application" and there is a "mainWindow" window component and a "browserBar" component within that application.

          --> this would go in the main window
          // important, make sure to mark it as public.
          public function SetState(newState:String):void
          {
          currentState = newState;
          }

          --> this would go in the browser bar
          private function changeState():void
          {
          // because this is not in the application but in a component we need to "go up a levele" so to speak
          // "MyApp" should be whatever the name of the MXML file is
          var myApp:MyApp = MyApp(this.parentApplication);
          // now we've got a handle to this components parent application we can invoke methods of it's children
          myApp.MainWindow.SetState("someNewStateName");
          }

          Hopefully that made sense, if not let me know i've got something I can modify as an example.

          Best,
          Zach