4 Replies Latest reply on May 18, 2007 1:56 PM by cjas

    mxml components


      I have been looking somewhat at the mxlm components in Flex and it seems realy cool but I am running into a slight problem. I need a kind of combobox (special handling). This could of course been done in Flash but from what I have seem of Flex I would be able to save hours of work doing it with mxml components (working with states).
      The problem however is that when I do it and place the component in my appication it falls behind the label under it instead of over it. Is there something to do about that?
      Also it seems that it is not possible to have constrained layout of a component. This would be a very useful feature because I want my control in the page to be sizable as well.

      Any help is very much appreciated,
        • 1. Re: mxml components
          peterent Level 2
          If you have a container with absolute layout, such as Canvas or a Panel, TitleWindow, or Application with layout="absolute" then it is permissible to have components overlap each other. A container like VBox won't permit overlapping as it has a specific layout it follows.

          The "depth" of components follows the order they appear in the MXML file - or the order in which they are added to the display list in ActionScript using the addChild() function of the container.

          So if you have <mx:ComboBox> followed by <mx:Label> then the Label will appear above or in front of the ComboBox. Just reverse the order.
          • 2. Re: mxml components
            cjas Level 1
            Thank you very much Peter.

            For prototyping and time pressured situations that is a very workable way.
            By the way I see what you mean with the order of the components in relation to the <mx:ComboBox>. I don't think it is natural to have an overllap in that way. What I am talking about is when you open up the combo box and then it always overlaps the lable, no matter in what order you put the label and the combo box.
            This is probably then because the component was made in Flash?
            If that is the case it looks like in the end you will always want to create the component in Flash, unless it doesn't overlap other components, then it is not so important probably. Or alternativly maybe future versions will support awareness of depth also in future versions of flex mxml ;-)
            The mxml components do have a resize event so I think it is possible to rearange the layout to respond to that. It would have been even simpeler thought if you could also set the layout constraints in a component :-)

            Thanks again and by the way I have now been looking at flex for a little bit over a week nows and the more I look at it the more I am impressed with it.
            Where I am concerned Adobe is setting the trend in RIA development.
            A big thanks to the whole team for an incredible job.

            • 3. Re: mxml components
              peterent Level 2
              When you say "when you open up the combo box" you mean the drop-list that slides out of it containing the items in its dataProvider?

              That is a 'pop-up' and is always forced above all other components. This is so it is selectable with the mouse or keyboard; I've never seen a system where it would open below anything else.

              The ComboBox is written in ActionScript for Flex, not in Flash. The Flash Player and therefore Flex, is very depth-aware; you can change the depth of a child using functions on the container designed to do that.
              • 4. Re: mxml components
                cjas Level 1
                I indeed mean the drop-list slides out. I was trying to quickly make my own combo box (because of different specificaions) with mxml. I did this with creating an mxml component with a text box and a button. The sliding out of the drop-list I did by toggeling the state when the button was clicked. That goes incredibly quick, works very nicely and it allows me to do whatever needed in the sliding out part. With this approach however I ran into it opening below the label. So I guess I will have to get more into Action Script 3 to solve that issue . I am really looking forward to do that. The dilemma is that I am pretty new to all of this and therefore it will take some time to get into it. Because of external obligations of course time is always limited :-).
                So thanks again and I know it is going to work well. The platform is too good to not get it to work.