Thursday, March 31, 2011

Cursor disappears when TextField.selectable = false;

Cursor disappears when

TextField.selectable = false;

How can I make cursor to be visible but textfield not selectable(with mouse) or CTRL+A.

From stackoverflow
  • I believe flash/as3 sees the text cursor as a zero width selection, I dont see how it should be possible to do what you want to here, except maybe extending textfield and placing your own cursor on mouseevents

  • I've seen a similar problem in the past, but I don't remember how to duplicate it. It no longer appears in the project I first saw it in, so the two things which I know have happened since then are below. Of course, there could be some other variable, but the project is working now...

    I suspect that the field is still editable. That would be my first guess. The first thing I would try then:

    //( in a flash.text object ( Flash or Flex ) )
    myTxtFld.type = TextFieldType.DYNAMIC;
    
    //( in a mx.controls object ( Flex ) )
    myTxtFld.editable = false;
    

    If that does not work, try nesting the TextField in something with a MouseEvent.ROLL_OVER listener and useHandCursor set to False. eg:

    var spt:Sprite = new Sprite();
    spt.useHandCursor = false;
    spt.addChild( myTxtFld );
    spt.addEventListener( MouseEvent.ROLL_OVER, function( anon:* ){} );
    

0 comments:

Post a Comment