2012-06-06 乱数を表示 ActionScript 0〜1までの乱数を表示。 ans_txt = Math.random(); //Math.random→ランダム数字 ボタン制御の場合 1.オブジェクトアクション on(release){ rnd_txt.text=Math.random(); } 2.イベントハンドラメソッド(匿名関数) push_btn.onRelease = function() { rnd_txt.text = Math.random(); } 1〜6までランダムに表示する。 on (release) { rnd_txt.text = Math.floor(Math.random() * 6) + 1; //floor→小数点以下を切り捨てる }