トップへ戻るニュースフォーラムFLASH-ML 過去ログBak@Flaダウンロードよくある質問と答
ログイン
ユーザ名:

パスワード:


パスワード紛失

新規登録
メインメニュー
メイン
   ActionScript 3.0 特設会議室
     連番でたくさんあるボタンの処理を、カンタンに定義したい
投稿するにはまず登録を

フラット表示 前のトピック | 次のトピック
投稿者 スレッド
kingofkofs
Åê¹ÆNo.40897
投稿日時: 2008-11-29 20:05
新米
居住地: XIAMEN_CHINA
投稿: 6
使用環境:
Re: 連番でたくさんあるボタンの処理を、カンタンに定義したい
S/he said that s/he would try your suggestion later because of no time today. Then s/he will reply.

so u de su ga

P.S. In your code, the class "btn" should be defined as a dynamic one, otherwise the public property "id" should be declared, shouldn't it?

yes ,btn extends from MovieClip ,so it's not a static class
the public property "id" not be declared will be ok
p.s. (my poor English)

if the btn is in stage already(draged into stage from lib)
and has instance name ...like.. btn1..btn2..btnx
we can use "getChildByName()"


for(var i:int = 1; i<=30; i++ ){
var _mc=stage.getChildByName("btn"+i) as MovieClip
_mc.addEventListener(MouseEvent.MOUSE_UP, myFunc);
}

function myFunc(e:MouseEvent):void{
var namestr:String = e.target.name;
var id:String = (namestr.length < 5) ? namestr.substr(3,1) : namestr.substr(3,2);
trace(id);
}

フラット表示 前のトピック | 次のトピック

題名 投稿者 日時
   連番でたくさんあるボタンの処理を、カンタンに定義したい larrabie 2008-11-28 15:25
     Re: 連番でたくさんあるボタンの処理を、カンタンに定義したい gaienboy 2008-11-28 17:23
     Re: 連番でたくさんあるボタンの処理を、カンタンに定義したい Fumio 2008-11-29 1:05
       Re: 連番でたくさんあるボタンの処理を、カンタンに定義したい kingofkofs 2008-11-29 13:50
         Re: 連番でたくさんあるボタンの処理を、カンタンに定義したい larrabie 2008-11-29 14:34
           Re: 連番でたくさんあるボタンの処理を、カンタンに定義したい kingofkofs 2008-11-29 14:44
             Re: 連番でたくさんあるボタンの処理を、カンタンに定義したい Fumio 2008-11-29 15:01
             » Re: 連番でたくさんあるボタンの処理を、カンタンに定義したい kingofkofs 2008-11-29 20:05
     Re: 連番でたくさんあるボタンの処理を、カンタンに定義したい larrabie 2008-11-29 14:10
       Re: 連番でたくさんあるボタンの処理を、カンタンに定義したい Fumio 2008-11-29 14:55

投稿するにはまず登録を
 
Copyright (C) 2003 FLASH-japan. All rights reserved.
Powered by Xoops