ボタンを押し続けると動く、離すと止まる
- いつ:ボタン(rotation_btn)を押したとき
- 何が:クマ?(bear_mc)が
- どうする:10度ずつ右回転し続ける
on (press) { var rota:Number = 10; bear_mc.onEnterFrame = function() { bear_mc._rotation += rota; } } on (release) { bear_mc.onEnterFrame = undefined; }
イベントハンドラメソッド(匿名関数)
var rota:Number = 10; rotation_btn.onPress = function() { bear_mc.onEnterFrame = function() { bear_mc._rotation += rota; } } rotation_btn.onRelease = function() { bear_mc.onEnterFrame = undefined; }
var rota:Number = 10; rotation_btn.onPress = bearRota; function bearRota():Void { bear_mc.onEnterFrame = function() { bear_mc._rotation += rota; } } rotation_btn.onRelease = bearStop; function bearStop():Void { bear_mc.onEnterFrame = undefined; }