4 Replies Latest reply on Jul 14, 2009 6:08 AM by PiotrekB

    Connecting mxml files



      I'm new in Flex and Action Script. I'm making some simple application Flex+ActionScript+PHP+MySQL. Can anybody tell my is it possible to connect all project mxml files in one index.mxml file. I have some .mxml files builded on MySQL and i have one index.mxml file with navigation bar (mx:menubar) and <mx:ViewStack>(containing <mx:Canvas>). I wish to put some other mxml files (representing db tables) to those <mx:Canvas>. Can anybody help me with that?

        • 1. Re: Connecting mxml files
          _Natasha_ Level 4



          index.mxml is not a good name for components. It's better to call them myNavigationbar.mxml or something like it.

          It's a good if all components will be in separate files.

          You should have a main application file (can be an index.mxml or main.mxml or any other). You can just use your components there. Components will have names from names of there files. Just try to insert component in FB and it will suggest components with this name and automatically add namespace if needed.


          Hope this helpful.

          • 2. Re: Connecting mxml files
            PiotrekB Level 1

            Can You give me some code example please?

            • 3. Re: Connecting mxml files
              _Natasha_ Level 4

              As an example,

              file myMenu.xml

              <mx:MenuBar ...>

              <!-- Any code there -->



              file Main.mxml (main application should have Application element in root!)

              <mx:Application xmlns:tst="test.*">

              <myMenu />

              <!-- if myMenu.mxml is in subfolder test, need namespace! like this -->



              1 person found this helpful
              • 4. Re: Connecting mxml files
                PiotrekB Level 1

                Ok! Now i get it.

                I made new FB project and with main.mxml file

                <?xml version="1.0" encoding="utf-8"?>
                <mx:Application xmlns:tst="test.*" xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">


                <tst:komponent  y="168"/>


                and in 'test' folder some new mxml component named 'komponent.mxml':

                <?xml version="1.0" encoding="utf-8"?>
                <mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml" width="100%" height="66">
                    <mx:Button label="component button"/>

                It's working . Now i have mxml component in my main.mxml file.

                Thank you