How to stop the same frame being played twice.

Hi,
I am creating a quiz in flash using AS 3.0
I need the order of the questions to be in a random order which I have worked out how to do.
I now need to make it so the questions are shown only one, I've tried looking on the internet but I've not been able to find anything that a: helps and b: I understand.
stop();
BTcorrect.addEventListener(MouseEvent.CLICK, nextQuestion);
function nextQuestion(evt:MouseEvent):void {
  var q_number :  Number = 3;
  var randomFrame:Number = Math.ceil(Math.random() * q_number);
  trace(randomFrame);
  gotoAndStop(randomFrame);
here is my code so far, I dont know where to go from here.
Thank you in advance.
Matt.

you can use the shuffle function to randomize any array and then loop through the randomized array to ensure you're accessing no duplicates:
function shuffle(a:Array) {
    var p:int;
    var t:*;
    var ivar:int;
    for (ivar = a.length-1; ivar>=0; ivar--) {
        p=Math.floor((ivar+1)*Math.random());
        t = a[ivar];
        a[ivar] = a[p];
        a[p] = t;

Similar Messages

  • How to stop the Dialog from being dragged

    I was hoping that someone could tell me when calling a Dialog from Jframe, a how to stop the Dialog from being dragged
    while a dialog is showing.
    When it is visible I can still click and drag the Dialog
    I want to set it so you can not drag it until the dialog has be closed.

    If you don't have access to the parent frame, a "hack" that usually works:
    Frame frame = Frame.getFrames()[0];
    if (null != frame && frame instanceof JFrame){
    JFrame jf = (JFrame)frame;
    JDialog jd = new JDialog(jf, "title");
    ... code here ...
    As each JFrame (or Frame) is opened, its stored in the array of Frames that you can get. Same thing with Dialog.getDialogs(). Almost always, at least so far for me I've never had this problem, the [0] index is the main window opened, or the parent/top frame. I'd put the check in there to be safe and make sure its a JFrame and usually you'll only have the one JFrame.

  • How to avoid the same songs being selected by Genius playlists

    I love iTunes Genius for making play lists, but I am annoyed by the fact that some songs are chosen again and again. For some reason "16 by 32" by the Decemberists pulled nearly every time I make a Genius playlist even though I've never chosen to play the track directly. Amazingly, it has racked up 150% of the plays of the next closest track that I actively listen to. Is there some way to have Genius ignore tracks or artists entirely without removing them from my iTunes library? Are there any ways to tweak Genius to provide a better sampling of tracks rather than the same old same old?
    thanks,
    Derek

    You can uncheck the little check box to the left of track's name.
    This will mean iTunes always skips it unless you specifically select it. It has other side effects too.

  • How to stop the iTunes launching when play/pause is pressed? PLEASE HELP

    I have a macbook pro 13 inches. When I play computer game, during an intense battle, I always accidently press the play/pause button.
    Immediately, the iTunes launch, which will make my game go frozen and I would always lose the battle. This make me extremely frustrated, I have lose so many battles cause of this problem. I know that I could turn the top row of my action keys to Fn keys. That would solve my problems, right? But no. Becuase I use those keys very often. It would be awful without them. For example, the screen brightness, the mission control, the keyboard back-lit light, the volume adjust. Without all these, my mac experience would be awful. Im just wondering if there are other solution beside for turning the Fn keys on.
    PLEASE HELP ME

    This has fixed it for me
    http://redth.codes/itunes-media-hotkey-disabler/

  • How to stop the export button being grey?

    My export button is grey, how do I make the button become "active" so I can export my videos as different formats?

    Make sure the sequence is "selected".

  • Adobe Media Encoder for Premiere Pro CS4 stops working on the same frame every time...

    I currently have Adobe Premiere Pro CS4 and have never had these issues exporting before. My timeline is less than 3 minutes long, but it does deal with multiple big files. It rendered perfectly and it plays perfectly in the timeline. When I try to export it using Media Encoder, however, it freezes at the same frame every time (which is actually only a few seconds in!) and then crashes, so that I have to force quit. I have tried exporting it as many different codecs and the problem persists... same frame. I tried creating a new project entirely and whipping together a few titles and exporting that to see if it just won't export anything at all. The new project exported just fine, however, which I suppose is good news. But yeah, my work on that other project is very important to me and I reallllly want to export it. Please help!

    Hi Jim! Thank you for your reply. I think you are right -- and that it lies in the audio somehow!
    It turns out that if I choose to only export the video, and uncheck audio, it will export very well and smoothly. That's great news for me!
    However, now I am trying to work out how to get the audio exported without issues. I actually had the idea of just playing the audio in the timeline and recording it via Stereo Mix, but my Windows 7 driver has Stereo Mix disabled, so it's back to square one. Any ideas of what I can do about the corrupted audio not exporting, which works fine when played in the timeline?

  • How do i stop the  same song repeating

    How do I stop the same song repeating. Answers I 've seen asy to tap the  artwork ,but what to do when there is no artwork to tap ?

    There is actually a setting for Repeat, so using the Shake to Shuffle feature is not the best way to "fix" the problem.   
    NOTE:  If your nano is a more recent model with a touch screen (not a click wheel), look on the Now Playing screen.  There is a symbol that looks like two arrows in a loop.  You may need to "swipe" the screen to show it.  That is the Repeat setting.  Tap it to change the setting between repeating ONE, ALL, and OFF.

  • How do you create a flash in game popup on the same frame?

    How do you create a flash in game popup on the same frame?
    I need to make a popup in flash on the same frame. Basiclly like you reach the frame and randomly (I know how to do random stuff) a popup might appear saying like you got a prize; and I want the stuff in the back to stay the same.
    Please help me!
    Thankx in advance.

    Whatever frame you intend to make this movieclip appear in, you first set it to be invisible using...
    popupName._visible = false; // popupName is whatever instance name you use
    And for whatever random code you use to trigger it to appear you just set the _visible property to be true...
    popupName._visible = true;

  • How do I get the same song to play on the main menu and during scene select

    I would like the music to play continuously throught the menu and scene selection. As it is I have to drag the audio file into each scene selection, and the music starts at the beginning.
    At least, is there a way to remove the awful sound track that iDVD has on the themes?
    iMac 20 core Duo   Mac OS X (10.4.8)  

    Yes I can add audio, how do I get the same song to play throughout the chapter menus? I have 30 "chapters", which are scenes from an hour of home movie. Can the same song play continuously throughout the different chater menus?. As it is now, I have to drag an audio file into every submenu, and it starts the song at the beginning for each chapter menu.
    Otherwise, that same song that is preloaded on the theme is played. I hope this makes sence, kind of hard to explain. Thanks

  • I downloaded a movie to my ipad, when synced with computer, the computer is now also downloading the movie. why? and how do i stop the movie from being downloaded again

    i downloaded a movie to my ipad, when synced with computer, the computer is now also downloading the movie. why? and how do i stop the movie from being downloaded again

    Do you not want a backup of the iTunes content on your computer in the event the iPad is lost, stolen, or simply fails?

  • How to stop the animation at a certain frame using action script 3.0 .

    How to stop on a frame to stop the animtion using adobe flash cc.

    Either put a stop(); command in the desired frame of the animation's timeline, or have an ENTER_FRAME event listener working who's event handler function constantly check the currentFrame value of the animation and issues an animation.stop(); command when the desired frame is reached

  • I have a iTunes account and recently 2 of the song I have downloaded will not play, it says that it not authorised to play. How ever on the same day the other songs I downloaded that day are playing fine

    I have a iTunes account and recently 2 of the song I have downloaded will not play, it says that it not authorised to play. How ever on the same day the other songs I downloaded that day are playing fine. I can't play the 2 song on my lap top and I-pod.

    Hello Jigz19,
    It sounds like you are unable to play a couple of songs from your library becuase you get a message that the computer is unauthorized to play, but other content purchased that same day works without issue. I would verify that the affected songs were purchased with the same Apple ID first:
    Recovering a forgotten iTunes Store account name
    http://support.apple.com/kb/ht1920
    Open iTunes
    Highlight one of the items you have purchased (You can find your purchases in your Purchases playlist).
    Choose File > Get Info.
    Click the Summary tab.
    The Account Name area will list the account used to purchase the item. Unless you have changed accounts, this is your iTunes Store account name.
    If so, then delete the songs:
    How to delete content you've downloaded from the iTunes Store, App Store, iBooks Store, or Mac App Store
    http://support.apple.com/kb/HT5772
    Then re download them with this article:
    Download past purchases
    http://support.apple.com/kb/ht2519
    Thank you for using Apple Support Communities.
    All the best,
    Sterling

  • How to use the same POWL query for multiple users

    Hello,
    I have defined a POWL query which executes properly. But if I map the same POWL query to 2 portal users and the 2 portal users try to access the same page simultaneously then it gives an error message to one of the users that
    "Query 'ABC' is already open in another session."
    where 'ABC' is the query name.
    Can you please tell me how to use the same POWL query for multiple users ?
    A fast reply would be highly appreciated.
    Thanks and Regards,
    Sandhya

    Batch processing usually involves using actions you have recorded.  In Action you can insert Path that can be used during processing documents.  Path have some size so you may want to only process document that have the same size.  Look in the Actions Palette fly-out menu for insert path.  It inserts|records the current document work path into the action being worked on and when the action is played it inserts the path into the document as the current work path..

  • I don't need to know the name of the next song being played.

    Just wondering if anyone has a solutiom to this. Let's say you're listening to a song that's at the beginning of your main library in iTunes and you scroll down the list to look at other songs you have. How do you stop the screen from going back to the beginning of the list when a new song starts just so it can show you the name of the new song being played? This is a bit irritating when you're making playlists and you have a large library and you have to keep scrolling back to where you left off just because a new song started.
    G5 Imac 2 GHz 512 MB   Mac OS X (10.4.5)   </<br>
    G5 Imac 2 GHz 512 MB   Mac OS X (10.4.5)  

    I don't think there's any way to do that except pausing the song. I, too, think it's irritating. Especially when the song is shown in the display (if activated), anyway. I usually try to hit the spacebar quickly when I hear the song ending. Sorry, I can't help.

  • How to stop an idoc from being processed further

    Hi Experts,
    I have a requirement where i have to stop the idoc from being processed in an user exit.
    I have to stop the idoc and give a suitable status message over there.
    It would be highly helpful if anybody tells me how to stop the idoc abruptly and giv the status messsage.
    Thanks in advance.
    Praveen.

    Hi,
    Check the below link
    https://forums.sdn.sap.com/click.jspa?searchID=11810720&messageID=3032674
    You need to find aproper EXIT.
    The avaliable options for you in the exit is
    IDOC_DATA
    Now if i pick the segment having shiped qty from the data record and check the same with the delivery qty your objective is half done.
    When the condition fails you need to update the IDOC with Error 51 saying that this is not possible .
    for that you need to bring your logic as
    LOOP AT IDOC_CONTROL.
    PERFORM LOGIC...
    ENDLOOP.
    FOR LOGIC .
    All the criteria and then update the status of the IDOC then error is generated and updated to the IDOc.
    PERFORM updatestatusidoc.
    endform logic.
    like this in
    form updatestatusidoc.
    IF subrc = 0 .
    t_idoc_status-docnum = f_idoc_contrl-docnum.
    t_idoc_status-status = c_idoc_status_ok.
    t_idoc_status-msgty = 'S'. -
    >denotes success
    t_idoc_status-msgid = 'ZXXX'.
    t_idoc_status-msgno = '000'. "
    t_idoc_status-msgv1 = itab-field.
    APPEND t_idoc_status.
    ELSEIF subrc = 1.
    t_idoc_status-docnum = f_idoc_contrl-docnum.
    t_idoc_status-status = c_idoc_status_error.
    t_idoc_status-msgty = 'E'. "denotes --->error
    t_idoc_status-msgid = 'ZXXX'.
    t_idoc_status-msgno = '001'. "
    t_idoc_status-msgv1 = itab-field.
    APPEND t_idoc_status.
    endif.
    endform.
    this has to be done to make the idoc to trigger error mode.
    Regards,
    Raj.

Maybe you are looking for