int(Number)
♥0 |
Line 43 |
Modified 2009-06-12 16:39:34 |
MIT License
archived:2017-03-20 15:30:07
ActionScript3 source code
/**
* Copyright atsumo ( http://wonderfl.net/user/atsumo )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/qjdp
*/
package {
import flash.display.Sprite;
import flash.events.Event;
import flash.events.MouseEvent;
import flash.text.TextField;
public class FlashTest extends Sprite {
private var _txtField:TextField;
public function FlashTest() {
_txtField = new TextField();
_txtField.height = 200;
_txtField.width = 300;
_txtField.multiline = true;
_txtField.x = 5;
_txtField.y = 100;
addChild(_txtField);
var sp:Sprite = new Sprite();
sp.graphics.beginFill(0x000000);
sp.graphics.drawRect(0,0,80,30);
sp.graphics.endFill();
sp.x = 5;
sp.y = 5;
sp.buttonMode = true;
sp.addEventListener(MouseEvent.CLICK , onClickHandler );
var tf:TextField = new TextField();
tf.text = "再計算";
tf.textColor = 0xFFFFFF;
tf.selectable = false;
tf.mouseEnabled = false;
tf.x = 20;
tf.y = 5;
sp.addChild(tf);
addChild(sp);
}
private function onClickHandler(e:Event):void
{
var num:Number = Math.random()*5;
_txtField.text = "";
_txtField.appendText("num:Number = "+num+"\n");
_txtField.appendText("int(num) = "+int(num)+"\n");
_txtField.appendText("Math.floor(num) = "+Math.floor(num)+"\n");
}
}
}