You modularize mxml by creating components.  Components can be implemented either in Actionscript or in mxml.  Except for the implementation there is no difference.

 

To create an mxml component, create an mxml file, and instead of using mx:Application as the root tag, use some other tag, like Hbox, or Panel, or absolutely anything you want.

 

This is identical to saying in AS, “class MyHBox extends Hbox”.

 

To try this, just cust some mxml text out of your App, something that is maybe in a viewstack or a tabnavigator. Create a new mxml file say “MYHbox.mxml” and copy that cut text into it. Instantiate it in the location you cut it from using <MyHBox height=”100%” … /> Make sure there is a default namespace in you application tag: xmlns=”*”.  Run the app.  You will see your component displayed.

 

Now, it is really a bit more complicated than that, because you will probably want to pass data in and out of your component.  But get this concept first, then we’ll tackle that.

 

Tracy

 


From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of hank williams
Sent: Friday, June 23, 2006 9:10 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Another simple flex newbie question

 

How do you modularize MXML.

In actionscript we import classes, and each class represents some conceptual chunk, but I am not sure what the equivalent is in MXML.

I have been looking at lots of code examples, but they are all small. This has been very helpful in learning how APIs work, but I am on the edge of my two day project feeling bloated and unmodular.

I am sure, lots of people will say the answer is cairngorm, but for right now I want to learn MXML "raw" before adding another layer on top of it.

Thanks
Hank

__._,_.___

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





SPONSORED LINKS
Web site design development Computer software development Software design and development
Macromedia flex Software development best practice


YAHOO! GROUPS LINKS




__,_._,___

Reply via email to