When a timer is at 40, go to the next section.

Hey there,

When a timer in my game hit 40 I want to go to the next section. Here's 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 the timer is the name of my dynamicText.

Any suggestions as to why it does not work would be greatly appreciated.

Best regards, Eric

"game1","game2","game3" are the label in the time line or the name of the frames inside the movieclip?

Try this

Code of the time line:

_root. Timer = 0;

Stop();

function goGame() {}

myRandom = int (Math.random () * 3);

If (myRandom == 0) {}

gotoAndStop ("game1");

}

If (myRandom == 1) {}

gotoAndStop ("game2");

}

If (myRandom == 2) {}

gotoAndStop ("game3");

}

}

Code of the moveclip

onClipEvent (enterFrame) {}

var atFrame:Boolean = false;

{If (int(++_root.timer) == {int (40)})}

_parent.goGame ();

}

}


Tags: Adobe Animate

Similar Questions

  • I do a layout of paper every two weeks; This time, when I opened my model, set up for the next issue when I typed 'W' to display the grid I have something totally different than previously, a background grid which is more annoying.  Why in the world

    new to InDesign 6 months I do a newspaper page layout every two weeks.  This time, when I opened my model, set up for the next issue, when I typed "W" to display the grid, I have something I never saw elsewhere. ".  The background was filled with a new grid of tiles rather than the void behind the newspaper that I'm used to seeing.  I don't know what happened, but it seems that Adobe has tinkered once more with the program.  The last time this happened, I lost the icon "cover the columns" at the top; now, it's a case of two steps to put the head-lines across more than one column.  NOT useful.

    There is probably a command or a term, I don't know that this right but my main question is why, when I did this dozens of times before, doing something different will come this time.  (I know, without replica.)

    I'd also appreciate comments that someone out there could offer re why now when I tap on InDesign, is there a slight pause before that something happens to the screen.  What is my new Mac, or something to do with the program that I can fix it?

    Thanks, Sacie

    It looks like the grid of the document, which can be disabled in the view menu.

  • When I miss my photos, it jumps to the next photo.  How to stay on the current photo?

    When I miss my photos, it jumps to the next photo.  How to stay on the current photo?

    Hi danas,.

    Greetings!

    When that the caps lock is on.

    Make sure that the caps lock is off.

    Concerning

    Jitendra

  • Updates the window appear when shutting down, but do not set up the next time you start

    The display shows 15 updates of Windows are loaded (installed?) when the machine is stopped.  To restart Windows, the screen indicates "wait" while the updates are being configured.  The icon indicates that the configuration is current, but the screen always said that "0% are completed.  Then, after a few minutes, the screen indicates something as "installation failed; Revenant.  After the message 'return', the machine moves to the usual Windows 7 start page and asking to connect you as usual (which allows me to work on the machine).   So, the next time I shut down Windows, the screen indicates that the installation of several updates continues and is completed in series.  Then, the next time I turn on the machine it asks to wait while updates are configured;  and finally, it "fails to complete the configuration" and "resets" as described above.  What happened several times in the last two days.  What should I do to get this resolved failure?

    Hi BonnieDoon,

    1. did you of recent changes on the computer?

    2. you receive error message during the update by installing the process?

    Method 1

    See the Microsoft article below as well as try the steps mentioned and check if it works.

    The update is not installed successfully, you receive a message, and the computer restarts when you try to install an update in Windows Vista and Windows 7

    http://support.Microsoft.com/kb/949358

    Method 2

    Restart the computer after you follow the steps above and check if the problem persists, if the problem persists then checks the update is not being properly installed on the computer and then install it manually.

    View update history to know which update is not installing.

    (a) open Windows Update by clicking Start , all programsand then click Windows Update.

    (b) in the left pane, click view update history.

    (c) to view more information about an update, double-click it.

    Once you know the update's KB number then visit the Microsoft Download and put the number in the search box, download and install the update manually.

    http://www.Microsoft.com/downloads/en/default.aspx

    I hope this helps!

    Halima S - Microsoft technical support.

    Visit our Microsoft answers feedback Forum and let us know what you think.

  • Button click slide 1st time, opens URL. Click on the 2nd time, URL opens and jumps to the next slide.

    Well, I'm really confused here!

    I have a project that is created where on a screen, I www.xxxx.com and I put a button transparent, so when someone clicks on it, it opens a new window and opens the URL.

    This works.

    Here's the question, when I got back to the project and click on the link for the SECOND time, it always opens a new window with the URL, but it ALSO moves to the next slide. Nuts!

    Can someone tell me what could happen? It's so weird!

    Here is a screenshot on the properties of the button and the blade in the bottom of the screen.

    Button Working Incorrectly Properties.PNG

    Button Working Incorrectly Options.PNG

    Hello

    A number of things here.

    First of all, I would never use a Transparent button. Try a Click Box.

    Second, when you added the URL there is also an option to 'continue the project to play. " You guarantee that was unchecked?

    See you soon... Rick

    Useful and practical links

    Captivate wish form/Bug report form

    Certified Adobe Captivate training

    SorcerStone blog

    Captivate eBooks

  • button that when clicked on the page scrolls up to a certain point, as the next section

    I need my own image of button that when clicked the page scrolls to another location on the page.

    Smeedee is correct with the help of ankles. Will expand just to say there is a very informative video cela covering by Adobe's Terry White (go to 15:30 if you are only interested in the use of anchors for reach) here:

    5 gems hidden in Adobe Muse CC - YouTube

  • How can I keep the links I click on that since highlighted, especially when I visit your site, the next time?

    Whenever I visit a site (like craigslist) links I click on are highlighted (or turn from blue to purple) and saved the next time I visit your site, allowing the next person to see exactly what links I have chosen. Is there a way to disable this application?

    Try to clear your browser's cache.

    Tools > clear recent history... - details and of course Cache hit only is selected, and then select all and click the clear now button.

  • mp3 music: songs when a track is more does not automatically switch to the next

    When I listen to my music, skip to the next track a mp3 of the album not happen automatically, but I have to press (song after song) the progress of the arrow... How can you solve?
    Thank you

    Paolo

    p. s.

    Sorry for my English, but I rely on a translator because I don't know

    no news for the moment... Wait for a new firmware.

    by

    Paolo

  • Without scroll bars when search results are displayed in the "content" section

    Hello

    I use reactive HTML5 in 2015 of Robohelp.

    The Azure_Blue layout works very well, but when search results are set to appear in the 'content' section no scroll bar is displayed, if you can't navigate to the results of research which are off the screen. Scroll bars are displayed when its set to appear in the sidebar. Tried with many different browsers - same result.

    Is it bug? Others do for this problem?

    See screen capture below.

    See you soon

    The CSS fix mentioned by Willam resolves the problem.

  • Text moves to the next image when the space is still ongoing

    Hello

    I came across a situation of confusion while helping my colleague help out a folder that she worked on today. We have found a non-ideal workaround (essentially, reconstruction of the file), but I wanted to know if there was something we have neglected which would have allowed a faster, better the difficulty. In short, the problem was that the text would jump to the next section while he was still in the current space - when the image has been resized slightly, or when an image with jump object wrapping applied was added. (See attached image).


    problemfile.jpg

    The text is composed of numbers, bullets, and then dashes, each with their own style. It seemed that the culprits were the styles of numbers and dashes (and the body text style on which they were based). I assumed the problem was Options of sequence, that has been enabled for these styles when it usually isn't. However, disable the keep Options in styles does not solve the problem. Even select all text directly and disabling of keep Options as it did not work. I have also excluded from these things, that everything looked normal:

    -Hidden characters

    -Before and after paragraph spacing

    -Align to the baseline

    -Jump training

    -Text block options

    I opened another, running the InDesign file that uses the same styles to use as a basis for comparison; When I copy / pasted a part of the text of the problem file into the right file, erratic jumps framework had disappeared. Similarly, when I copied the reference text in the file problem, she presented the same problem behavior. So there must be something in the style or preference within the document.

    After comparing the styles between the files, however, the only difference between them I could see was keep Options. And (as above) disabling of keep in styles or with all the selected text Options does not solve the problem. (It helped a little with dashes - still jump text, but less lines progressed than before.) Recording, close and then reopen the case did nothing. Later, as I was messing around after the fact just to see if I could find the problem, I completely deleted the relevant styles of the problem file and replaced by their counterparts in the file reference. Problem disappeared. So I finally find a solution preferable to a total rebuild, but the question remains: what else could be different between the two documents so that this error occurs? Is there any other thing in addition to what I have already mentioned? Or is it just something buggy file, styles or apply these styles to the text? Any idea would be appreciated, I would like to know for the future, in case we run into similar problems again.

    Thank you!

    'Keep the options' to Dash sign for 0 to "keep with next". Who takes care of the issue.

  • I bought a brand new iPhone 5 s to the United Kingdom for use in New Zealand. When I'm in New Zealand and put the card sim inside (put a sim card in the first time), he said that it is not supported and it doesn't let me do anything else - cant even get i

    I bought a brand new iPhone 5 s to the United Kingdom for use in New Zealand. When I'm in New Zealand and put the card sim inside (put a sim card in the first time), he said that it is not supported and it doesn't let me do anything else - cant even get into the phone. Why has this happened?

    The United Kingdom, where did buy you it?

  • My macpro is backup in the capsule of time even when I was at work, which means that the time capsule is consumed my data plan. Can anyone suggest a way I can have it the backup only when my mac pro and time capsule is in the same local wifi

    my mac pro is backup in the capsule of time even when I was at work, which means that the time capsule is consumed my data plan. Can anyone suggest a way I can have it the backup only when my mac pro and time capsule is in the same local wifi

    If the Time Capsule and MacBook Pros are not on the same network, the MacBook is not backup in the time Capsule. You probably see what snapshots leaving MacBook on the local disk, until the two are reconnected. If you don't want that to happen, disable Time Machine on a different network.

    Good day.

  • I'm afraid to do the last update because in the past when I update, I always lose something. The last time it was my tabs "pinned". What is the solution?

    I'm afraid to install the last update, because in the past when I update, I always lose something. The last time it was my tabs "pinned". What is the solution?

    No, they are not the same. You really need to put more emphasis on messages displayed by editors / moderators / Admins who have extensive validation "under their belt.

  • When I select recently bookmarked it works ok, but when I select unsorted bookmarks it opens a window not closing cycles for a long time.and I want to close the window manually and not automatically

    When I use the selection recently marked with a bookmark in bookmarks, it works very well and load the page quickly and opens another window. but when I go to unsorted bookmarks and double-click on the desired bookmark it loads very slowly and cycles for a long time. If I go to the firefox icon in the Launcher on natty 11.04 with unity it shows two open windows. I click on the unsorted Bookmarks window and manually stop and it works well and unordered finishes, loading the bookmark page I was trying to see. Why the unsorted Bookmarks window closes on its own? Is there a setting I can do close automatically. It really slows down the loading of the page, I tried to see. well thank you for any help or advice.

    Create a new profile as a test to see if your profile is the source of the problems.

    See basic troubleshooting: make a new profile:

    There may be extensions and plugins installed by default in a new profile, so check that in "tools > Modules > Extensions & Plugins" in case there are still problems.

    If this new profile works then you can transfer files from the old profile to the new profile (be careful not to copy corrupted files)

    See:

  • I've updated for picture with the captain and when I plug in my iPhone it loads the same pictures twice each time how it stop loading the same things every day?

    I've updated for picture with the captain and when I plug in my iPhone it loads the same pictures twice each time how it stop loading the same things every day?  I tried to make the old default iphoto but picture still open when I plug in my iPhone?

    I tried to make the old default iphoto but picture still open when I plug in my iPhone?

    When the iPhone is connected and Photos opens, select iPhone in sideba of the windowr of Photos. Then, uncheck the option 'Open for this iPhone Photos' below the toolbar.  Do this for all your iPhones. The hook should be unmarked for each device individually.

Maybe you are looking for