2010-03-29 OkAGOSTINI 第4号 ボタンで操作
/**
* Copyright darman ( http://wonderfl.net/user/darman )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/reNN
*/
package {
import flash.display.*;
import flash.events.*;
public class FlashTest extends Sprite {
private var _baseBtn:BaseBtn;
private var _box:Sprite;
private var _toWay:Number=0;
public function FlashTest() {
_baseBtn = new BaseBtn();
addChild(_baseBtn);
_box = new Sprite();
_box.graphics.beginFill(0x55ff55);
_box.graphics.drawRect(0,0,150,150);
_box.graphics.endFill();
_box.x = stage.stageWidth / 2 - _box.width / 2;
_box.y = stage.stageHeight / 2 - _box.height;
addChild(_box);
}
}
}
import flash.display.Sprite;
import flash.events.MouseEvent;
class BaseBtn extends Sprite {
public function BaseBtn(){
buttonMode = true;
graphics.beginFill(0xff5555);
graphics.drawRoundRect(0,0,130,30,15);
graphics.endFill();
addEventListener(MouseEvent.MOUSE_OVER, _over );
addEventListener(MouseEvent.MOUSE_OUT, _out );
}
private function _over(e:MouseEvent):void {
e.target.alpha = 0.7;
}
private function _out(e:MouseEvent):void {
e.target.alpha = 1;
}
}