リプタクのもう覚えられません
Google
Web サイト内
topmemo ▶ ボタンサンプル01

ActionScript

ボタンサンプル01

ボタンのサンプル。詳細は.flaファイルにて確認。

【サンプル】

JavaScriptを有効にし、最新のFlashPlayerをインストールお願いしますGet Adobe Flash player

サンプル(bt_sample01_cs3.flaファイル)をダウンロード


【メインフレーム ActionScript3.0 サンプルソースコード】

stop();

//他のボタンがoffかどう確認とリセット-----------------------------------------------------
function Reset(event:MouseEvent):void {
//ラベル確認
	trace("bt_sample_01のラベルは",this.bt_sample_01.currentLabel);
	trace("bt_sample_02のラベルは",this.bt_sample_02.currentLabel);
	trace("bt_sample_03のラベルは",this.bt_sample_03.currentLabel);
	trace("bt_sample_04のラベルは",this.bt_sample_04.currentLabel);
	trace("bt_sample_05のラベルは",this.bt_sample_05.currentLabel);
	trace("bt_sample_06のラベルは",this.bt_sample_06.currentLabel);
	trace("bt_sample_07のラベルは",this.bt_sample_07.currentLabel);
	trace("bt_sample_08のラベルは",this.bt_sample_08.currentLabel);
	
	//ラベルがBならAへ
	if (this.bt_sample_01.currentLabel=="B") {
		this.bt_sample_01.gotoAndStop("A");
		this.bt_sample_01.mouseEnabled = true;//マウス有効
		this.bt_sample_01.mouseChildren = true;//マウス有効
	}
	if (this.bt_sample_02.currentLabel=="B") {
		this.bt_sample_02.gotoAndStop("A");
		this.bt_sample_02.mouseEnabled = true;//マウス有効
		this.bt_sample_02.mouseChildren = true;//マウス有効
	}
	if (this.bt_sample_03.currentLabel=="B") {
		this.bt_sample_03.gotoAndStop("A");
		this.bt_sample_03.mouseEnabled = true;//マウス有効
		this.bt_sample_03.mouseChildren = true;//マウス有効
	}
	if (this.bt_sample_04.currentLabel=="B") {
		this.bt_sample_04.gotoAndStop("A");
		this.bt_sample_04.mouseEnabled = true;//マウス有効
		this.bt_sample_04.mouseChildren = true;//マウス有効
	}
	if (this.bt_sample_05.currentLabel=="B") {
		this.bt_sample_05.gotoAndStop("A");
		this.bt_sample_05.mouseEnabled = true;//マウス有効
		this.bt_sample_05.mouseChildren = true;//マウス有効
	}
	if (this.bt_sample_06.currentLabel=="B") {
		this.bt_sample_06.gotoAndStop("A");
		this.bt_sample_06.mouseEnabled = true;//マウス有効
		this.bt_sample_06.mouseChildren = true;//マウス有効
	}
	if (this.bt_sample_07.currentLabel=="B") {
		this.bt_sample_07.gotoAndStop("A");
		this.bt_sample_07.mouseEnabled = true;//マウス有効
		this.bt_sample_07.mouseChildren = true;//マウス有効
	}
	if (this.bt_sample_08.currentLabel=="B") {
		this.bt_sample_08.gotoAndStop("A");
		this.bt_sample_08.mouseEnabled = true;//マウス有効
		this.bt_sample_08.mouseChildren = true;//マウス有効
	}
}

//ボタンインスタンスと関数の関連付け
bt_sample_01.addEventListener(MouseEvent.CLICK,Reset);
bt_sample_02.addEventListener(MouseEvent.CLICK,Reset);
bt_sample_03.addEventListener(MouseEvent.CLICK,Reset);
bt_sample_04.addEventListener(MouseEvent.CLICK,Reset);
bt_sample_05.addEventListener(MouseEvent.CLICK,Reset);
bt_sample_06.addEventListener(MouseEvent.CLICK,Reset);
bt_sample_07.addEventListener(MouseEvent.CLICK,Reset);
bt_sample_08.addEventListener(MouseEvent.CLICK,Reset);

//ボタンラベルBへ移動-----------------------------------------------------------------------------
function BtB01(event:MouseEvent):void {
	this.bt_sample_01.gotoAndStop("B");
	this.bt_sample_01.mouseEnabled = false;//マウス無効
	this.bt_sample_01.mouseChildren = false;//マウス無効
}
function BtB02(event:MouseEvent):void {
	this.bt_sample_02.gotoAndStop("B");
	this.bt_sample_02.mouseEnabled = false;//マウス無効
	this.bt_sample_02.mouseChildren = false;//マウス無効
}
function BtB03(event:MouseEvent):void {
	this.bt_sample_03.gotoAndStop("B");
	this.bt_sample_03.mouseEnabled = false;//マウス無効
	this.bt_sample_03.mouseChildren = false;//マウス無効
}
function BtB04(event:MouseEvent):void {
	this.bt_sample_04.gotoAndStop("B");
	this.bt_sample_04.mouseEnabled = false;//マウス無効
	this.bt_sample_04.mouseChildren = false;//マウス無効
}
function BtB05(event:MouseEvent):void {
	this.bt_sample_05.gotoAndStop("B");
	this.bt_sample_05.mouseEnabled = false;//マウス無効
	this.bt_sample_05.mouseChildren = false;//マウス無効
}
function BtB06(event:MouseEvent):void {
	this.bt_sample_06.gotoAndStop("B");
	this.bt_sample_06.mouseEnabled = false;//マウス無効
	this.bt_sample_06.mouseChildren = false;//マウス無効
}
function BtB07(event:MouseEvent):void {
	this.bt_sample_07.gotoAndStop("B");
	this.bt_sample_07.mouseEnabled = false;//マウス無効
	this.bt_sample_07.mouseChildren = false;//マウス無効
}
function BtB08(event:MouseEvent):void {
	this.bt_sample_08.gotoAndStop("B");
	this.bt_sample_08.mouseEnabled = false;//マウス無効
	this.bt_sample_08.mouseChildren = false;//マウス無効
}

//ボタンインスタンスと関数の関連付け
bt_sample_01.addEventListener(MouseEvent.CLICK,BtB01);
bt_sample_02.addEventListener(MouseEvent.CLICK,BtB02);
bt_sample_03.addEventListener(MouseEvent.CLICK,BtB03);
bt_sample_04.addEventListener(MouseEvent.CLICK,BtB04);
bt_sample_05.addEventListener(MouseEvent.CLICK,BtB05);
bt_sample_06.addEventListener(MouseEvent.CLICK,BtB06);
bt_sample_07.addEventListener(MouseEvent.CLICK,BtB07);
bt_sample_08.addEventListener(MouseEvent.CLICK,BtB08);
last update 2009.1.17
参考・出典等
「特に無し」

▲page top

topmemoblogtestaboutmail
Copylight(C)2008 Riptac. All Rights Reserved.