Rectangle has contains(x:Number, y:Number):Boolean
All you need to do is create an array of Rectangles and iterate
through them until one matches.
Here is an example of where I do this kind of thing:
private function whereMouse(x:int, y:int):void {
this._hoveredItemIndex = 0;
this._hoveredItemLimit = 0;
for(var
index:int=0;index<this._pathPartsRects.length;index++) {
var rect:Rectangle = this._pathPartsRects[index] as
Rectangle;
if(rect.contains(x, y)) {
// Do your linking here.
return;
}
}
}
_pathPartsRects is an Array of rectangles that represent the image map
data.
Paul
--- In [email protected], "Mrinmoyee Sanyal"
<[EMAIL PROTECTED]> wrote:
>
> Ok, will try out Matt's workaround while waiting for Doug's component :)
>
> Thank you
> -MS
>
>
>
> On 06 Mar 2007 08:35:01 -0800, Doug McCune <[EMAIL PROTECTED]> wrote:
> >
> > I was just talking to someone here at 360Flex last night about this.
> > Basically he wanted a component that was the same as an image map
in HTML,
> > so you could specify different areas with points, and a specific
URL for
> > each one.
> >
> > I'm going to work on trying to build this component, hopefully it
will get
> > rolled into FlexLib in not too long...
> >
> > Doug
> >
> > On 3/6/07, Matt Horn <[EMAIL PROTECTED]> wrote:
> > >
> > > I think what you'll want to do is use the local x and y
properties of
> > > the mouse in the mouse's click event handler.
> > >
> > > let's say you have a box with coordinates 0,0 to 10,10 doing one
thing
> > > and 10,0 to 20,10 doing something else; you would do something like:
> > >
> > > <image click="onClickHandler(event)"/>
> > >
> > > public function onClickHandler(e:MouseEvent):void {
> > > if (e.localX >= 0 && e.localY >= 0 && e.localX <= 10 && e.localY
> > > <= 10) {
> > > ...
> > > }
> > > }
> > >
> > > hth,
> > > matt horn
> > > flex docs
> > >
> > > > -----Original Message-----
> > > > From: [email protected] <flexcoders%40yahoogroups.com>
> > > > [mailto:[email protected]
<flexcoders%40yahoogroups.com>] On
> > > Behalf Of Mrinmoyee Sanyal
> > > > Sent: Tuesday, March 06, 2007 2:16 AM
> > > > To: [email protected] <flexcoders%40yahoogroups.com>
> > > > Subject: [flexcoders] image hotspots
> > > >
> > > > How do we create hotspots (linkable areas) in an image?
> > > >
> > > > -MS
> > > >
> > > >
> > > >
> > > >
> > >
> >
> >
> >
>