テキストロールオーバー
♥0 |
Line 35 |
Modified 2010-01-14 19:27:31 |
MIT License
archived:2017-03-30 05:53:07
ActionScript3 source code
/**
* Copyright _wonder ( http://wonderfl.net/user/_wonder )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/hv6g
*/
package {
import flash.display.Sprite;
import flash.text.TextField;
import flash.text.TextFieldAutoSize;
import flash.text.TextFormat;
import flash.events.MouseEvent;
public class MyTextField extends Sprite {
public var fld:TextField;
public function MyTextField() {
fld = new TextField();
fld.x = 50;
fld.y = 50;
fld.autoSize = TextFieldAutoSize.LEFT;
fld.background = true;
fld.backgroundColor = 0XFFFFFF;
var tf:TextFormat = new TextFormat();
tf.font = "_typewriter";
tf.size = 18;
fld.defaultTextFormat = tf;
fld.text = "its so funny!!!!";
addChild(fld);
fld.selectable = false;
fld.addEventListener(MouseEvent.ROLL_OVER, over);
fld.addEventListener(MouseEvent.ROLL_OUT, out);
}
public function over(e:MouseEvent):void{
fld.textColor = 0XFFFFFF;
fld.backgroundColor = 0X009900;
}
public function out(e:MouseEvent):void{
fld.textColor = 0X000000;
fld.backgroundColor = 0XFFFFFF;
}
}
}