Once a timer is at 40 go to the next frame.

Hey there,
When a timer in my game hits 40 I want it to go to the next frame. Here is what I have:
onClipEvent (enterFrame) {
          var atFrame:Boolean = false;
          if (_root.timer == 40) {
                    atFrame = true;
          } else {
                    _root.timer++;
          if (atFrame == true) {
                    myRandom = random(3);
                    if (myRandom == 0) {
                              gotoAndStop("game1");
                    if (myRandom == 1) {
                              gotoAndStop("game2");
                    if (myRandom == 2) {
                              gotoAndStop("game3");
Where "game1-3" are the names of my frames. And timer is the name of my dynamicText.
Any suggestions as to why this isn't working would be greatly appreciated.
Kind Regards, Eric

first of all your variable must be initiated
_root.timer=0
Yor code is insede a MovieClip?
I change the code
_root.timer = 0;
onClipEvent (enterFrame) {
          var atFrame:Boolean = false;
          if (++_root.timer == 40) {
                    goGame();
function goGame() {
     myRandom = int(Math.random()*3);
      if (myRandom == 0) {
          _root.gotoAndStop("game1");
     if (myRandom == 1) {
          _root.gotoAndStop("game2");
     if (myRandom == 2) {
          _root.gotoAndStop("game3");

Similar Messages

  • WHEN I GO TO PRIVACY SETTINGS AND CLICK ON EXCEPTIONS AND TYPE IN A WEB ADDRESS TO ALLOW ALL THE TIME IT DOES NOT SAVE IT THE NEXT TIME I SIGN ON TO FIRE FOX IT IS LOST. IT WORKS FINE ON MY DESKTOP BUT NOT ON MY LAPTOP THAT I JUST BOUGHT in English.

    Question
    WHEN I GO TO PRIVACY SETTINGS AND CLICK ON EXCEPTIONS AND TYPE IN A WEB ADDRESS TO ALLOW ALL THE TIME IT DOES NOT SAVE IT THE NEXT TIME I SIGN ON TO FIRE FOX IT IS LOST. IT WORKS FINE ON MY DESKTOP BUT NOT ON MY LAPTOP THAT I JUST BOUGHT in English.

    I just updated my whatsapp...clicked on whatsapp in appstore and now can access my whatsapp

  • When using my ipad2 in calendar landscape, month mode, I now see my end time of appointments running over into the next day. (i.e. ends at 1:00am now seen on next day as one long bar). any way to hide that?

    I just updated to ios6. My month view in calendar now shows the start time and end time of appointments running over into the next day. I.E. start appointment on Friday at 5:00 pm, end it at 1:00am Saturday moring. I used to only see the one entry on Friday. Now the appointment runs across both dys showing start and ent time. Can I only show start ttme on month view as I did before?

    Wow! Sorry for all the typos!

  • Play a movieclip once, then go to the next frame on the main timeline

    Hello, I'm sorry for the long topic's title.
    I have an animation I'd like to use as an INTRO in my flash
    movie. I will joint it inside a movieclip, giving it the istance
    name "INTRO". And I position it in the first frame of the main
    timeline.
    How can I make possible that played once my intro (my
    movieclip) the player jumps to the second frame of the timeline,
    named by the istance "HOME".
    Is it possible?
    Thankyou very much for your help,
    and great things.
    Stebianchi

    on intro's first frame place:
    if(!this.played){
    _level0.gotoAndStop(2);
    and on its last frame place:
    this.stop();
    this.played=true;
    _level0.gotoAndStop(2);
    // or this.removeMovieClip(), if this is no longer ever used.
    and if you use this, you don't need the frame 1 code.

  • I'm living in Middle East , there's no face time on my iPhone , what's the NEXT best alternative ??

    Hi
    I have an iPhone 5, iOS 7 , all legit , NO jailbreak
    There's no face time on the phone
    Looks like the local telecom has stopped the use if FaceTime
    So , what's the next best alternative for video calls ?
    I've got Skype installed , but not very happy with video  clarify
    Thanks in advance
    Regards
    Subu

    Thanks wjosten
    I'll wait and see if there are other solutions
    What about the numerous chats / chat apps that are popping up ? Anything has video calling ? Not video sending but live video calling like FaceTime ?
    TIA
    Regards
    Subu

  • How can I play all the videos I have saved to a playlist? I only am able to get one playing at a time then I have to select the next and play it.

    I am not able to get all/any of my videos to play one after another like my music playlists. I thought it worked once but I am not able to recall how.
    Your help is greatly appreciated. I am tired of having to go back after each video (be it a music video, tv show, movie...but music video in particular).

    The Videos that do not play - Are they all Checked.
    Right Mouse Click on a video, If at the bottom of the popup it has Check selection then that is what is missing. Suggest you select all your videos, Right clcik and mark all as checked in 1 go. Then your playlists will run through them.
    I think they only play one at a time because when you double click on them to pl;ay for that 1 video it overides the checked/ Unchecked feature

  • Since installation of Mavericks, Time Capsule works very slowly, and the next backup of 236 GM will take nearly 30 days. What can I do to get backup more rapidly ?

    Since the installation of Mavericks, Time capsule works very slowly and will need 30 days or more to produce a complete backup of about 200 GB. What can I do to get a complete backup more rapidly ?

    What setup is the TC now.. ? what model and what firmware? Maverick seems to need 7.6.4 on the older TC.. and latest firmware on the AC version.
    Is it in router or bridge mode? Do not use wireless only.. join a wireless network.
    Is the computer connected by wireless or ethernet? I strongly recommend a test by ethernet.. with wireless in the computer turned off. If it is still very slow something is majorly wrong.. but I need the info I asked for to troubleshoot further.

  • Since upgrading to firefox 4, pages open up at a greatly reduced size, and i have zoom in with ctl+ about 10 times, which is then remembered, so the next time it opens at the right size.

    i just upgraded to firefox 4 grudgingly, as i had this same issue when i upgraded to ff3, which i ultimately dumped, and went back to an older version. pages open very very small and i have to zoom in, to fill the page, and make it readable. once i have done that, those proportions are somehow remembered, and from that point on, they will open up at a large size.
    how can i get ALL pages to open up to a standard. predetermined size?
    on a related note, the toolbars are also very small. can i make them larger somehow?

    That is a problem with the Flash plugin.
    You can check for problems with current Flash plugin versions and try these:
    *disable a possible RealPlayer Browser Record Plugin extension for Firefox and update the RealPlayer if installed
    *disable protected mode in the Flash plugin (Flash 11.3+ on Windows Vista and later)
    *disable hardware acceleration in the Flash plugin
    *http://kb.mozillazine.org/Flash#Troubleshooting
    *http://helpx.adobe.com/flash-player/kb/flash-player-113-crash-mozilla.html

  • HT1399 I just downloaded a cd but most of the songs stop at diffrent times and then skip to the nexts song

    I just downloaded a cd but most of the songs stop at diffrent times during play and skip to the next song how do I fix that?

    If your country's iTunes Store allows you to redownload purchased tracks, I'd delete your current copies of the dodgy tracks and try redownloading fresh copies. For instructions, see the following document:
    Downloading past purchases from the App Store, iBookstore, and iTunes Store
    Otherwise, I'd report the problem to the iTunes Store.
    Log in to the Store. Click on "Account" in your Quick Links. When you're in your Account information screen, go down to Purchase History and click "See all".
    Find the items that are not playing properly. If you can't see "Report a Problem" next to the items, click the "Report a problem" button. Now click the "Report a Problem" links next to the items.

  • My wifi goes down at least once a day and I have to unplug the time capsule and reboot it and then it works fine.  Any idea why this is happening/what I can do to fix it?

    My wifi goes down at least once a day and I have to unplug the time capsule and reboot it and then it works fine.  Any idea why this is happening/what I can do to fix it?

    I was having this problem while still using Mavericks -- it started after a Mavericks update last spring.  During the initial Yosemite beta runs over the summer, it seemed to be fixed, but after the official launch in October, I had all sorts of problems keeping connected.  Its gotten a little better, but still happens to at least one of my devices every day.  Weird that we still cannot figure out why the connection keeps dropping on some devices, but not others, and then the next day, one of the devices that didn't disconnect the previous day will disconnect, but the ones that did disconnect, stay connected.  It's just sloppy, poorly written software for technology that isn't working the way it should.  If you turn off Continuity and Handoff on all your devices, you will probably see that everything stays connected.  With those turned off on all devices, TC stayed connected to everything for over a month.  The day I turned Continuity back on, all the problems started again.  It had something to do with the bluetooth version being used, the wifi routine, and Apple's AirPlay technology not quite getting along with each other.

  • How can I stop a sound from looping so it plays only once each time the up key is pressed?

    Hi there here is my code, the basis is it is playing a mp3 from my library.
    Basically as the topic suggests I only want the sound to play once each time the UP arrow key is pressed. At the moment when you hold the up arrow down the sound keeps triggering and looping and gets really loud and noisy.
    Here is my code for my game:
    package com.chasegame.components
              import flash.display.MovieClip;
              import flash.display.Stage;
              import flash.events.Event;
              import com.tech.utils.KeyObject;
              import flash.ui.Keyboard;
              import flash.media.Sound;
              import flash.media.SoundChannel;
              public class SpaceShip extends MovieClip
                        private var key:KeyObject;
                        private var speed:Number = 0.3;
                        private var rotateSpeed:Number = 5;
                        private var vx:Number = 0;
                        private var vy:Number = 0;
                        private var friction:Number = 0.95;
                        private var shipSound:roar = new roar();
                        private var shipSoundChannel:SoundChannel = new SoundChannel();
                        public function SpaceShip () : void
                                            key = new KeyObject(stage);
                                            addEventListener(Event.ENTER_FRAME, loop, false, 0, true);
                        public function loop(e:Event) : void
                                            if (key.isDown(Keyboard.UP))
                                                           vy += Math.sin(degreesToRadians(rotation)) * speed;
                                                           vx += Math.cos(degreesToRadians(rotation)) * speed;
                                                           shipSoundChannel = shipSound.play();
                             else
                                                           vy *= friction;
                                                           vx *= friction;
                                  if (key.isDown(Keyboard.RIGHT))
                                            rotation += rotateSpeed;
                                  else if (key.isDown(Keyboard.LEFT))
                                            rotation -= rotateSpeed;
                                  y += vy;
                                  x += vx;
                                  if (x > stage.stageWidth)
                                            x = 0;
                                  else if (x < 0)
                                            x = stage.stageWidth;
                                  if (y > stage.stageHeight)
                                            y = 0;
                                  else if (y < 0)
                                            y = stage.stageHeight;
                        public function degreesToRadians(degrees:Number) : Number
                                  return degrees * Math.PI / 180;

    If you want the sound to only play once when the key is pressed then you don't want to have it in the ENTER_FRAME event handler like you have it.  It is starting new sounds at the frame rate of your file the way you have it now.
    Try having an event listener dedicated to a KeyboardEvent.KEY_DOWN event where you detect when the UP key gets pressed and use that to trigger playing the sound.

  • Why does a new run once start up program run every time I start my computer? The start up program is coming from Reader XI. The only name on it is a number starting with 141_______.

    Why does a new run once start up program run every time I start my computer? The start up program is coming from Reader XI. The only name on it is a number starting with 141_______.

    See also https://forums.adobe.com/thread/1654402

  • Need to restrict triggering of workflow only once(first time).

    Hi guys,
    I hv a requirement to trigger the workflow only once(first time).
    whatever is the the condition/changes in document, it should not trigger for second time.
    do we hv any options available for this........
    thanks in advance...
    santosh.

    Hi susan,
    Below is the requested information,
    Release : ECC 6.0
    we are working on custom WF for ECO creation(CC01).
    Description,
    ECO is created in SAP by legacy system, thru bapi CCAP_ECN_CREATE, the WF will take the editing of the material in that ECO to different departments like MRP, accounting, sales,quality etc.... & respectively creates the views.
    we cannot use CREATE event, bcos first the ECN(CC01) is created by bapi & further bapi creates the material & inserts it into ECN again, which is CHANGING the document. once this is done, our WF should trigger.
    As we dont have CHANGE event in ECM BO, i am using CREATE event & settting it for ON CHANGE in SWEC t-code.
    Bottomline is , it is triggering as soon as any changes happens.
    But, we want it to restrict for one time triggering.
    Regards.
    santosh.

  • HT5100 How to limit the number of downloaded videos in parallel to one.i want my iPad itunesu to download only one video at once at time and when finished from downloading it to pass to the second queued one.

    How to limit the number of downloaded videos in parallel to one.i want my iPad itunesu to download only one video at once at time and when finished from downloading it to pass to the second queued one.

    @Tylerdowner: hmm.. maybe yes.. I just want to use the DOWNTHEMALL AddsOn for the saving file not the default download.. because my costumer download MP3 files and save it 3 or more files at a time so my Internet Connection goes down :( so I just want to limit them to save 1 file at a time.
    or if there is another way to limit it to 1.. please tell me :(

  • TS1702 I purchased holiday add-ons for the UtiliTap Week Calendar.  I wanted basic holidays.  Once added my calendar was flooded with listings for holidays, the majority obscure, repeatedly listed. The "hide calendar" would work only till the next time I

    I purchased holiday add-ons for the UtiliTap Week Calendar.  I wanted basic holidays.  Once added my calendar was flooded with listings for holidays, the majority obscure, repeatedly listed. The "hide calendar" would work only till the next time I opened it. These holidays were listed on the built-in iPhone calendar as well as the UtiliTap Week Calendar. I actually want to delete the two purchases because I tried deleting the UtiliTap Calendar (where I purchased the add-on holidays) and the holidays still showed up on my built in iPhone calendar.

    I purchased holiday add-ons for the UtiliTap Week Calendar.  I wanted basic holidays.  Once added my calendar was flooded with listings for holidays, the majority obscure, repeatedly listed. The "hide calendar" would work only till the next time I opened it. These holidays were listed on the built-in iPhone calendar as well as the UtiliTap Week Calendar. I actually want to delete the two purchases because I tried deleting the UtiliTap Calendar (where I purchased the add-on holidays) and the holidays still showed up on my built in iPhone calendar.

Maybe you are looking for

  • Problem on upload file via ftp..

    Hi afternnon, Can have people tell me.....what is "Can't open data connection" on my upload file via ftp ????how to solve it?? regards, mike

  • *** Display problem in oracle ***

    Hi, I have a requirement to show the ID separated by 30 spaces and '|' operator and then description. For eg 100          |  Desc1 0          |  Desc2 12345        |  Desc3and so on. I tried the following query: select RPAD(tree_flt_sys_id,30,' ') ||

  • Req : to capture the filter data in internal table  from ALV

    hi friends.. i have an requirement, plz guide me to solve this.. let consider in alv grid i m displaying 10 data(10 rows) by using filter let assume now i m getting 5 rows (from the 10 rows). i want to capture these 5 rows in an internal table.. plz

  • Cisco AIR-AP1142

    Just out of the box. Configured IP address, security and enabled the radios. When I checked the gigabit interface it shows:       Software status -- Enabled       Hardware status -- Down Is this an indication that the AP has a hardware problem and I

  • Margin problem when printing with canon printer

    When I try to print a pages document on my canon pixma ip4500 printer (which they sold me at the apple store when i bought the laptop), the bottom margin does not appear. There is a space only about half an inch under the last line of text. Everythin