flash on 2010-4-13
♥0 |
Line 34 |
Modified 2010-04-13 22:49:20 |
MIT License
archived:2017-03-10 12:59:11
ActionScript3 source code
/**
* Copyright kihon ( http://wonderfl.net/user/kihon )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/cyrG
*/
package
{
import flash.display.Sprite;
import flash.events.Event;
import flash.events.MouseEvent;
import flash.text.TextField;
import flash.text.TextFormat;
public class Main extends Sprite
{
private var scoreA:int = 0; // 目標値
private var scoreB:int = 0; // 表示用
private var tf:TextField;
public function Main()
{
stage.frameRate = 60;
tf = new TextField();
tf.defaultTextFormat = new TextFormat("メイリオ,_typeWriter", 60, 0x0);
tf.autoSize = "left";
addChild(tf);
stage.addEventListener(MouseEvent.CLICK, onMouseClick);
addEventListener(Event.ENTER_FRAME, onEnterFrame);
}
private function onMouseClick(event:MouseEvent):void
{
scoreA = Math.random() * 200;
}
private function onEnterFrame(event:Event):void
{
tf.text = scoreB.toString();
if (scoreA < scoreB) scoreB--;
else if (scoreA > scoreB) scoreB++;
}
}
}