开发者

Why won't this code work?

开发者_开发百科

This is a simple actionscript code. Why won't it work?

for (var inc = 1; inc <= 18; inc++)
{
    current = "cb"+inc;
    current.addEventListener(Event.CHANGE, storedata);
}


What you are probably meaning to do is this:

for (var inc = 1; inc <= 18; inc++)
{
    this["cb"+inc].addEventListener(Event.CHANGE, storedata);
}


current in your code seems to be a String. You can't add an event listener to a String.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜