i want the class BeginBall to extend Ball, but when i do so, this error shows up.
this is my code:
i tried to do public last class Ball, butit says access identifiers are not allowed with namespace attributes.PHP Code:package
{
import flash.events.Event;
import flash.display.MovieClip;
public class Ball extends MovieClip
{
public var nSpeedX:Number;
public var nSpeedY:Number;
public var ballNr:int;
const BALLDIAMETER = 10;
private var nStageWidth:Number = 500;
private var nStageHeight:Number = 400;
public function Ball ( X,Y,NSpeedX:Number, NSpeedY:Number ) : void
{
nSpeedX = NSpeedX;
nSpeedY = NSpeedY;
x = X;
y = Y;
this.addEventListener ( Event.ENTER_FRAME, onEnterFrameHandler );
}
private function onEnterFrameHandler ( E:Event ) : void
{
this.x -= nSpeedX;
this.y -= nSpeedY;
if ( this.x >= nStageWidth - BALLDIAMETER - 16 )
{
this.x = nStageWidth - BALLDIAMETER - 16;
nSpeedX *= -1;
}
else if ( this.x <= BALLDIAMETER + 16 )
{
this.x = BALLDIAMETER + 16;
nSpeedX *= -1;
}
if ( this.y >= nStageHeight - BALLDIAMETER - 16 )
{
this.y = nStageHeight - BALLDIAMETER - 16;
nSpeedY *= -1;
}
else if ( this.y <= BALLDIAMETER + 16 )
{
this.y = BALLDIAMETER + 16;
nSpeedY *= -1;
}
}
}//end of class
public class BeginBall extends Ball
{
//alles over spatieknop en muisknop etc.
}
}
how can i let BeginBall normally inherit Ball's constructor, or if its not possible, make a new one for BeginBall?




Reply With Quote