ozhanlion
04-07-2007, 10:17 PM
can someone tell me if I am doing something wrong with the initial declarations and all that stuff? It keeps showing me error but it doesn't say what it is. I am developing on flex builder 2.
also I am wondering, aren't we supposed to initialize array as fields? so if I declare it in the constructor, is it still valid for throughout the class?
ty
oz
package
{
public class ArraySystem {
public var numParticles;
public function ArraySystem() {
ptCount = 0;
numParticles = 20;
var PRTS = new Array(numParticles);
for (var i:int = 0; < this.numParticles; i++) {
PRTS[i] = new Circle();
}
}
public function draw():void {
for (var i:int = 0; < this.numParticles; i++) {
PRTS[i].getTrace();
}
}
}
}
also I am wondering, aren't we supposed to initialize array as fields? so if I declare it in the constructor, is it still valid for throughout the class?
ty
oz
package
{
public class ArraySystem {
public var numParticles;
public function ArraySystem() {
ptCount = 0;
numParticles = 20;
var PRTS = new Array(numParticles);
for (var i:int = 0; < this.numParticles; i++) {
PRTS[i] = new Circle();
}
}
public function draw():void {
for (var i:int = 0; < this.numParticles; i++) {
PRTS[i].getTrace();
}
}
}
}