0 Replies Latest reply on Dec 15, 2010 4:27 AM by Dalisra

    Working with images - Rotation and Movement

    Dalisra

      Hello there,

       

      I have this problem that I cant seem to solve:

       

      I need to be able to move an image arround and there are restrictions to where image should be able to move: at any given time, when dragging, image should always cover whole body of a given border_container, this is simply achieved by sending a rectangle to the startDrag function, which will specify where the image is allowed to move. I got that part right, and its working, the problem arrise when I try to rotate the border_container (with the image), it should still be only possible to drag image so it all the time covers the body of the border_container, but I don't know how to do it.

       

      Code I use looks something like this:

       

      image.startDrag(getImageDragRectangle());


      protected function getImageDragRectangle():Rectangle

      {

           return new Rectangle(

                this.width-image.contentWidth + x,

                this.height-image.contentHeight + y,

                Math.abs(this.width-image.contentWidth),

                Math.abs(this.height-image.contentHeight));
      }

       

      Edit: image is not inside the border_container (not sure how relevant it is..)

       

      Could anyone help me out here and give me any hints or suggestions how I could fix it?