Help! Quiz - need to count score at the end

I have a working quiz but I want to know how to get the score of the number of correct answers the person got but I can't seem to figure out the code for it. This is my code below. Can someone help me?
stop();// movie clip waits on buttons
gloss_mc._visible = false;// set the gloss initially to not visible
score_int = 0;// score on the quiz is initially zero
// button functions
q1_btn.onRelease = function() {
    scoreQuiz_fnc("1");
q2_btn.onRelease = function() {
    scoreQuiz_fnc("2");
q3_btn.onRelease = function() {
    scoreQuiz_fnc("3");
q4_btn.onRelease = function() {
    scoreQuiz_fnc("4");
function scoreQuiz_fnc(ansSelected) {
    trace("scoreQuiz_fnc ("+ansSelected+")");
// define answer key
answerkey_arr = new Array();
answerkey_arr[1] = '2';// the answer to the question on frame 1
answerkey_arr[2] = '4';// the answer to the question on frame 2
answerkey_arr[3] = '3';// ... etc.
answerkey_arr[4] = '4';
answerkey_arr[5] = '3';
answerkey_arr[6] = '1';
answerkey_arr[7] = '3';
answerkey_arr[8] = '4';
answerkey_arr[9] = '1';
answerkey_arr[10] = '2';
glosskey_arr = new Array();// create array of gloss responses
glosskey_arr[1] = 'The correct answer is: Congenital heart defect.';
glosskey_arr[2] = 'The correct answer is: Four areas of the heart are defected because "tetra" means four. ';
glosskey_arr[3] = 'The correct answer is: Two left valves because there is only a right and left valve.';
glosskey_arr[4] = 'The correct answer is: Ventricular Septal Defect because this is when there is a hole (septum) between the right and left ventricles..';
glosskey_arr[5] = 'The correct answer is: Babies because this condition congenital meaning at birth.';
glosskey_arr[6] = 'The correct answer is: There is not enough oxygen carried within the blood which causes a discolouration in infants.';
glosskey_arr[7] = 'The correct answer is: Heart murmur because this condition occurs at the heart.';
glosskey_arr[8] = 'The correct answer is: After crying, during bowel movements or the occurrence of kicking legs in awakening.';
glosskey_arr[9] = 'The correct answer is: Shunt because you cannot place the other objects in a heart.';
glosskey_arr[10] = 'The correct answer is: Heart.';
function nextQuestion_fnc() {
    gloss_mc._visible = false;// hide the gloss
    nextFrame();// advance timeline to the next question
// score the answer selected by user
function scoreQuiz_fnc(ansSelected) {
    trace("For question "+_currentframe);
    trace("scoreQuiz_fnc("+ansSelected+")");
    //if the answer key for this question matches the answer selected
    if (gloss_mc._visible == false) {
        if (answerkey_arr[_currentframe] == ansSelected) {
            trace("Correct");
            score_int = score_int+1;//add one to the score count
            nextFrame();// go to next frame
        } else {
            trace("Incorrect!");
            // show the gloss
            gloss_mc._visible = true;
            gloss_mc.gloss_txt.text = glosskey_arr[_currentframe];// insert gloss from the array
            // end if statement
            trace("Score is now "+score_int);
}// end of function

Try this
Name the dynamic text box in var not at Instance name
You will find it in properties panel .By selecting the dynamic text field you will have some properties like var,single line ....ect
or
Try this one
this is your code : score_txt.text = score_int;
try this :score_txt = score_txt+1;
where  score_txt is the instance name or the var name you are assigning to the dynamic text field where you will display the score.
Note: Change all of the dynamic text field name "score_int" in the script in to score_txt ,Because you have changed the dynamic text field to score_txt at the beginig of the script also you have score_int = 0.change heare also.
If your problem is solved mark this as Answered

Similar Messages

  • Creative sb audigy, needs info on pins at the end of card

    I am trying to install a panel that includes the sound card output and input connector for the panel. It connecting wire include about 5 to 20 connectors for the sound card, but it has no markings it to identify the pins on the board. I have been looking for the info for some time now and had no success. The info would be much appreciate. @7.68.93.24

    =Re: creative sb audigy, needs info on pins at the end of card Those pins aren't for connecting to the front panel, they are for connecting to the breakout box that came with the Platinum version of the card. The pins for the front panel connections (if present on the card) is a 0 pin block usually in an inline config (you can pretty much thank dell for that connector becoming standard on Creative cards). If it helps any here is exactly how to use it,
    http://audigy2zshowto.blogspot.com/
    and if you don't want to make your own cable,
    http://www.x-tap.com/
    try searching ebay and you may find it cheaper.As far as the connector you are referring too,
    http://www.driverheaven.net/audio-ge...ssignment.html

  • When i am editing in finalcut, my image does not look particularly good.  do i need to export it at the end in order to see it in full high definition?  thx

    when i am editing in finalcut, my image does not look particularly good.  do i need to export it at the end in order to see it in full high definition?  thx

    Open FCP X Preferences / Playback / Use Original... Media / Playback Quality...
    How does the exported movie-file looks like...?
    Regards
    Nolan

  • I need to have endnotes at the end with sections and numbering beginning again for each section. I also need to be able to write Chapter

    I need to have endnotes at the end with sections and numbering beginning again for each section. I also need to be able to write Chapter #s above each section of endnotes. How do I do this, please?

    I have precisely the same problem and am wondering if anyone has found a workaround for what seems to be a bug or an unattended issue in Pages. Hopefully the next update (whenever it arrives, I hope it arrives soon) will take care of this.

  • Total time taken for the quiz needs to be displayed in the report

    Hi,
    I would want tthe total time taken for the quiz to be displayed in the report...Let me know if its possible

    Hi,
    Please try this.
    Define three user variables - StartTime, EndTime and Duration.
    At the start of the quiz ('On Slide Enter' of the first Question Slide). have an advanced action with the following actions.
    Assign: StartTime with cpInfoElapsedTimeMS  
    Continue
    At the end of the quiz ('On Success' or 'On Failure' of the last Question Slide or 'On Slide Enter' of Result Slide), have this advanced action.
    Assign: EndTime with cpInfoElapsedTimeMS
    Expression: Duration = EndTime - StartTime
    Expression: Duration = Duration / 1000
    Continue
    The variable 'Duration' will have the time taken by the user for the Quiz in seconds.
    Let me know if you have any queries.
    Thanks,
    Thejas

  • WCF-WebService count, accessed by the end user, the wcf-webservice published BizTalk orchestration as wcf-webservice.

    Hi BizTalk Experts,
    Please help me out, following is my scenario.
    I had published orchestration as wcf-service, for integration purpose. Now I need to count, how many times the service  accessed and failed and successful bye users.
    Thanks 
    Teegala.
    Teegala

    If you need to know how many times the orchestration was called, you can use BAM just like when the orchestration wasn't exposed as web service.
    The success/failure rate depends on what you mean by that: functional (which is part of the workflow in the orchestration) or technical (which is infra related).
    Jean-Paul Smit | Didago IT Consultancy
    Blog |
    Twitter | LinkedIn
    MCTS BizTalk 2006/2010 + Certified SOA Architect
    Please indicate "Mark as Answer" if this post has answered the question.

  • Flash Quiz not calculating totals correctly at the end

    Hi,
    I am working on a Flash XML quiz, that can be found on this
    tutorial
    http://www.permadi.com/tutorial/flashMXQuiz/index3.html
    I have it just about working except at the end on the summary
    screen, the application is supposed to calculate the number right,
    the number wrong and the percentage.
    I am not sure what I have missed, but I zipped up the .fla
    file and the xml file and wanted to see if someone could take a
    look. I know the problem isn't with the XML file so it must be in
    the AS towards the end in the summary screen section.
    here is the path the download the zip
    http://www.inspired-evolution.com/Quiz.zip

    the XML file is only storing the questions. For the scoring
    calculations I am using three dynamic text boxes with var values of
    numOfQuestionsAnsweredCorrectly,numOfQuestionsAnsweredCorrectly,
    numOfQuestionsAnsweredIncorrectly
    and in the AS I am using
    userScore=(numOfQuestionsAnsweredCorrectly*100)/
    (numOfQuestionsAnsweredIncorrectly+numOfQuestionsAnsweredCorrectly)
    I am following the tutorial to a Tee, so unless there is a
    typo or errors w/ the tutorial this should be working.

  • HELP!  Video Freezes One Second before the end of the Clip!

    I just started using iMovie about a month ago. So far so good.
    All of sudden, whenever I put two clips together or edit out a section of a video, the end of the first clip always freezes for about 1 second and then goes on to the next clip.
    Sometimes, one or two frames from the excised clip will pop up really fast between the two clips. When I try to edit the two frames out, it starts freezing the end of the first clip.
    I've seen this asked a time or two on the forum but got no response.
    Please help!

    You should try trashing iMovie's preference file:
    Close iMovie. Go YourUserName/Library/Preferences/com.apple.imovie.plist
    Drag this plist file to the trash. Don't worry. iMovie will create a new fresh one when you reopen it.
    Open iMovie. See if the problem with the clips has resolved.
    Note: if you also have iMovie 8 on your computer, the plist for it will call it imovie7, so be sure to trash the appropriate file.

  • Help is needed on how to change the general ledger account in po

    Dear Colleagues,
    Is there a way to change the GL account in PO?
    I put a wrong GL on a PO created by me, I now want to change it.
    Please can some1 help?
    Thanks alot

    Hi
    If you have not posted any values in that, you can change it in OBYC -  BSX, WRK or ERL etc
    Valulation class - GL Accounts
    Thanks
    Anil

  • Help. Need to remove one of the listed QuickTimes from the "open with" menu

    When I bring up the 'Open with' menu on an audio file I have QuickTime Player (7.3.1) and just below that I have QuickTime Player (7.2.1). I would like to remove the 7.2.1 listing from this menu. There is on one version on my computer (7.3.1). The last update must have placed the newer listing in this menu and left the older listing. Is there a way to remove the older listing from the open with menu?

    Did you ever do an archival and install of your OS? If so, you have what is called previous system fold on your main hard drive. This is where you can find the player to the version. If not I guess what happen to you is strange...mmm... And I guess it could happen.

  • Help. Need to remove item from the "open with" menu

    Does anyone know how I can remove an item from the "open with" menu?

    You could try removing the quicktime .pkg files from the receipts folder in the root library.
    The system has to go somewhere to determine eligible applications it can use to open a file.
    Each application would contain its base settings in its receipts file.
    Once you delete the receipt you should delete the application and reinstall it.
    The reinstall will write a new receipts file.
    The receipts file is used by your system when it repairs disk permissions.
    The system does not just add a setting.
    For example if you take a .png file and click on it and look at what can open it you may get a long list.
    If you choose "other" from the get info "open with" menu and have acrobat reader installed in applications, it will show as an application you can choose.
    That application, however, is not in the drop down list.
    If you choose acrobat reader and apply it to the file type, it will show as the default.
    If you then choose another application in the list and apply, Acrobat Reader disappears from the list.
    The system only shows files in the list that advertise to the system that they can read the file type.
    You have a system which is populating the list with legitimate programs that are compatible with the advertised file type.
    It is reading that advertisement for the quicktime application somewhere.
    The configuration is written to each file individually, you can choose to have a single file associated with a particular application or have it apply to all files of that type.
    Check in Spotlight for a copy of the application in another location.

  • HELP! Need a copy/pic of the regional calling map for FL

    I signed up for the Regional Essentials Package so i can take advantage of Fios internet. I cannot find anywhere on line that shows the regional calling map for Florida (or any other area for that matter). Does the regional calling coverage cover the entire state, a portion of the state or what?
    I keep ebing directed to the consumer guide in my phone book, that issue is two fold-who has a phone book any more?! And...we have one at work and there isn't a map to be found.
    Thank you!

    Your talking to peers.  Note I can't even locate your plan.  The essential plans i do find are apparently not your as they include unlimited nationwide phone service.
    Try looking under your "my verizon" to see if you can give you details.

  • How to count area of the signal from the baseline?

    Hello!
    Please drive me to the function that can count the area above and below from the baseline of my signal.
    Like, i have the contineous signal, that has baseline,  and periodic oscillations. I need to count area of the signal tha different from baseline during this oscillations.
    Thank you.

    Assuming you want both the above and below areas to be counted as positive, take the absolute value of your function before integration.
    LabVIEW Champion . Do more with less code and in less time .

  • Help, How to detect the end of sentence in a plain text

    Hi, Everyboday
    I really don't know how to use ArrayList and endsWith to realize detecting the following question. Could you give me some help? Thank you!
    1. find the end of the sentence. that means that we print it out if you meet "!" or "." .....
    2. calculating the frequency of the key word in the whole text. maybe using IDF..
    import java.io.*;
    class SearchEnd{
         public static void main (String[] args){
              try{
                   File myFile = new File("Test.txt");
                   FileReader fileReader = new FileReader(myFile);
                   BufferedReader reader = new BufferedReader(fileReader);
                   String line = null;
                   while ((line = reader.readLine()) != null){
                        System.out.println(line);
                   reader.close();
                   }catch (FileNotFoundException exception){
                   System.err.println("File not found");
                   }catch(IOException exception){
                   System.err.println("IO Error");
    }

    Checkout this thread about how to use these forums effectively. Particularly with College home type questions, expected to be taught how to find the answer rather than be given it outright.
    http://forum.java.sun.com/thread.jsp?forum=54&thread=190747
    -- Question ---
    There are lots of ways to do this, check out the API documentation http://java.sun.com/j2se/1.4.2/docs/api/
    Your sample shows you can iterate the string so checkout these three classes.
    http://java.sun.com/j2se/1.4.2/docs/api/java/lang/String.html
    http://java.sun.com/j2se/1.4.2/docs/api/java/lang/StringBuffer.html
    http://java.sun.com/j2se/1.4.2/docs/api/java/util/StringTokenizer.html

  • How do you scroll to the end of the address line (url)?

    This has been a frustration for me because there are times I need to erase part of the end, or add to the end.  If I have to erase, I don't want to start in the middle and let it scroll to me as I delete because most of the time, I'm deleting parts that I want to keep.  And I need to be able to add to the end, for example, when I'm searching for the date a web article was written.
    This may have a simple answer because I've searched for this for awhile and I can't find anyone who has this problem. So, I may be a dummy but I really need to know how to do this.  Thanks for your help.

    Snickersnake wrote:
    I don't want to start in the middle and let it scroll to me
    I know of no other way to do it. I tap and hold down until the magnifying glass pops up and then move the magnifying glass all the way to the right to get to the end of the address. I have never found another way to do it.
    This may have a simple answer because I've searched for this for awhile and I can't find anyone who has this problem. So, I may be a dummy but I really need to know how to do this. 
    I wish there was another answer. I guess we must both be dummies because I can't figure another way to do it either in Safari.
    Actually, my solution is to not use Safari. I don't like it and I never did. It is faster than any other iOS browser that I have tried, and I have tried about 8 of them. I keep 6 of them on my iPad and I use iCab Mobile 99.9% of the time. I only use Safari when and if I have to - like when you click on a link in an email and Safari launches as the default browser. Safari pales in comparison when comparing features with other browsers....but I digress.

Maybe you are looking for

  • Credit to an asset -Issue

    Hi, We entered an invoice from vendor 158 for $3400. We were later informed that the vendor voided this invoice not payable. They would now owe AZT a credit for this amount. This invoice was posted to asset 4060004. When I tried to credit the amount

  • Lost my project in iMovie 10.0

    I have OS 10.9 and iMovie 10.0. I updated projects on opening the new iMovie - worked on the project, shared to iTunes and Theater and all was good.  When I opened iMovie again all that remains is the sound files- NO video clips. The old projects are

  • Cannot download Yosemite

    I have been trying to download Yosemite from the Mac App Store all morning - even had a chat with tech support. Running an iMac, 21.5 inch, late 2009, with OS X 10.9.5. I have reset the SMC, the PRAM and started up in the safe mode five times and con

  • Can not fast forward though podcasts on iPhone 4.

    When I first got the phone I was able to fast forward though them. Then something happened three days ago and now I can't fast forward though them at all. When I'm looking at the podcast selection screen it shows '--:--' as the time for all the podca

  • Motion 5 won't launch after yosemite update

    After updating to yosemite on both my iMac and my Macbook pro, Motion will not launch on the iMac but it will on the pro. A window pops up after attempting to launch, saying: "You can't use this version of the application "Motion" with this version o