Hi Ken,

I'm pretty sure that the target will never be the background image
itself; but rather the Canvas.  One hack is to check the type:

if (evt.target is Canvas)

-TH

--- In [email protected], Ken Dunnington <ken.dunning...@...>
wrote:
>
> I've got a custom component based on Canvas, and I'm programmatically
> setting its background-image style to a loaded SWF. I need to be able
to
> differentiate between a click on the background, and a click on any of
the
> other children. WIth no background set, I was using this code:
>
> private function clickHandler (evt:MouseEvent):void
>
> {
>
> if (evt.target == this)
>
> {
>
> setFocus();
>
> dispatchEvent(new CanvasEvent(CanvasEvent.CLEAR_FOCUS));
>
> }
>
> }
>
>
> WIth a background-image, however, this no longer works. I've also
tried
> listening for the target phase, but the event never actually reaches
the
> canvas object. I do have a separate ICollectionView instance
containing all
> the other children, but I'd like to avoid having to use that for this
> handler, if possible.
>


Reply via email to