5 Replies Latest reply: Jul 16, 2012 4:17 AM by Ned Murphy RSS

    stop() not working?

    Matt201496 Community Member

      stop() won't work in the code i want it in or just a new project to test it. it is in the first frame. In both of them it still continues the code and everything works fine.

       

      I used this to test it :

      stop();

       

      trace("abc");

       

      And here is the code i'm working on:

       

          

      stop();

       

      addEventListener(Event.ENTER_FRAME,LoadingProgress)

       

      function LoadingProgress(evt:Event){

          if(this.currentFrame == 1){

              var moviebytesloaded:int = this.root.loaderInfo.bytesLoaded

              var moviebytesleft:int = this.root.loaderInfo.bytesTotal

              var movieKloaded = moviebytesloaded / 1024;

              var movieKleft = moviebytesleft / 1024;

              var loadLoc1:int = stage.width / 2;

              var loadLoc2:int = stage.height / 2;

              var loadingText:TextField = new TextField()

             

              loadingText.text = "Loading: "+movieKloaded+"K/ "+movieKleft+"K";

              loadingText.x = loadLoc1;

              loadingText.y = loadLoc2;

              trace("LoadingProgress")

             

              }

          }

       

       

       

       

      var gravity:Number = .0098;

      var accelY = 6;

      var accelX =10;

      var dragX = .5;

       

      ball.x = 10;

      ball.y = 10;

       

      addEventListener(Event.ENTER_FRAME,Gravity)

      addEventListener(Event.ENTER_FRAME,Throw)

      addEventListener(Event.ENTER_FRAME,Drag)

      addEventListener(Event.ENTER_FRAME,CheckCollision)

       

      function CheckCollision(evt:Event){

          if (floor.hitTestObject(ball)){

              accelY = 0;

              accelX = 0;

              ball.y + .0098;

              dragX = 0;

             

              }

          }

       

      function Drag(evt:Event){

          ball.x -= dragX;

          }

      function Throw(evt:Event){

          ball.x += accelY;

          ball.y += accelX;

          }

       

      function Gravity(evt:Event){

          ball.y -= gravity;

          }