2 Replies Latest reply on Aug 23, 2007 7:23 AM by FlexIsGood4U

    Dynamic Image Drag/Drop

    FlexIsGood4U
      Hi Dudes,

      I found a very nice image drag/drop example in the Live Doc :

      http://livedocs.adobe.com/flex/201/html/wwhelp/wwhimpl/common/html/wwhelp.htm?context=Live Docs_Book_Parts&file=dragdrop_081_14.html

      My problem is that I can't manage this dynamically ... I want this :

      **************************
      <mx:Image id="myimg" alpha="1" x="800" y="500"
      source="images/qw.png"

      mouseMove="dragMe(event, myimg, 'img'); myoffset(myimg);" />
      **************************

      but coded that way:

      **************************
      im = new Image();
      im.source = 'image.jpg'

      // MY LINE MISSING TO MANAGE mouseMove
      **************************

      Any Ideas ?

      Thanks a lot ...

      Virtualsight
        • 1. Re: Dynamic Image Drag/Drop
          Pepe.FxUG Level 1
          Hello.

          What about like this?

          ******************************************************************************
          private function dynamicImage():void
          {
          var img:Image = new Image();
          img.name = "myImage";
          img.source = "assets/hoge.jpg";
          img.addEventListener(MouseEvent.MOUSE_MOVE, onMouseMove);
          }

          private function onMouseMove(event:MouseEvent):void
          {
          var img:Image = event.currentTarget as Image;
          dragMe(event, img, "img");
          myoffset(img);
          }
          ******************************************************************************

          • 2. Re: Dynamic Image Drag/Drop
            FlexIsGood4U Level 1
            Hi Pepe,

            This was a great help.
            And now I understand events even more !

            Thanks a lot,