4 Replies Latest reply on Jan 25, 2011 9:34 AM by hullopes

    How to use Flexlib ImageMap via ActionScript

    salchichasa
      When using the ImageMap component that is part of flexlib, how can I use ActionScript to set the values of the area coordinates, shape, alt, etc?

      At the following link they use MXML to do this, but there is no reference for ActionScript:
      http://flexlib.googlecode.com/svn/trunk/docs/flexlib/controls/ImageMap.html#toolTipField

      Below is sample code:

      Thanks
      Salchichasa
        • 2. How to use Flexlib ImageMap via ActionScript
          prabhutech

          Hi,
          Were you able to find an answer for this? Creating ImageMap via actionscript using Flexlib.
          Please share your findings if so.
          Thanks so much in advance.
          • 3. Re: How to use Flexlib ImageMap via ActionScript
            kadcunit2

            I spent some time on this one as well but got it to work:

             

                        import flexlib.controls.ImageMap;
                        import flexlib.events.ImageMapEvent;
                        import flexlib.controls.area;

             

             

                                     var imgmap:ImageMap= new ImageMap();
                                    var xmlarea:area=new area();
                                     xmlarea.shape="POLY";
                                     xmlarea.coords="588,333,729,348,728,516,588,486";
                                     xmlarea.alt="bla";
                                     xmlarea.href="1";

                                    // define more areas if you like
                                    imgmap.map=new Array(xmlarea); // put other defined areas in the array here
                                    imgmap.source="assets/blank.png";

                           //use your own event or specify an imgmap.target with a valid href
                                    imgmap.addEventListener(ImageMapEvent.SHAPE_CLICK,function(e:ImageMapEvent):void {
                                        trace ("imagemap click:"+e.href);  // href 1 clicked

                                     });

             

            cheers!

            • 4. Re: How to use Flexlib ImageMap via ActionScript
              hullopes

              Hello, defining the mapping so it's all right.
              How do I create a mapped image, where can I send the focus to a particularcoordinate of the image?