Joke Collection Website - News headlines - In flash, you want to move the mouse to the button and display a text explanation. How can you use flash scripting language? .....

In flash, you want to move the mouse to the button and display a text explanation. How can you use flash scripting language? .....

Define MOUSE_OVER and MOUSE_OUT events for the button. When the MOUSE_OVER event is triggered, dynamically generate a text box in an appropriate position, and then add some custom attributes to the text box (of course, you can also add styles to the text box). When the MOUSE_OUT event is triggered, you can just remove the text box just generated.

use as3. to write a simple one for you on the flash frame: (drag a Button from the component to the stage, and the instance is called btn)

code on the frame:

stop ();

var? txt:TextField;

btn.addEventListener(MouseEvent.MOUSE_OVER,btnOver);

btn.addEventListener(MouseEvent.MOUSE_OUT,btnOut);

function? btnOver(evt:MouseEvent):void{

txt? =? new? TextField();

txt.text? =? evt.target.label;

addChild(txt);

txt.width? =? evt.target.width;

txt.height? =? 2;

txt.x? =? btn.x;

txt.y? =? btn.y-txt.height;

}

function? btnOut(evt:MouseEvent):void{

if(txt? ! =? null){

removeChild(txt);

txt? =? null;

}

}

When the mouse moves over the button: