[memo] タブキー移動を無効にする
♥0 |
Line 31 |
Modified 2010-08-31 03:50:26 |
MIT License
archived:2017-03-09 19:41:43
ActionScript3 source code
/**
* Copyright yoshiweb ( http://wonderfl.net/user/yoshiweb )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/3rHV
*/
package {
import flash.text.TextFieldAutoSize;
import flash.display.Sprite;
import flash.text.TextField;
public class FlashTest extends Sprite {
public function FlashTest() {
// write as3 code here..
var box1:Sprite = createSpriteRect(80,80,0xFF0000);
box1.x = 50;
box1.y = 50;
this.addChild( box1 );
var box2:Sprite = createSpriteRect(80,80,0xFF0000);
box2.x = 250;
box2.y = 50;
this.addChild( box2 );
box1.buttonMode = true;
box2.buttonMode = true;
// TAB キーを無効にする
stage.stageFocusRect = false;
//
var txt:TextField = new TextField();
txt.autoSize = TextFieldAutoSize.LEFT;
this.addChild(txt);
txt.text = "タブキーを無効にしておかないと隠しボタンなどを実行されるかも!?";
}
/**
* 四角を描く( Sprite )
* @param width 横幅
* @param height 縦幅
* @param rgb 色
*/
private function createSpriteRect(width:Number=100, height:Number=100, rgb:Number=0x000000):Sprite {
var sp:Sprite = new Sprite();
sp.graphics.beginFill(rgb);
sp.graphics.drawRect(0, 0, width, width);
sp.graphics.endFill();
return sp;
}
}
}