1 Reply Latest reply on Aug 27, 2009 2:14 AM by christopher.mina

    How to track border hover of text area?

    ckisthebest Level 1

      Hi All,

       

      I really need some idea. I am using text area which is movable. It moves when you drag it.

       

      Now i want to move it only while clicking on border. If you have seen text area in powerpoint on which if you hover on border it shows a + cursor.

       

      I want to implement same thing in flex. Does anyone have idea?

       

      Thanks,

      -CK

        • 1. Re: How to track border hover of text area?
          christopher.mina

          add a mouseMove event listener to the text area.

           

          ta.addEventListener(MouseEvent.MOUSE_MOVE, onMouseMove);

           

          private var upperThreshold:int = 5;

          private var lowerThreshold:int = 10;

          private var leftThreshold:int = 3;

          private var rightThreshold:int = 6;

          private function onMouseMove(evt:MouseEvent):void{

               var isOnBorder:Boolean = false;

               if (ta.mouseY <= upperThreshold){

                  isOnBorder = true;

               }else if(ta.mouseY >= ta.height - lowerThreshold){

                  isOnBorder = true;

               }else if(ta.mouseX <= leftThreshold){

                   isOnBorder = true;

               }else if(ta.mouseX >= ta.width - rightThreshold){

                   isOnBorder = true;

               }

           

               if (isOnBorder){

                   //set your styles and listen for mouse down event

               }else{

                   //remove your styles and mouse down event listener

               }

          }

           

          In the above example, you'll also want to listen for a mouse out even to so you can remove any styles and unwanted event listeners.