hey guys... im brand new to flex, but i was wondering if you could have 2 application components in one project??
in my login.mxml
i would have
<s:Application ...... >
in here i would have states, state one will first show my login screen,
and then on login success it will display my main mxml...
the other file i have
<s:Application .... >
here i have all my main data....
</s: Application >
You should really only have one Application object in your Flex application. A better approach is to base your custom components off of the Group component.
So your main.mxml file will have something like:
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/halo" xmlns:comps="*"> <comps:LoginScreen /> </s:Application>
And your LoginScreen custom component (LoginScreen.mxml) could be based off of a spark Group:
<s:Group xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/halo"> <s:SimpleText text="hello" /> <s:Button label="Login" x="100" /> </s:Group>
In this case both your main.mxml and LoginScreen.mxml files should be in the same directory. If you want to put the LoginScreen.mxml file in a subfolder you can update the path on the comps namespace to something like xmlns:comps="subfolder.*"