Skip navigation
Currently Being Moderated

stop() not working?

Jul 8, 2012 10:31 PM

Tags: #not #working #stop #()

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;

    }

 

 
Replies
  • Currently Being Moderated
    Jul 9, 2012 12:14 AM   in reply to Matt201496

    What do you want to stop here? Can you please explain your problem clearly. I will try to solve that as my level best.

     
    |
    Mark as:
  • Currently Being Moderated
    Jul 9, 2012 4:40 AM   in reply to Matt201496

    The stop() command is a timeline command, not a command to inhibit execution of code. 

     

    If you do not want any other code to execute until a certain time, then you need to not execute any other code until then.  That means you do not want to be assigning things like your various ENTER_FRAME listeners until they are wanted.  Otherwise, they will execute immediately.

     
    |
    Mark as:
  • Currently Being Moderated
    Jul 16, 2012 4:17 AM   in reply to Matt201496

    You're welcome

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points