6 Replies Latest reply on Sep 17, 2008 6:54 AM by webvalue

    Custom components

    webvalue Level 1
      Hi,

      I am a little confused by the use of custom components now. I thought they are the controls that you can build by yourself, just like standard components such as datagrid, combo box, etc., except custom ones are not normal. One example is the control at the bottom right corner of the following page:

      http://examples.adobe.com/flex2/inproduct/sdk/restaurant/finder.html

      And I think the custom components can have their own data provider defined. However, when i read, all the books talk about how you define a component as a mxml file and this is what looks like a custom component. So I am really confused.

      Can someone clarify? Are there good tutorials on how to write complicate custom components?
        • 1. Re: Custom components
          Peter Lorent Level 2
          See http://www.adobe.com/support/documentation/en/flex/

          Creating and Extending Adobe Flex 3 Components

          This pdf descibes the process in detail.
          • 2. Re: Custom components
            Gregory Lafrance Level 6
            Custom components can be created as .mxml files (MXML components) or as .as files (ActionScript components).

            During compilation the end result is ActionScript, so in many cases you could create custom components in either MXML or ActionScript. In other cases you would want to use MXML (more simple components?), and in still other cases you would want to create them in ActionScript (more complex components?).

            Of course you can have a <mx:Script> block in an MXML component.

            Read the link the other poster gave, and search FB3 help or LivDocs for "Custom Components", and you will be well served.
            • 3. Re: Custom components
              ntsiii Level 3
              Finally, just try it. It is often simpler than it may sound. But sometimes it is harder than it sounds!
              Tracy
              • 4. Re: Custom components
                webvalue Level 1
                Thanks for all of your help. There are many examples on the web, does anyone know there is a small example of customized component?
                • 5. Re: Custom components
                  EvolvedDSM Level 2
                  Here's a doc on explaining what a custom component is:
                  http://livedocs.adobe.com/flex/3/html/help.html?content=intro_2.html

                  Don't get the idea of a "custom" component skewed as if you are creating a brand new component. The base of any custom component still uses the built-in Flex components which can be altered to behave how you want it to.

                  For example. a great custom component I've been using in many apps is the autoComplete component. It guesses input according to what I type, very similar to how a web browser might list possible addresses when you begin typing into the URL bar. While this is not functionality that is built into Flex, the core of autoComplete is just a textInput control that has actionscript working with it to produce the desired automatic text fill effect.

                  Another example would be the CustomGrid by UYDAMS. It's a datagrid that has text filtering, printing, and copying features built into it. However, it's really just a datagrid with a textInput and printing controls that work together via actionscript to create the desired functionality.
                  http://flexed.wordpress.com/2007/08/15/customgrid-v12/

                  So I guess an easy way to put it is that a custom component is actually a single Flex component or collection of Flex components that can be altered to a certain functionality which can then be used in your main application.
                  • 6. Re: Custom components
                    webvalue Level 1
                    EvolvedDSM , thanks a lot! A lot to learn and this is good to start.