2 Replies Latest reply on Sep 20, 2010 3:40 PM by JALevine

    Problem with "move" properties...

    JALevine

      Forgive me if my explanation is a bit choppy; I'm new to developing in flex 3.5.

       

      I have a button that turns on the visibility an image (png) of an arrow embedded into my canvas.  I set up the move effect so that the arrow moves to wherever the user clicks in the canvas (and offset the mouseY value so that the tip of the arrow lines up where the click is).  My question is, if I wanted to add another button that adds a second arrow to the same canvas (an arrow which requires a different offset of the mouseX and mouseY coordinates to be precise) how do I change it dynamically in actionscript? Thanks for your help.

       

      Here is basically how the first one was set up:

       

      private function addarrow() : void

           {

                Varrow.visible=true;

           }

       

       

      <mx:Canvas id="Vcanvas" styleName="canvasborder" mouseDown="Varrow.move(Vcanvas.mouseX,Vcanvas.mouseY - 57)">

      <mx:Image id="Varrow" source="images/arrow.png" visible="false" alpha="1" moveEffect="Move"/>

      </mx:Canvas>

      <mx:Button label="Arrow" click="addarrow()"/>

       

      Here is how I'm trying to add a second arrow, but my syntax is wrong:

       

      private function addarrow1() : void

           {

                Varrow.visible=true;

                Varrow.source="images/arrow1.png"

                VCanvas.mouseDown="Varrow.move(Vcanvas.mouseX,Vcanvas.mouseY - 57"

           }

       

      private function addarrow2() : void

           {

                Varrow.visible=true;

                Varrow.source="images/arrow2.png"

                VCanvas.mouseDown="Varrow.move(Vcanvas.mouseX - 100, Vcanvas.mouseY - 57"

           }

       

      <mx:Canvas id="Vcanvas" styleName="canvasborder">

      <mx:Image id="Varrow" visible="false" alpha="1" moveEffect="Move"/>

      </mx:Canvas>

      <mx:Button label="Arrow1" click="addarrow1()"/>

      <mx:Button label="Arrow2" click="addarrow2()"/>