want to remove warnings:

2019-08-21 08:57发布

问题:

I am facing a problem as Duplicate variable definition 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.

回答1:

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
}


回答2:

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