I am trying to create a swarm behaviour with a papervision 3D cube, but to create an object pool i need to pass a Class, so i tried creating an external class “flyingCube”
public function flyingCube() {
var cube = new Cube(null,240, 240, 240,1,1);
}
and import it into my main
var pool:ObjectPool = new ObjectPool(flyingCube, 20);
i get this error
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at org.papervision3d.objects.primitives::Cube()
at flyingCube()
at hype.framework.core::ObjectPool/makeRandomObject()
at hype.framework.core::ObjectPool/request()
at Function/<anonymous>()
..
what i am doing wrong (i am not an advanced coder so it could be obvious ^^)