package {
import flash.display.MovieClip
import flash.events.Event
public dynamic class dude extends MovieClip{
try
{
//public var _dude:dude;
public const TYNGDE:Number = 2;
private var _vx:Number = 0;
private var _vy:Number = 0;
public var _dude:dude;
public function Test():void {
try
{
_dude.x = 100;
_dude.y = 100;
}
catch ( e:Error )
{
trace("Feilen er: " + e);
}
addEventListener(Event.ENTER_FRAME, nyskjerm);
}
private function nyskjerm(e:Event):void{
_vy += TYNGDE;
try
{
_dude.x += _vx;
_dude.y += _vy;
}
catch ( e:Error )
{
trace("Feilen er: " + e);
}
SjekkBrett();
}
private function SjekkBrett():void{
if (_dude.x < 0 && _vx < 0){
_dude.x = 0;
_vx *= -1;
}
else if ((_dude.x+100) > stage.stageWidth && _vx > 0){
_dude.x = stage.stageWidth - 100;
_vx *= -1;
}
else if (_dude.y <0 && _vy <0){
_dude.y = 0;
_vy *= -1;
}
else if ((_dude.y+200) > stage.stageHeight && _vy > 0){
_dude.y = stage.stageHeight - 200;
_vy *= -0.8;
}
}
}
catch ( e:Error )
{
trace("Feilen er: " + e);
}
}}
我试过给这个类赋予与舞台相同的名称。我试过不实例化花花公子,直接访问它,也不起作用。该错误表明故障起源于第 1 行,但这对我来说没有多大意义。帮助?