1 Reply Latest reply on Jun 10, 2007 5:20 AM by ArmEagle

    Polygon object

      I have an idea for a map webapp in mind which requires many different shaped 2D-polygons to be placed over a (satellite-image) map of an area.
      First I started working with SVG, which works very nice in windows. The nice thing about SVG is, that you can create a Polygon object, and add it to a container. That polygon can fire (mouse)events, works with css (:hover), etc. But all browsers I tried on Linux have terrible rendering speeds (i guess it's mostly a Linux thing, not because of the browser implementation).

      So I decided to check out Flash. I found out the whole Flex stuff and already managed to get compiling working in Eclipse. Flash/Flex has many nice high level components, but it seems to be missing a Polygon object similar to what SVG has. Sure, you can draw lines and polygons on the Graphics attribute of a component (Canvas). But that's it. No mouse-hover/click/etc events.
      One could use on Canvas object per polygon, and use the Canvas object for events listening. But as far as I can tell that would also (logically) trigger the events in the Canvas object (/bounding box) but outside the polygon.

      The only solution to getting a Polygon object similar to SVG, is to write a custom Polygon container (a Canvas object), to which I could add multiple Polygon objects myself. For which I would have to keep track on all of them, and in the container event handlers check over what polygon the pointer is hovering.

      I have been looking for something like this for the past few days now, but couldn't find anything so far. And by posting this, I actually hope someone will yell at me and proof me wrong. But I don't expect that to happen.

      It's really a shame, SVG isn't fast enough. And even though Flash has been here for quite a while, something simple as this seems to be missing. Even Silverlight seems to have it (but no Linux plugin afaik).
        • 1. Re: Polygon object
          ArmEagle Level 1
          Ah, it took an extra day but I figured it out. All kinds of objects (Sprite, [Simple]Button) allow you to simple draw custom shapes. And these objects can be set to use a specific Graphics shape to specify the 'hit' area (could see that Graphics object as a bit mask). Mouse events will only fire from within that area.
          Probably basic stuff for an experienced Flex programmer, but it wasn't obvious to me :)

          So I guess I have all it takes to work on my project now.