7 Replies Latest reply on Jan 28, 2009 12:51 PM by celestethecat

    Include Components

    celestethecat Level 1
      I am going to apologize upfront for my posts.

      I am trying to create a mockup that I will hand over to a developer. I have thrown everything into one .mxml file. I need to clean this mess up...I was hoping to have a grid and in each grid item I can have an include to each component?

      Thanks,


        • 1. Re: Include Components
          Level 7

          "celestethecat" <webforumsuser@macromedia.com> wrote in message
          news:glpr3t$q02$1@forums.macromedia.com...
          >I am going to apologize upfront for my posts.
          >
          > I am trying to create a mockup that I will hand over to a developer. I
          > have
          > thrown everything into one .mxml file. I need to clean this mess up...I
          > was
          > hoping to have a grid and in each grid item I can have an include to each
          > component?

          You're probably better off letting the developer decide what components go
          where.


          • 2. Re: Include Components
            everynerd
            Use Photoshop or something similar to mock up your design, and as Amy said, let the developer do the code work to match the design.
            • 3. Re: Include Components
              Gregory Lafrance Level 6
              I think you should just keep everything in the one MXML file, keeping it as clean and well organized as possible. Over time you may be able to see how the developers took your code and what they did with it.

              It's great to see a designer who wants to expand their expertise beyond just design. It certainly can only increase your opportunities in the future, and if Flex becomes super popular, you will be in a good position to take advantage of that.
              • 4. Re: Include Components
                celestethecat Level 1
                Thank you for the words of encouragement but I actually really need to do this...is there an include?

                • 5. Re: Include Components
                  levancho Level 3
                  it is fairly simple, for example tab navigator :
                  quote:


                  <mx:TabNavigator x="94" y="81" width="200" height="200">
                  <mx:Canvas label="Tab 1" width="100%" height="100%">
                  <!-- some stuff --><!-- some stuff -->
                  <!-- some stuff --><!-- some stuff -->
                  <!-- some stuff --><!-- some stuff -->
                  </mx:Canvas>

                  <mx:Canvas label="Tab 1" width="100%" height="100%">
                  </mx:Canvas>
                  <mx:Canvas label="Tab 1" width="100%" height="100%">
                  </mx:Canvas>
                  </mx:TabNavigator>


                  so you have bunch of inline canvases inside tab navigation,
                  you can externalize them following way :

                  create new componentm, say call it "myCanvas" that extends Canvas component
                  in Flex Builder you do this easy Way : file --> new --> flex component
                  and then in dialog you will see fairly simple stuff to fill in

                  and you get a file with name you choose and something like this inside, based on which component you extends.
                  quote:


                  <?xml version="1.0" encoding="utf-8"?>
                  <mx:Canvas xmlns:mx=" http://www.adobe.com/2006/mxml" width="400" height="300">
                  <!-- my stuff here -->
                  </mx:Canvas>


                  and you can create as many components like this as you want and then include then in your big main file.

                  so for this example your tab can just turn into this :
                  quote:


                  <mx:TabNavigator x="94" y="81" width="200" height="200">
                  <local:myCanvas label="mycanvas" />
                  <local:myPanel label="mypanel" />
                  <local:mySomeOtherCompo label="lalala" />
                  <local:myCanvas2 label="mycanvas2" />
                  </mx:TabNavigator>


                  make sure to create namespace, for your component, here I use autogenerated namespace that lflex doe it for you.
                  • 6. Re: Include Components
                    Level 7

                    "celestethecat" <webforumsuser@macromedia.com> wrote in message
                    news:glqd7f$it4$1@forums.macromedia.com...
                    > Thank you for the words of encouragement but I actually really need to do
                    > this...is there an include?
                    >

                    Here's the thing. It's pretty easy to find out how to separate out things
                    into different MXML components by even the most cursory scan of the docs.
                    If you're not up to that, then there's a very good chance that whatever you
                    do, the developer will have to undo before he or she can continue. Worse,
                    you may tangle things up so badly that the time to fix it is several times
                    what it would have taken the developer to do it in the first place.

                    If you're paying the developer by the hour, then you're better off just
                    letting him or her do it--you will save yourself money, time, and headache
                    by allowing the developer to do the job. You could ask the developer to
                    include inline comments to help you learn from.

                    However, since you keep asking and you don't seem to have mastered the Help
                    system, try
                    Help>Help Contents

                    Adobe Flex 3 Help>Flex Programming Elements>Developing Applications>Defining
                    Custom MXML components


                    • 7. Re: Include Components
                      celestethecat Level 1
                      Thank you for the detailed answer...I will try it out and let you know if I suceed.