If you set autosize as true then you will see the mouse events dont work.
--- In ydn-flash@yahoogroups.com, Josh Tynjala <joshtynjala@...> wrote:
>
> Perhaps you're not properly associating your custom class with a symbol in
> your library, or maybe you're setting mouseEnabled or mouseChildren to false
> somewhere. The following code worked correctly for me:
>
> var sprite:Sprite = new Sprite();
> sprite.graphics.beginFill(0xff0000);
> sprite.graphics.drawRect(0, 0, 50, 50);
> sprite.graphics.endFill();
>
> hbox.addChild(sprite);
>
> sprite.addEventListener(MouseEvent.CLICK, sprite_clickHandler);
>
> function sprite_clickHandler(event:MouseEvent):void
> {
> trace("clicked");
> }
>
> hbox is an HBoxPane I dragged to the stage.
>
> - Josh
>
> On Fri, Oct 23, 2009 at 3:28 AM, rajdeeprath <rajdeeprath@...> wrote:
>
> >
> >
> > There seem to be a problem with HBoxPane component.
> >
> > I have attached a custom object which extends sprite into the HboxPane.
> > within my custom class, i have:
> >
> > this.addEventListener(MouseEvent.CLICK, onClick);
> >
> > function onClick(me:MouseEvent)
> > {
> > trace("here");
> > }
> >
> > Ite dosent seem to trigger, no matter what
> >
> >
> >
>