Gaurav, Thanks a lot
Your implementation is perfectly correct. I wrote the following code
package com
{
import flash.display.DisplayObject;
import mx.containers.HBox;
public class MyHBox extends HBox
{
public function MyHBox()
{
super();
}
public override function addChild
(child:DisplayObject):DisplayObject
{
this.addChildAt(child,0);
return child
}
}
}
Then I have in main mxml file
<com:MyHBox id="myHBox">
<mx:Button label="OK"/>
<mx:Button label="Cancel"/>
<mx:Button label="Yes"/>
<mx:Button label="No"/>
</com:MyHBox>
It works wonders!!
On Sep 30, 3:07 pm, Gerald Anto Fernando <[email protected]>
wrote:
> Hi gaurav thanks,
> I was aslo cleared for this doubt.
> Thanks&Regards,
> Gerald A
>
>
>
> On Wed, Sep 30, 2009 at 2:51 PM, gaurav rai <[email protected]> wrote:
> > package
> > {
> > import flash.display.DisplayObject;
>
> > import mx.containers.HBox;
>
> > public class CustomHBox extends HBox
> > {
>
> > public function CustomHBox()
> > {
> > super();
> > this.setStyle("horizontalAlign","right");
> > }
> > public override function
> > addChild(child:DisplayObject):DisplayObject
> > {
> > this.addChildAt(child,0);
> > }
> > }
> > }
>
> > 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
>
> --
> Thanks & Regards,
> A Gerald
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---