forked from: flash on 2010-4-13
forked from flash on 2010-4-13 (diff: 3)
ActionScript3 source code
/**
* Copyright akkey.guitar ( http://wonderfl.net/user/akkey.guitar )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/bVWk
*/
// forked from kihon's flash on 2010-4-13
package
{
import flash.display.Sprite;
import flash.text.TextField;
import flash.text.TextFormat;
import flash.display.SimpleButton;
import flash.events.MouseEvent;
public class Main extends Sprite
{
private var tf:TextField;
private var count:int = 0;
public function Main()
{
var up:State = new State(0x0);
var over:State = new State(0xFF4500);
var button:SimpleButton = new SimpleButton(up, over, over, over);
button.x = (stage.stageWidth - button.width) / 2;
button.y = (stage.stageHeight - button.height) / 2;
button.addEventListener(MouseEvent.CLICK, onMouseClick);
addChild(button);
tf = new TextField();
tf.defaultTextFormat = new TextFormat("", 20, 0x0, true);
tf.autoSize = "left";
tf.text = "Click";
addChild(tf);
}
private function onMouseClick(event:MouseEvent):void
{
tf.text = "クリックされました: " + (++count) + "回目";
}
}
}
import flash.display.Sprite;
import flash.text.TextField;
import flash.text.TextFormat;
class State extends Sprite
{
public function State(color:int)
{
graphics.lineStyle(2.0, color);
graphics.beginFill(0xFFFFFF);
graphics.drawRect(0, 0, 100, 50);
graphics.endFill();
var tf:TextField = new TextField();
tf.defaultTextFormat = new TextFormat("_typeWriter", 20, color, true);
//tf.text = "Click";
tf.autoSize = "left";
tf.x = (this.width - tf.width) / 2;
tf.y = (this.height - tf.height) / 2;
tf.selectable = false;
addChild(tf);
}
}
