flash on 2010-1-1
♥0 |
Line 35 |
Modified 2010-01-01 05:28:27 |
MIT License
archived:2017-03-30 09:33:40
ActionScript3 source code
/**
* Copyright hacker_9p8x8mco ( http://wonderfl.net/user/hacker_9p8x8mco )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/aUtc
*/
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() {
// write as3 code here..
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 = "楽しいActionScriptの世界へ";
addChild(fld);
fld.selectable = false;
fld.addEventListener(MouseEvent.ROLL_OVER,rollOverHandler);
fld.addEventListener(MouseEvent.ROLL_OUT,rollOutHandler);
}
public function rollOverHandler(event:MouseEvent):void{
fld.textColor = 0xFFFFFF;
fld.backgroundColor = 0x009900;
}
public function rollOutHandler(event:MouseEvent):void{
fld.textColor = 0x000000;
fld.backgroundColor = 0xFFFFFF;
}
}
}