A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: Help with a StopWatch!

  1. #1
    XRave tongxn's Avatar
    Join Date
    Apr 2005
    Location
    Somewhere near Here
    Posts
    870

    Help with a StopWatch!

    I am making a racing game and i made a MC timer, which times in seconds. I also created a frame by frame animation for it (20fps) and created 22 seconds. Now i placed the IstanceName: clock, and the MCname: clock.
    Placed it onto the stage and gave the AS:

    On(keyDown, <SPACE>) //something like that..
    tellTarget("clock"){
    Stop;
    }
    }

    Did I do anything wrong? I pressed space in the game and it gaves me an output window saying that it cannot locate the (MC/Instance) clock and so didn't the clock stop.

    Thanks for any posts i can find in this place.
    //P.s. There a'int any tutorials...
    //P.P.s So I can't get that AS
    //P.P.P.s Should i use _Root.clock.Stop? It don't work..
    When you actually know what "OMG I have so much homework!" means, you won't want to be me.
    Xrave

  2. #2
    Member
    Join Date
    Aug 2004
    Location
    Canada
    Posts
    31
    If you're using Actionscript 2, try something like this on the main timeline:


    code:

    keyListener = new Object();

    Key.addListener(keyListener);

    keyListener.onKeyDown = function(){
    if(Key.isDown(Key.SPACE)){
    this.clock.stop();
    }

    }



    or, it seems that up to the point where you're telling it to stop, it works, so make sure that you're using either _root.clock.stop(); or this.clock.stop....and make sure that the instance name of your movie clip on the stage is clock, and that no other object has the instance name of clock.

    That's all I have to suggest, try it and hopefully it works.
    Build a man a fire and he'll be warm for a day, Set a man on fire and he'll be warm for the rest of his life.

  3. #3
    XRave tongxn's Avatar
    Join Date
    Apr 2005
    Location
    Somewhere near Here
    Posts
    870
    It works in some sort of way.. thanks
    When you actually know what "OMG I have so much homework!" means, you won't want to be me.
    Xrave

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center