air
クリックでつぶれる
/**
* Copyright Scmiz ( http://wonderfl.net/user/Scmiz )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/2WCV
*/
package {
import flash.display.Sprite;
import flash.display.Graphics;
public class FlashTest extends Sprite {
public function FlashTest() {
var g:Graphics = this.graphics;
g.beginFill(0xe0e0f0);
g.drawRect(0, 0, 465, 465);
g.endFill();
for (var y:uint = 0; y < 10; ++y) {
for (var x:uint = 0; x < 10; ++x) {
var air:Air = this.addChild(new Air()) as Air;
air.x = 22 + (x * 44) + ((y % 2) * 22);
air.y = 34 + (y * 44);
}
}
}
}
}
import flash.display.Graphics;
import flash.display.SimpleButton;
import flash.display.Sprite;
import flash.events.MouseEvent;
class Air extends SimpleButton {
private var _s:Sprite;
public function Air() {
_s = new Sprite();
var size:Number = 20;
var g:Graphics = _s.graphics;
g.lineStyle(2, 0xc0c0d0);
g.beginFill(0xd0d0e0);
g.drawCircle(0, 0, size);
g.endFill();
super(_s, _s, _s, _s);
this.addEventListener(MouseEvent.CLICK, onClick)
}
private function onClick(e:MouseEvent):void {
this.removeEventListener(MouseEvent.CLICK, onClick);
this.alpha = 0.2;
}
}