need help with an error 1009
so highschool student , working on project in game design , im working on 1009 ******* comes , have been working on getting rid of few days no luck or bad luck. asked teacher couldnt fix , after 10 minutes said cant fix go forums , had already. in code says line 103 mark line 103 in caps. there a4 , there ship.
import flash.events.keyboardevent;
import flash.events.event;
import flash.display.displayobject;
//go a1, needs fixed
stop();
var speedvert:number=0;
var speedhoriz:number=0;
instr_txt.alpha-=2;
ship.x=275;
ship.y=200;
var angle:number = math.atan2(ship.y - this.y, ship.x - this.x);
var xstep:number = math.cos(angle) * this.speed;
var ystep:number = math.sin(angle) * this.speed;
function q1(evt:mouseevent):void
{
gotoandstop(107);
}
a1.addeventlistener(mouseevent.click, q1);
function moveship(event:keyboardevent):void{
if(event.keycode==38){
ship.y-=3;
}
if(event.keycode==40){
ship.y+=3;
}
}
function rotateship(event:keyboardevent):void{
if(event.keycode==39){
ship.rotation+=5;
}
if(event.keycode==37){
ship.rotation-=5;
}
}
//function shipinit(event:keyboardevent):void{
//attachmovie("ship", "ship_mc", 2);
//ship._x = right/2;
//ship._y = bottom/2;
//ship.velx = 0;
//ship.vely = 0;
//ship.onenterframe = control;
//rotate = 0;
//thrust = 0;
//}
stage.addeventlistener(keyboardevent.key_down, moveship);
stage.addeventlistener(keyboardevent.key_down, rotateship);
function loop(evt:event):void
{
//rocks below
a1.rotation+=12;
a2.rotation+=15;
a3.rotation+=5;
a4.rotation+=10;
a5.rotation+=11;
if(a1.y<=-50)
{
a1.y=435;
}
if(a2.y<=-50)
{
a2.y=445;
}
if(a3.x<=-55)
{
a3.x=614;
}
if(a4.x>=614)
{
a4.x=-30;
}
if(a5.y>=450)
{
a5.y=-30;
}
a1.y-=1;
a2.y-=2;
a3.x-=3;
a4.x+=2;
a5.y+=1;
}
a4.gotoandstop("liquid");
stage.addeventlistener(event.enter_frame, loop);
ship.addeventlistener(event.enter_frame, stage2);
function stage2(evt:event):void
{
if (ship.hittestobject(a4)){ (this line 103)
gotoandstop(128);
//stage.removeeventlistener(keyboardevent.key_down, moveship);
//stage.removeeventlistener(keyboardevent.key_down, rotateship);
stage.removeeventlistener(event.enter_frame, stage2);
stage.removeeventlistener(event.enter_frame, loop);
}
}
/*function reseta (evt:event):void{
if (ship.hittestobject(a4)){
a4.x=-30
}
}
ship.addeventlistener(event.enter_frame,reseta);*/
i've answered once:
either ship or a4 null (ie, don't exist) when line of code executes.
More discussions in ActionScript 3
adobe
Comments
Post a Comment