作者hirabbitt (兔子)
看板Flash
标题[问题] 用for做function
时间Mon Dec 12 00:26:30 2011
for(i=0;i<5;i++){
questImage=new canGet();
questImage.addEventListener(MouseEvent.CLICK,function(e:MouseEvent):void{
var tempi:int=i;
trace(i+" "+tempi); //实际在按的时候i和tempi印出来都是1 但我想要0~4
});
}
我有想过把i传值传进去
但是不知道MouseEvent.CLICK的function是否可以直接function(e:MouseEvent,temp:int)
感谢
--
◤ __ \__◣
◢◤◢◤ ψhirabbitt
◢ ◤ ◢███◣
◢███◣
我摸不到你 █████
█████ 你摸不到我
██
●█
● █▇███
██
╱╲ ●◥█████◣●
◥
╱█
╱╱ ● ◥████
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 125.228.252.92
※ 编辑: hirabbitt 来自: 125.228.252.92 (12/12 00:26)
1F:推 cjcat2266: 3>7>3>1 12/12 04:16
2F:→ hirabbitt:对不起我没有仔细看>_< 12/12 08:53
3F:→ hirabbitt:所以说Dictionary就是不限定[]里面只能放数字或字串的 12/12 08:53
4F:→ hirabbitt:Array喽 12/12 08:53
5F:推 chengchieh:dict的index跟value都没有限制型别 12/12 09:20
6F:→ chengchieh:你的canGet是自订的class...也可以考虑增加一个index 12/12 09:21
7F:→ chengchieh:的变数吧...有需要常用到的话 12/12 09:21