In case Flash no longer exists; a copy of this site is included in the Flashpoint archive's "ultimate" collection.

Dead Code Preservation :: Archived AS3 works from wonderfl.net

Tabキーでフォーカス(黄色い枠)しなくなる

マウスカーソルをボタンの動作(ハンドカーソル)にする
* http://d.hatena.ne.jp/ActionScript/20080927/as3_mouse_cursor_button
* 
* 青ボタンはTabキーでフォーカス(黄色い枠)しなくなる _button2.tabEnabled = false;
Get Adobe Flash player
by dkgkAs 11 Apr 2009
/**
 * マウスカーソルをボタンの動作(ハンドカーソル)にする
 * http://d.hatena.ne.jp/ActionScript/20080927/as3_mouse_cursor_button
 * 
 * 青ボタンはTabキーでフォーカス(黄色い枠)しなくなる _button2.tabEnabled = false;
 */
package  
{
	import flash.display.Sprite;
	import flash.events.Event;
	import flash.events.MouseEvent;
	
	[SWF(width = 465, height = 465, backgroundColor = 0x94e4e8, frameRate = 30)]
	
	public class MouseCursor2 extends Sprite 
	{
		private var _scx:Number;
		private var _scy:Number;
		private var _button1:Sprite;
		private var _button2:Sprite;
		
		public function MouseCursor2():void 
		{
			_scx = stage.stageWidth * 0.5;
			_scy = stage.stageHeight * 0.5;
			
			setup();
			
			this._button1.addEventListener(MouseEvent.CLICK, clickHandler); // 赤ボタン
			this._button2.addEventListener(MouseEvent.CLICK, clickHandler); // 青ボタン
		}
		
		private function clickHandler(event:MouseEvent):void 
		{
			event.target.rotation += 15;
		}
		
		private function setup():void 
		{
			_button1 = createButton(0xcc0000);
			_button1.x = _scx;
			_button1.y = _scy - _button1.height * 2;
			_button1.buttonMode = true;
			this.stage.addChild(_button1);
			
			_button2 = createButton(0x0000cc);
			_button2.x = _scx;
			_button2.y = _scy + _button2.height * 2;
			_button2.buttonMode = true; //
			_button2.tabEnabled = false; // ココ! フォーカス(黄色い枠)しなくなる!
			this.stage.addChild(_button2);
		}
		
		private function createButton(color:uint):Sprite
		{
			var button:Sprite = new Sprite();
			button.graphics.beginFill(color);
			button.graphics.drawRoundRect( -100, -25, 200, 50, 30);
			button.graphics.endFill();
			return button;
		}
		
		
	}
	
}