简体   繁体   中英

How to open a new component with button, FLEX

I've made a login form which is working perfectly. However, when I enter my credentials and I want to click on the login button, I want to open a new window (or component). Can someone help me?

What kind of statement should I add to my click handlers of my login button? (component to proceed is called: feeds.mxml)

Thanks in advance

Look into the concept of ViewStack navigation containers , which handles pretty much what you want. You could also use PopUpManager to pop it open depending on your feeds.mxml class.

The cleanest way is usually to use a ViewStack. Depending on your requirements you may also be interested in using a TabNavigator or just a custom component as the "authenticatedView" of your primary ViewStack.

Fx 3 example:

    <mx:ViewStack id="viewStack">

        <mx:Canvas id="nonAuthenticatedView"/>
            //Your login screen "stuff" can go here.
            //On a successful login: viewStack.selectedIndex = 1.
            //On logout set selectedIndex to 0 to return to the login screen.
        </mx:Canvas>

        <mx:Canvas id="authenticatedView">
            //Instead of a Canvas this could be whatever, another ViewStack, TabNavigator, custom component, etc.
        </mx:Canvas>

    </mx:ViewStack>

This can get a lot more sophisticated if you start using a singleton model, bindings, and so on, but this should get you started.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM