Retrieving Strings from a TextField : Text : TextField Flash / Flex / ActionScript examples


Flash / Flex / ActionScript examples » TextField » Text »

 

Retrieving Strings from a TextField


 

package {

    import flash.text.TextField;
    import flash.events.MouseEvent;
    import flash.display.Sprite;
    
    public class WidthHeightTest extends Sprite
    {
       private var txt:TextField;
       public function WidthHeightTest()
       {
    
             txt = new TextField();
             txt.autoSize = "left";
             addChild(txt);
             txt.text = "conductor.";
             txt.addEventListener(MouseEvent.MOUSE_MOVE, getTextUnderMouse);
       }
    
       private function getTextUnderMouse(mouseEvent:MouseEvent):void
       {
             var charInt:int = txt.getCharIndexAtPoint(mouseEvent.stageX, mouseEvent.stageY);
             trace(txt.text.charAt(charInt));
       }
    }
}

        



Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .


Flash / Flex / ActionScript examples

 Navioo TextField
» Text