<p>I'm an experienced programmer but just starting out with Flash/Actionscript. I'm working on a project that for certain reasons requires me to use Actionscript 2 rather than 3.</p>

<p>When I run the following (I just put it in frame one of a new flash project), the output is a 3 rather than a 1 ? I need it to be a 1.</p>

<p>Why does the scope of the 'ii' variable continue between loops?</p>

<pre><code>var fs:Array = new Array();

for (var i = 0; i &lt; 3; i++){

    var ii = i + 1; 
    fs[i] = function(){
        trace(ii);
    }
}

fs[0]();
</code></pre>

Unfortunately Actionscript 2.0 does not have a strong scope... especially on the time line.
```
```
var fs:Array = new Array();

for (var i = 0; i < 3; i++){

    var ii = i + 1;     
    fs[i] = function(){
        trace(ii);
    }
}

fs[0]();
trace("out of scope: " + ii + "... but still works");
```
```