This code works perfectly except when I make reference to the stage width/height.
I get a error like “TypeError: Error #1009: can’t make reference to a null object”
What’s going on?
(yes I’m a AS3 newbie)
package{
import flash.display.MovieClip;
import flash.display.Stage;
public class circulo extends MovieClip{
public var radio:Number;
public function circulo(){
radio = Math.floor(Math.random()*100);
this.width = radio * 2;
this.height = radio * 2;
this.x = Math.floor(Math.random() * stage.stageWidth);
this.y = Math.floor(Math.random() * stage.stageHeight);
}
}
}