3 Replies Latest reply on Jan 17, 2014 10:50 AM by kglad

    error 1009

    codester000101000
      I have an error 1009 that I have looked everywhere to solve. i tried debugging and it said it was in line 103. i will say "this is 103" in caps on line 103. the remove event listeners in stage 2 were me trying to fix the  problem
      
      import flash.events.KeyboardEvent;
      import flash.events.Event;
      import flash.display.DisplayObject;
      
      
      //go to a1, it needs to be 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");
      
      
      function stage2(evt:Event):void
      {
      (THIS IS 103)          if (ship.hitTestObject(a4)){
                          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);*/
      ship.addEventListener(Event.ENTER_FRAME, stage2);
      stage.addEventListener(Event.ENTER_FRAME, loop);