superpeppe
August 13th, 2007, 10:19 AM
Hi
Usually when you use the for statement you want the starting value to be 0, and the ending value to be larger than 0. But I need it to count down, so let's say we have the following code:
package {
import Array;
import flash.display.Sprite;
public class test extends Sprite {
private var ARRAY:Array = [123, 456, 789]
public function test ():void {
for (var i:uint = ARRAY.length-1; i >= 0; i--) {
ARRAY[i]*=.5;
}
}
}
}
It returns an error:TypeError: Error #1010: A term is undefined and has no properties.
How should I then get it to count down?
Thanks in advance!
Usually when you use the for statement you want the starting value to be 0, and the ending value to be larger than 0. But I need it to count down, so let's say we have the following code:
package {
import Array;
import flash.display.Sprite;
public class test extends Sprite {
private var ARRAY:Array = [123, 456, 789]
public function test ():void {
for (var i:uint = ARRAY.length-1; i >= 0; i--) {
ARRAY[i]*=.5;
}
}
}
}
It returns an error:TypeError: Error #1010: A term is undefined and has no properties.
How should I then get it to count down?
Thanks in advance!