Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/actionscript-3/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Flash Actionscript中的事件:如何通过单击stage上的对象来获取实例名称值? //我在舞台上创建了四个movieclip实例,并将它们命名为t1\u mc、t2\u mc、t3\u mc、t4\u mc //然后我制作了一个数组,并将它们加载到数组中 var arr1:数组=新数组(t1\u mc、t2\u mc、t3\u mc、t4\u mc); 变量名称:字符串; //用于向每个对象添加事件侦听器的函数 函数addListner():void { 对于(变量i:uint=0;i_Flash_Actionscript 3 - Fatal编程技术网

Flash Actionscript中的事件:如何通过单击stage上的对象来获取实例名称值? //我在舞台上创建了四个movieclip实例,并将它们命名为t1\u mc、t2\u mc、t3\u mc、t4\u mc //然后我制作了一个数组,并将它们加载到数组中 var arr1:数组=新数组(t1\u mc、t2\u mc、t3\u mc、t4\u mc); 变量名称:字符串; //用于向每个对象添加事件侦听器的函数 函数addListner():void { 对于(变量i:uint=0;i

Flash Actionscript中的事件:如何通过单击stage上的对象来获取实例名称值? //我在舞台上创建了四个movieclip实例,并将它们命名为t1\u mc、t2\u mc、t3\u mc、t4\u mc //然后我制作了一个数组,并将它们加载到数组中 var arr1:数组=新数组(t1\u mc、t2\u mc、t3\u mc、t4\u mc); 变量名称:字符串; //用于向每个对象添加事件侦听器的函数 函数addListner():void { 对于(变量i:uint=0;i,flash,actionscript-3,Flash,Actionscript 3,我不知道我错在哪里 请帮助……非常感谢你,你是一个超级英雄,我得到了我想要的bt,你能解释一下到底发生了什么吗。。。。!!!。。。“Event”是一种类型(类名),“e”函数参数是对MouseEvent的特定实例的引用,该实例由侦听器处理,并具有所需的“target”值。唯一一次使用ClassName.property格式是在访问类静态成员时,而“target”不是。 // I created four instance of movieclip on stage and named them

我不知道我错在哪里


请帮助……

非常感谢你,你是一个超级英雄,我得到了我想要的bt,你能解释一下到底发生了什么吗。。。。!!!。。。“Event”是一种类型(类名),“e”函数参数是对MouseEvent的特定实例的引用,该实例由侦听器处理,并具有所需的“target”值。唯一一次使用ClassName.property格式是在访问类静态成员时,而“target”不是。
// I created four instance of movieclip on stage and named them t1_mc,t2_mc,t3_mc,t4_mc 

// Then I made and array and loaded them inside the array

var arr1:Array = new Array( t1_mc, t2_mc, t3_mc, t4_mc );


var names:String;


//function made to add event listener to each object

function addListner():void

{

       for ( var i:uint = 0; i < arr1.length; i++ )

                   {

                  // Here We are creating four eventlisteners with a function  dispNm

                     names = arr1[i].name;
                       names + arr1[i].addEventListener(MouseEvent.CLICK, dispNm);

                   }

}

// this will run the function

addListner();

//next I created the dispNm method in this I am trying to get the value "t1" in output by clicking the object named "t1_mc" but I get error!!!!! 

"1119: Access of possibly undefined property target through a reference with static type Class."

function dispNm(e:MouseEvent):void

{

    if( Event.target.name == 't1_mc')

    {

        trace('t1');

    }

}
function dispNm(e:MouseEvent):void
{
    trace(e.target.name);
}