Its actually quite easy. 

Create a folder inside your project, lets say we call it 'views'.

Inside there create a mxml component in our example lets say login
panel, extend the component from the panel class. Put whatever
elements on that login panel you like, like a label for username and
password, then text inputs for username and password and a login
button. Save the component. 

Back in your main file. You could actually get rid of the canvas
component you have there inside the viewstack. 

Instead, add this line to the application tag at the top of the main
file. 

xmlns:views="views.*"

this will allow you to reference the files you created under the views
folder. 

then in your viewstack, instead of the first canvas component instead
put this line in there.

<views:LoginPanel />

Now your code should look like this for the view stack.

<mx:ViewStack>

<views:LoginPanel />

</mx:ViewStack>

this will tell flex to go out to the name space you created in the
application tag, and import the LoginPanel custom component you
created into the main document. 

If you have other views for your app, you could also create them in
such a way. So if you also inside your views folder created a
View2.mxml file and a View3.mxml file then your view stack would look
like this:

<mx:ViewStack>

<views:LoginPanel />

<views:View2 />

<views:View3 />

</mx:ViewStack>


Hope this helps. 

--- In flexcoders@yahoogroups.com, "kmorland" <[EMAIL PROTECTED]> wrote:
>
> Hello,
> 
> I am a newbie using Flex.  I have a layout in the main file and
would like to include other 
> files into the layout.  I am looking for solutions to current
problem or suggestions upon 
> how to layout an application, where you have a main layout file and
other files that fit the 
> code the different modules.  
> 
> Example:
> 
> Layout ----
> <mx:ViewStack>
> <mx:Canvas>
> 
> <!-- Would like to include another file here with Panel and other
code... -->
> </mx:Canvas>
> 
> <mx:Canvas>
> 
> <!-- Would like to include another file here with Panel and other
code... -->
> </mx:Canvas>
> 
> </mx:ViewStack>
> 
> Other file component file----
> <mx:Panel>
> some code
> </mx:Panel>
> 
> Thanks in Advance,
> Kevin
>







--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/flexcoders/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:[EMAIL PROTECTED] 
    mailto:[EMAIL PROTECTED]

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to