2 Replies Latest reply on Aug 3, 2008 11:26 AM by katychapman85

    Drag and Drop Child Controls

    katychapman85
      In my application I have canvas's with images inside them. Where I can drag and drop the colour of the Canvas into the Drop Canvas.

      <mx:Canvas
      id="ColourTile"
      width="30" height="30" backgroundColor="{ColourTiles.currentItem.@ColourNo}"
      toolTip="Drag and Drop Colours into the Palette"
      click="GetSimilarColours(event.currentTarget.getRepeaterItem().@MakeUpColourNo, event.currentTarget.getRepeaterItem().@ColourNo, event.currentTarget.getRepeaterItem().@Colour); mouseMove="mouseMoveHandler(event);">

      <mx:Image source=" http://localhost/Flex/Personalised%20Palettes-debug/{ColourTiles.currentItem.@PictureSrc}"
      click="GetSimilarColours(ColourTiles.currentItem.@MakeUpColourNo,ColourTiles.currentItem. @ColourNo, ColourTiles.currentItem.@Colour);"/>

      </mx:Canvas>

      When I drag the canvas you can see a black square, is there anyway to see the image inside the canvas as I drag?

      Thanks
      Katy
        • 1. Re: Drag and Drop Child Controls
          Level 7

          "katychapman85" <webforumsuser@macromedia.com> wrote in message
          news:g74h2t$m85$1@forums.macromedia.com...
          > In my application I have canvas's with images inside them. Where I can
          > drag and
          > drop the colour of the Canvas into the Drop Canvas.
          >
          > <mx:Canvas
          > id="ColourTile"
          > width="30" height="30"
          > backgroundColor="{ColourTiles.currentItem.@ColourNo}"
          > toolTip="Drag and Drop Colours into the Palette"
          >
          > click="GetSimilarColours(event.currentTarget.getRepeaterItem().@MakeUpColourNo,
          > event.currentTarget.getRepeaterItem().@ColourNo,
          > event.currentTarget.getRepeaterItem().@Colour);
          > mouseMove="mouseMoveHandler(ev
          > ent);">
          >
          > <mx:Image
          > source=" http://localhost/Flex/Personalised%20Palettes-debug/{ColourTiles.current
          > Item.@PictureSrc}"
          >
          > click="GetSimilarColours(ColourTiles.currentItem.@MakeUpColourNo,ColourTiles.cu
          > rrentItem.@ColourNo, ColourTiles.currentItem.@Colour);"/>
          >
          > </mx:Canvas>
          >
          > When I drag the canvas you can see a black square, is there anyway to see
          > the
          > image inside the canvas as I drag?

          Look at dragProxy.

          From the huge volume of questions you're asking related to building a
          shopping cart application, you might want to consider investing in Flex 3
          Training from the Source, which walks you through most of the stuff you're
          having problems with.

          HTH;

          Amy


          • 2. Re: Drag and Drop Child Controls
            katychapman85 Level 1
            Sorry for asking so many questions, but this is the first Flex application I've developed. I do have a book on Flex not the one you recommended. It is good but doesn't answer all my questions. I've almost finished my application though, just stuck on a few things which is why I've asked a lot of questions today.

            I looked at DragProxy and got the image to show up when I drag, however I'm using transparent PNG's as my images so need to have the canvas drag with it to see the colour. I read on the help about creating Custom Components to do this. How would I go about doing this?

            Also do you know how to remove the red cross that appears when the user is not dragging over the drop component?