well i have this code as compiled class
package
{
import flash.display.Sprite;
import flash.display.StageAlign;
import flash.display.StageScaleMode;
import flash.events.Event;
public class Bouncing extends Sprite
{
private var ball:Ball;
private var vx:Number;
private var vy:Number;
public function Bouncing();
{
init();
}
private function init():void
{
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.align = StageAlign.TOP_LEFT;
ball = new Ball();
ball.x = stage.stageWidth / 2;
ball.y = stage.stageHeight / 2;
vx = Math.random() * 10 - 5;
vy = Math.random() * 10 - 5;
addChild(ball);
}
}
}
and this sub-class
package
{
import flash.display.Sprite;
public class Ball extends Sprite
{
public var radius:Number;
private var color:uint;
public function Ball(radius:Number = 20, color:uint = 0xFF0000)
{
this.radius = radius;
this.color = color;
init();
}
public function init():void
{
graphics.beginFill(color);
graphics.drawCircle(0, 0, radius);
graphics.endFill();
}
}
}
I get no complier errors , but the swf is empty(background color 0x000000).
Can’ t find the error which drives me crazy! Anyone experienced similar situation? :yoda:(always wanted to use yoda!)