First you could create 3 html pages (home, what we do, contact) but i think you don't want that.
The best way is to create one main application with 3 states. (home, what we do, contact). This application will load your other apps in those states and when you click the links you just set in your application "currentState = myState" and that's it. No refresh, no nothing.You could also load/unload those apps when u need them, just to minimize your application. If u need an example of this i'll try to make one clear enough. Good luck and good coding...!
<!-- Note: this is the flex 4 version so you'll have to use flex4 SDK to compile it. The flex 3 version is not so different and you'll learn something :P -->
<!-- Define your three states -->
<s:states>
<mx:State name="home" />
<mx:State name="whatWeDo" />
<mx:State name="contact" />
</s:states>
<!-- this is your navigation bar (display it in all states) -->
<s:Group horizontalCenter="0" top="30">
<s:layout>
<s:HorizontalLayout />
</s:layout>
<s:Button label="Home" click="currentState='home'"/>
<s:Button label="What we do" click="currentState='whatWeDo'"/>
<s:Button label="Contact" click="currentState='contact'"/>
</s:Group>
<!-- this is your "Home" page. Can be anything from Sprite to complex DisplayObject -->
<s:Group includeIn="home" verticalCenter="0" horizontalCenter="0">
<mx:Label text="Home" width="100%" textAlign="center" />
</s:Group>
<!-- this is your "What we do" page. Can be anything from Sprite to complex DisplayObject -->
<s:Group includeIn="whatWeDo" verticalCenter="0" horizontalCenter="0">
<mx:Label text="What we do" width="100%" textAlign="center" />
</s:Group>
<!-- this is your "Contact" page. Can be anything from Sprite to complex DisplayObject -->
<s:Group includeIn="contact" verticalCenter="0" horizontalCenter="0">
<mx:Label text="Contact" width="100%" textAlign="center" />
</s:Group>
Comments
You'll have to give us some details. I don't really understand what you're trying to do.
hello sir,
firstly i am new to flex..
actually i am designing a website for some xyz company in flex...
so i have written 3 different applications in the project.. they are
1)application which displays home page of the site("homepage")
2)application which describes what the company actually do? ("what we do")
3)application which show a way to contact the company people ("contact us")
so when i am running the project....
i can see the main application ie. "homepage" gets executed first,
so when the user clicks on the links "what the company do" / "contact us" the site should
display the particular information in which i have written as the two seperate applications
"what we do" and "contact us"...
so how can i do that????
so how can i access the other applications inorder to complete the designing successfully..
Well,
First you could create 3 html pages (home, what we do, contact) but i think you don't want that.
The best way is to create one main application with 3 states. (home, what we do, contact). This application will load your other apps in those states and when you click the links you just set in your application "currentState = myState" and that's it. No refresh, no nothing.You could also load/unload those apps when u need them, just to minimize your application. If u need an example of this i'll try to make one clear enough. Good luck and good coding...!
Thank you very much sir...
yeah., now i am comfortable with it to the maximum extent..
if u have any free time.,
please also do post me an example to get a clear idea..
plz sir...
my email ID is s.harshas.c@gmail.com
This is just a simple app with 3 different states but you'll get the idea.
<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"
minWidth="1024"
minHeight="768">
<!-- Note: this is the flex 4 version so you'll have to use flex4 SDK to compile it. The flex 3 version is not so different and you'll learn something :P -->
<!-- Define your three states -->
<s:states>
<mx:State name="home" />
<mx:State name="whatWeDo" />
<mx:State name="contact" />
</s:states>
<!-- this is your navigation bar (display it in all states) -->
<s:Group horizontalCenter="0" top="30">
<s:layout>
<s:HorizontalLayout />
</s:layout>
<s:Button label="Home" click="currentState='home'"/>
<s:Button label="What we do" click="currentState='whatWeDo'"/>
<s:Button label="Contact" click="currentState='contact'"/>
</s:Group>
<!-- this is your "Home" page. Can be anything from Sprite to complex DisplayObject -->
<s:Group includeIn="home" verticalCenter="0" horizontalCenter="0">
<mx:Label text="Home" width="100%" textAlign="center" />
</s:Group>
<!-- this is your "What we do" page. Can be anything from Sprite to complex DisplayObject -->
<s:Group includeIn="whatWeDo" verticalCenter="0" horizontalCenter="0">
<mx:Label text="What we do" width="100%" textAlign="center" />
</s:Group>
<!-- this is your "Contact" page. Can be anything from Sprite to complex DisplayObject -->
<s:Group includeIn="contact" verticalCenter="0" horizontalCenter="0">
<mx:Label text="Contact" width="100%" textAlign="center" />
</s:Group>
</s:Application>
Thank you sir,
i will look after it..