开发者

want to remove warnings:

开发者 https://www.devze.com 2022-12-21 11:44 出处:网络
I am facing a problem as Duplicate variable 开发者_如何学Godefinition while compiling but it is not at all effecting my program.

I am facing a problem as Duplicate variable 开发者_如何学Godefinition while compiling but it is not at all effecting my program.

Is there any way to remove compiler errors beacause it is coming every time when i run movie.


Remove the duplicate variable definition. I suspect that you are doing something like the following:

function foo() : void {
    for(var i:uint=0; i<10; i++) {
        // do stuff in here
    } 
    for(var i:uint=0; i<10; i++) {
        // do stuff in here
    }
}  

This will complain about duplicate variable definitions at compilation because you've got two definitions of i. During compilation, actionscript does what's called "variable hoisting". It means that all variables declarations are moved to the top of the function. (I don't know exactly why it does this) If you make the second loop look like the following, the warning will go away:

for(i=0; i<10; i++) {
    // do stuff here
}


Try from the Edit menu Preferences/Warnings and check off those warnings that you don't want to see.

0

精彩评论

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