you can use this.addChildAt(new Button(),MyHBox.numChildren-1) On Wed, Sep 30, 2009 at 3:14 PM, prem <[email protected]> wrote:
> > Let me code it, the codes should look like this > > <mx:MyHBox> > <mx:Button label="Button 1" /> > <mx:Button label="Button 2" /> > <mx:Button label="Button 3" /> > <mx:Button label="Button 4" /> > </mx:MyHBox> > This needs to layout components in following manner > Button 4 | Button 3 | Button 2 | Button 1 > If I add another button with addChild(new Button()); the new button > must appear before Button 4. > > Thanks > > On Sep 30, 2:38 pm, prem <[email protected]> wrote: > > However, I see the updateDisplayList() function in Box layout with the > > following loop > > for (i = 0; i < n; i++) > > { > > obj = IUIComponent(target.getChildAt(i)); > > top = (h - obj.height) * verticalAlign + > paddingTop; > > obj.move(Math.floor(left), > Math.floor(top)); > > if (obj.includeInLayout) > > left += obj.width + gap; > > } > > Does that not mean that we need to override updateDisplayList() > > function > > > > Thanks > > > > On Sep 30, 2:24 pm, rishi narang <[email protected]> wrote: > > > > > here are the steps: > > > > > i) create a class that extends UI component > > > ii) override createChildren method and in that method write all ur > logic of > > > layout i.e. create for loop to layout sprites as containers by > decrementing > > > there x values there by loop running in reverse order. > > > iii) populate those sprites with what ever data u want to add them to > > > > > hope this answers ur question. > > > > > On Wed, Sep 30, 2009 at 2:37 PM, prem <[email protected]> wrote: > > > > > > Guys, > > > > Yesterday I faced an interview question. How to create a custom > > > > component which behaves like an HBox but the children needs to be > > > > layed out in reverse order, i.e. From right to left and not from left > > > > to right. I answered, we need to override updateDisplayList to move > > > > the children, but the interviewer says its not the right answer > > > > > > Can anyone let me know how to do that? > > > > > > Thanks in advance > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Flex India Community" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/flex_india?hl=en -~----------~----~----~----~------~----~------~--~---

