This is hard to do. See Link, enter the link here. As you can see, you can check if DisplayObject is StaticText, and by checking the properties of mousX and MouseY, you can find out if this is related to the rollover of this field. If you use dynamic text and clear the selected field, you will get a text field that acts like a StaticField
EDIT this explanation of what I mean: Let us have a static Text field in Black Flash text.
var myFieldLabel:StaticText var i:uint; //This for check for all staticFields in state and trace its text. It is possible and it is working. I my case I have only one field and I get reference to it in myFieldLabel:StaticText var. Also I change it alpha to 0.3. for (i = 0; i < this.numChildren; i++) { var displayitem:DisplayObject = this.getChildAt(i); if (displayitem instanceof StaticText) { trace("a static text field is item " + i + " on the display list"); myFieldLabel = StaticText(displayitem); trace("and contains the text: " + myFieldLabel.text); trace( myFieldLabel.mouseX); myFieldLabel.alpha = 0.3; } } //Adds event listener to the stage for mouse move event stage.addEventListener(MouseEvent.MOUSE_MOVE, mouseRollOver); //This is an event handler. I check if the mouse position is within the static field function mouseRollOver(evnt:MouseEvent):void { if ( 0 <= myFieldLabel.mouseX && myFieldLabel.mouseX <= myFieldLabel.width && 0 <= myFieldLabel.mouseY && myFieldLabel.mouseY <= myFieldLabel.height ) { mouseOverStaticText( evnt) } else { mouseNotOverStaticText( evnt) } } // this two methods change the static field alpha. Thay are only to show that is posible to detect and manipulate some properties of the StaticField. function mouseOverStaticText( evnt) { myFieldLabel.alpha = 1; } function mouseNotOverStaticText( evnt) { myFieldLabel.alpha = 0.3; }
I'm not sure what the purpose of managing a StaticText field is. StaticText is not design driven, if you need to do something, it is almost certain that the field should not be static - they can be dynamic (without a selective property) or can be copied using MovieClip or there may be another solution in your case.
source share