A Flash Developer Resource Site

Results 1 to 9 of 9

Thread: Help with StopWatches in Flash

Hybrid View

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

    Help with StopWatches in Flash

    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
    Senior Member Gloo pot's Avatar
    Join Date
    Aug 2005
    Location
    Australia Mate!
    Posts
    874
    Ooo i just learnt how to use tellTaget... You should ahve just looked at the help file sbut oh well... here is how to do it

    make shore the instance of the MC is called clock

    onClipEvent (enterFrame) {
    if (Key.isDown(Key.SPACE)) {
    tellTarget ("_parent.clock") {
    stop();
    }
    }
    }

    if you want i can try and help with any thing else
    92.7 Fresh FM for all your South Aussies - Doof Doof music FTW people!

  3. #3
    Senior Member TeroLebe's Avatar
    Join Date
    Mar 2003
    Location
    Lahti, Finland
    Posts
    302
    Quote Originally Posted by Gloo pot
    Ooo i just learnt how to use tellTaget... You should ahve just looked at the help file sbut oh well... here is how to do it
    so you learnt it... ok, but don't get use to it
    Quote Originally Posted by Macromedia
    tellTarget()
    Deprecated since Flash Player 5. Macromedia recommends that you use dot (.) notation and the with statement.
    use instead:

    Code:
    if (Key.isDown(Key.SPACE)) {
       _parent.clock.stop();
    }
    Last edited by TeroLebe; 10-26-2005 at 02:37 PM.

  4. #4
    XRave tongxn's Avatar
    Join Date
    Apr 2005
    Location
    Somewhere near Here
    Posts
    870
    oh cool... thanks everybody.
    When you actually know what "OMG I have so much homework!" means, you won't want to be me.
    Xrave

  5. #5
    Senior Member Gloo pot's Avatar
    Join Date
    Aug 2005
    Location
    Australia Mate!
    Posts
    874
    ooops didnt read that bit i just went straight to the example :P why do should i do it that way... i tested my way in flash 8 and it worked fine.... is it just just optimisation or somthing
    92.7 Fresh FM for all your South Aussies - Doof Doof music FTW people!

  6. #6
    Senior Member chriserrorplain's Avatar
    Join Date
    Aug 2002
    Location
    london village
    Posts
    623
    it just makes it easier for you really in the long run, tellTarget can be a most frustrating way of doing things when they get bigger than the previously mentioned example.

  7. #7
    Senior Member tonypa's Avatar
    Join Date
    Jul 2001
    Location
    Estonia
    Posts
    8,223
    I would not use tellTarget unless you are making Flash4 game.

  8. #8
    Senior Member Gloo pot's Avatar
    Join Date
    Aug 2005
    Location
    Australia Mate!
    Posts
    874
    Fair enough, thanks
    92.7 Fresh FM for all your South Aussies - Doof Doof music FTW people!

  9. #9
    XRave tongxn's Avatar
    Join Date
    Apr 2005
    Location
    Somewhere near Here
    Posts
    870
    OkOK.
    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