Can I change mouse cursor for textfield to appear as a clickable object?
import flash.display.*;
import flash.e开发者_运维百科vents.*;
import flash.geom.*;
import flash.net.*;
import flash.text.*;
import flash.ui.ContextMenu;
import flash.utils.*;
import mx.core.*;
You need to put the TextField inside a Sprite, sent the TextField's mouseEnabled to false, and the Sprite's buttonMode to true. For example:
var spr:Sprite = new Sprite();
var txt:TextField = new TextField();
txt.text = "Hello World!";
txt.mouseEnabled = false;
spr.buttonMode = true;
spr.addChild(txt);
addChild(spr);
I assume you want the cursor to be a hand, which is a default for clickable objects. Try the following AS code:
myTextField.buttonMode = true;
myTextField.useHandCursor = true;
myTextField.mouseChildren = false;
Or, in MXML:
<mx:Text buttonMode="true" useHandCursor="true" mouseChildren="false" />
See this article for an explanation.
Edit: This code uses the mx.controls.Text object. If you want it to work with flash.text.TextField objects, use the solution provided by davr.
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论