buttons to select the correct answer

I have a simple game, I'm trying to write. A clip at random (from the library) appears on the scene of an array of mc.  Here's the question.  What will make my game, is allow the user to select one of the two buttons (red and green) based on the movieclip that is displayed.  It will produce a correct result, and the other will produce an incorrect result.  HOWEVER, according to the clip shown, sometimes the red button will give the correct result, and sometimes the green button will produce the correct result.  I can't know the best logic by writing the code to achieve this.  Thanks in advance for your advice.

There are many ways to implement, but I'll try to offer one that will be easier to implement given your set upwards.  Create a table more than keep track of button which is correct. This table will be the same size as the matrix of MovieClip.  It will be the instance name of the OK button in each position.  Here is a code example:

I'm assuming that the red and green buttons on your scene have names of occurrence red_btn and green_btn respectively.

var clip: Array = [mc1, mc2, mc3, mc4];  It is your array of clips you already have

This table keeps track of which button is the button for each clip

The first entry goes hand in hand with the first entry in the table of clips

var correctButtons:Array = [red_btn, green_btn, red_btn, red_btn];

Finally, you need a variable to keep track of what MovieClip you places on the stage

var current: number;

Here you have your logic to the MC on the stage.  In addition, update the current variable so that you know what MC you added

I'll just pretend you have added the premiera (0);

current = 0;

Events for you the buttons:

red_btn.addEventListener (MouseEvent.CLICK, checkButton);

green_btn.addEventListener (MouseEvent.CLICK, checkButton);

function checkButton(e:MouseEvent):void

{

use the event object to determine which button has been clicked (because they both call the same function)

var clickedButton:SimpleButton = e.currentTarget as SimpleButton;

Grab the correct key should be in our range

var correctButton:SimpleButton = correctButtons [current];

Check to see if they are identical

if(clickedButton == currentButton)

{

trace ("OK!")

}

on the other

{

trace ("Wrong!");

}

}

Tags: Adobe Animate

Similar Questions

  • Showing the correct answer to the incorrect selection

    Hello

    I need to create a multiple choice quiz where the user will appear a little explanation for the response, whether or not they get is correct.

    For example, if they choose A and the correct answer is A, it will display something like "OK!" Answer A is correct, because... »

    If they choose answer B, it will show "Incorrect." This would be the answer because... "and then allowing them to progress in any case to the next question.

    All seems to be able to do is to define a 'wrong' message by default for questions, who tells them that it's A response, but not WHY it is answer A. I needs to show the various explanations for each question. Is this possible?

    Thanks in advance

    Lee

    Use the advanced features of response which are available for multiple CHOICE, and you will be able to adapt to each individual response feedback: select the legend of the answer, search properties (not in the Quiz properties) advanced response, turn it on and check the feedback message, you will have one for each answer.

    Lilybiri

  • Pointing out the correct answer after failing to question?

    Hello

    I'm experimenting Captivate 7 and worked on how to do just about everything I need it to do. I have 3 or 4 mini-quizzes scattered throughout the presentation that allow 3 attempts before moving on. What I would do, is however, before continuing, display or highlight the correct answers. Is it possible to do?

    Thank you

    Hello and welcome,

    Normally this will be done during the review: correct answer indicated (with a check mark) as well as the answers given. But the inquiry cannot be done after the quiz was made using a button on the slide to Score.

    It could be done, perhaps a bit difficult for a beginner. Question slides do break (you see the double vertical line in the timeline of the slide) and this break is used twice: playhead rest pause when the user clicks on send and see the legends of your comments, then it must support on Y or click on the slide to leave the playback head. Look at the accordion of actions in the Panel properties Quiz: success and the last attempt are by default set to "continue".

    More information: http://blog.lilybiri.com/question-question-slides-in-captivate and http://blog.lilybiri.com/question-question-slides-part-2

    If you understand this workflow, you could time a highlight (box or something else), immediately after this point of suspension. As the playhead will continue, this climax appear, but be visible only for the period after the point of putting paused. If this is not enough, you can do the longest slide in questionnaire.

    Here I change the duration of the Quiz slide to 5 seconds, which means that the highlight box will be visible to (1. 5-5) = 3.5 seconds before the read head reached the end of the slide and goes to the next slide

  • How can I display the correct answers in a quiz about Adobe Presenter 10?

    Hi all.

    I am new to Adobe Presenter.

    I finished all the questions of the quiz, but I want to show the correct answer when the user chose a wrong answer and submit it.

    I tried many things and does not display the correct answer.

    Thank you.

    Rafael.

    The correct answers are displayed after the quiz is over and the user examines the quiz. If you want the answer to be revealed to the user in the quiz, then you will need to customize messages of comments to indicate the right answer. They are just the text boxes on the slides, so you should be able to easily add text to them.

  • Display of the correct answers

    Hey guys,.

    I have a few quiz I do in captivate 6 and this I was wondered, is how I could go about setting the quiz so that if the user enters an incorrect answer, we would get not only the standard:

    INCORRECT ASNWER - CLICK ANYWHERE TO CONTINUE

    But we could get extra information that displays what the correct answer was / is

    It would display the message above standard, "Sorry, wrong answer" it currently displays, but also it would Display the "is the correct answer to this question:" and then display the correct answer. We would not reset the question and give them another chance at it, but for the purpose of building end-user, is it possible to stove display the correct answer to an incorrect answer?

    What is this kind of advanced possible action?

    Thank you very much for any help!

    Jon

    OK... admission time. Everything does not have the two together on that one. I'm sorry for asking such a stupid question. I am new to the quiz from this angle. It was so obvious that I feel a little dumb. Thanks for the reminder that all you have to do is add text to the Red block.

    This thread will self-destruct...

  • Reveal the correct answer in the text entry box

    Hello

    I am a novice Captivate user (Version 5) and I would like to ask for help on the following question:

    I need to have a screen with multiple text entry boxes. When entering text in each box and confirm by pressing "enter", learners only need not comments correct and incorrect, but also the correct text in the text entry box. Is this possible?

    Thank you very much.

    20-12-2010 14-47-04.png

    Hello

    I searched for an easier solution, if you can live with the fact that the user must follow a certain sequence of complete ETB.

    • create as many slides (duplicates) that you need text input boxes + more to show the final result after the last TEB has been filled
    • on the first slide, the user fills out the first BER; choose these settings:
      • validate user input so that correct legend of success or failure appears
      • do not turn on "keep the text.
      • Choose "Go to the next slide" as well for success with regard to the action of the failure
      • write the properties of the ETB: character (police/size/color), size and position
    • on the second slide, you will make the second TEB with the same settings.
      • Create a rectangle with the same size and position of the TEB on first slide; do the 1pt STROKE and black and white, the fill value or if you have a white background, you can simply set Alpha to 0%: this rectangle will be to mimic the BER of the first slide
      • in this rectangle, you can put the text (double click - No need to caption text): put in the correct answer with the same font as in the ETB properties; given the right answer appear as well to correct regarding the wrong answer, it will be OK
    • on the third blade, you do the same to mimic the second TEB and you put the third TEB

    Really think it's the best way, no use of variables and advanced actions. The user will see the legend of failure or success, and then to the next slide with the right answer.

    Lilybiri

  • using the remote control of the DVD does not select the correct buttons?

    Hey Ya'll,

    Project is almost complete, but I ran into one, which I think is a very simple problem...

    On my main menu, I have a total of 5 buttons on 2 rows.

    Line 1 to 2 buttons and Row 2 has 3 buttons.

    The links are correct, because they work fine in preview mode, using the mouse, but also view the version on the pc using Cyberlink DVD Viewer, once again, using the mouse to select the button.

    The problem is when you use the remote control, either on the copy engraved in the DVD player, or in preview mode, if I use the directional buttons of remote controls, that he does not want to go to the buttons I suppose it must

    (Top row left to right, then down row from left to right)

    On each of the properties of the buttons Panel, I chose the right (I guess) option number (just below name) for each button... IE top left set the right value top of page 1, 2, bottom left 3, the middle value 4 downstairs and down to the right the value 5.

    Type is set to Normal, the button name and Synch text is checked (although the No button is real, each is just a Word text, in photoshop, when I did originally the menu..)

    Also the low middle button never gets selected with the remote control of the DVD... Preview, using the buttons on the remote control, he finally gets selected, but it takes a bit of comes and goes, and the highlighted button is rarely what you would expect, since direction button your pushing.

    #1 button (top left) is set to the default button, which I want, but do not know how I set that, unless it's because it was the first button, I myself made/converted to the button)

    Here, any help would be greatly appreciated... that should finish this project!

    CB

    Cowboy Bob,

    No, what you did with the binder is actually linking these buttons to the assets.

    It shows a Menu with several buttons, icon manually road buttons depressed. Once you choose manually the buttons of road, they can change exactly what will make the remote control.

    As said, when you create a Menu, buttons start at # 1 and progress upward. Each Layer Set button plus up in the Layers Palette. This is the routing of the buttons Auto gets its information and it usually works. However, if you move the buttons around, removes some, etc., the en can get confused, manually their routing is the best way to go.

    Good luck and we hope this helps,

    Hunt

  • I asked a question on the level of play in spades and I can't mark the correct answer as the answer?

    The question was answered and I tried the solution and it didn't work.  Since then I've played Spades and got frustrated and tried something new and here's the level has changed.  I came back to close the question, and after checking the help for more information on marking answered, I entered my own response thinking I could mark it as the answer in my e-mail so I could close the question.  Well I can't do that and I will not mark the wrong answer as the answer.  Now, I realize that microsoft probably protects against someone who uses the forum forum or whatever, BUT I want to really close the issue and I only care that someone else uses the correct way to change a level if they like card games to play like I do.

    You deleted the other person "right answer" and you cannot mark your own reply as an answer.

    I am happy to score your answer as being correct.

  • give us the correct answer option

    How can I set correct answer in the forum of adobe acrobat?

    Hi parveza50504420,

    Please visit this link which deals with the same subject: marking messages as correct or useful on the Adobe forums

    Let us know if you have any other questions.

    Thank you

    Shivam

  • Why am I not able to mark the correct answer?

    I started the thread as a question below.

    Timestamp format must be yyyy-mm-dd hh: mm: [.fffffffff]

    Initially, I was able to mark the helpful answer. Now I am unable to score the answers useful/correct.Screen Shot 2015-04-21 at 4.14.21 pm.png

    Now cannot mark the right answer. Why?

    See you soon

    AJ

    It is once again, you should be able to mark what you want like correct/useful.

    Nicolas.

  • Automatically select the correct check box based on choices made in the previous section?

    With the help of LiveCycle to create a form that contains a table. This table has 3 columns with 15 boxes in each column.

    Here are these 15 rows 3 more boxes that have calculated values. In each row of the table one of the checkboxes can be active at a time.

    Based on the majority of choices in a column of some, the calculated corresponding checkbox must be verified. (If most of the choices are made in column 1, then the 1st calculated box must be marked, etc...)

    The sentence that I am writing the JavaScript code that selects the checkbox correctly calculated. Currently, I'm just trying to understand it with only 3 first lines and I can reproduce the template after.

    Table e.g.: ("BOLD" is calculated)

    CheckBox20CheckBox35CheckBox50
    CheckBox21CheckBox36CheckBox51
    CheckBox22CheckBox37CheckBox52
    [CheckBox66][CheckBox67]

    [CheckBox68]

    Here's the code I came up with that day, but it does not just anyone, although when I used it it worked just to 2 columns. (just added the part about the third column in the instructions 'or')

    (In the script for the calculation of box 66)

    //larger values than other columns
    if ((Row1.CheckBox20.rawValue == "") + (Row2.CheckBox21.rawValue == "") + (Row3.CheckBox22.rawValue == "") > (Row1.CheckBox35.rawValue == "") + (Row2.CheckBox36.rawValue == "") + (Row3.CheckBox37.rawValue == "") || (Row1.CheckBox50.rawValue == "") + (Row2.CheckBox51.rawValue == "") + (Row3.CheckBox52.rawValue == ""))
     {this.rawValue = "0";}
    
    //smaller values than other columns
    if ((Row1.CheckBox35.rawValue == "") + (Row2.CheckBox36.rawValue == "") + (Row3.CheckBox37.rawValue == "") || (Row1.CheckBox50.rawValue == "") + (Row2.CheckBox51.rawValue == "") + (Row3.CheckBox52.rawValue == "") > (Row1.CheckBox20.rawValue == "") + (Row2.CheckBox21.rawValue == "") + (Row3.CheckBox22.rawValue == ""))
     {this.rawValue = "1";}
    

    I'm new to JavaScript for all advice is appreciated.

    Looking at the conditions, it seems you are trying to say "If column 1 column 2 or column 3, then do something." JavaScript cannot read conditions like that. It's playback "if (column 1 column 2) GOLD (column 3), ' and he doesn't know what to do with this issue of column 3, except if it is 0 or 1.

    Here is an example of use of only two lines and three columns. The rawValues are 0 and 1 for each check box. I have it set so that if column 1 has several checkboxes, then Col1 gets checked. Similarly, the col2 or 3 boxes will be checked if their columns are the most populated. I don't get the opportunity to have several boxes marked if there are two columns that have the same number of boxes checked. (You can do this by just changing > to > = in the conditions.)

  • Change the correct answer?

    Hello
    I did not marked as a correct answer, I can only change?
    This should be OK.
    Re: index of impdp

    Published by: Vili Dialis April 21, 2011 06:46

    SomeoneElse says:
    It is easier to change your original question, so that the right answer is now there.

    Awesome! Adapt the solution to the problem. Summarizes in essence what talking policy. : D

    PS. and put this into practice, the OP should please change his assignment and change the question to "+ what are the policies about + ', then mark this announcement as the answer. ;-)

    Published by: Billy Verreynne, April 26, 2011 11:59

  • Use the button to select the Combobox choices?

    Hi all

    I have a combobox (called "style_cb") and that you have guseed you can use to select a "style."

    The site also contains photos and I would like users to be able to click on the photos (which are the buttons) and have the combobox control

    automatically the value of this option.

    So, if the options in the drop-down list are "oranges, apples, pears, cherries" and the images are the same fruit.

    then by clicking on a picture of a fruit (say "cherriesBtn") would set the drop-down list for this option box.

    I played a little and I read the help - searched the net but no joy so far.

    All gurus like to help them with what I imagine, it's a fairly simple thing?

    Best wishes

    Tony

    You can use the selectedIndex property of your combobox:

    {cherriesBtn.onRelease = function ()}

    style_cb. SelectedIndex = 3;

    }

  • The default answer of quiz, display the image (with the correct answer)

    Hello guys, I have trying to find a way to be more efficient to work with a corresponding question. It works like this:

    (1) the user must match parts of a chart labels.

    (2) if the answer is incorrect, I want to show the graph with labels in the right place.  A comments box is not effective to show that, since the feedback box shows only the text.

    I have experienced by:

    (1) adding a "in case of failure quiz" show "Graphic". the graphic appears, but the object appears in the options and the boxes of the corresponding question. There is no option to bring graphics to the front of question items.

    (2) adding another slide and "failure of the quiz", an offshoot to the users of this slide. for example:

    question 1-> slide with feedback for wrong answer-> question 2

    If the user moves forward to question 2 and then goes to the rear, they see the slide with feedback for the wrong answer. I don't want that. I want to slide with feedback to be hidden.

    Any ideason how to solve this dilemma. There must be a way.

    Thank you

    Hello

    I know that you believe that the legend of the feedback is not sufficient to accomplish this, but give it a try.

    Compose the image that you want. Then save it on your hard drive. Now change the caption failure feedback. Select and delete all the text. Now click on the legend drop-down Type and scroll down and choose . This should allow you to browse your file system. Search for and select the image that you saved.

    A couple of notes on it.

    1. The selection dialog box will appear initially only allow you to choose. BMP files. If you need to see. PNG or. GIF or another extension, simply type *. PNG or anything else in the file name field and press ENTER to see the files of this type.
    2. When the legend is displayed on your question slide it will be probably be sized as it was before. This will offend some things terribly. So, you'll probably need adjust the size to see the enlarged image.

    Hope this helps... Rick

    Useful and practical links

  • Select the correct version of vista so my windows will work again.

    Every time that CD and I have installed Home Basic edition on my computer, I bought the windows vista upgrade. At the time wherever I found the product key code, it had expired and I tried to put in the key code, but he said that it was not for this version. I then discovered that the correct version is Premium, basic family no. How can I reinstall the Vista CD so I can choose the correct edition and use my key code?

    Start again.

    Reinstall any operating system you used for the upgrade of > and then perform the upgrade in the correct product key during the process.

    See you soon. Mick Murphy - Microsoft partner

Maybe you are looking for

  • Where to find updated drivers to update

    Where can I go to get a free scan for uninstalled or updated drivers up-to-date, etc.?

  • COD file brother is not downloaded to the phone.

    I have a simple application jad/cod, I want available to the phone via the bb browser. It is composed of the main application module and a library. He uses very well, until what app main file grew in size htat is divided by copiler it in 2 cod brothe

  • My administrator account is frozen

    I downloaded a free program Adobe Reader and it also downloaded a hard back of the system, I tried to uninstall.  It restarted my computer, now I can't enter my administrator account on normal setting on Safe Mode, which is weird and I don't see most

  • Unable to download Image

    I am trying to download an image that I bought. The blue box is unclickable. When I go to my download history, nothing is there. I know that I bought the image because the tax came out of my bank account. I tried using a different browser, my story -

  • Why my screen goes black when editing?

    The last month or so, when editing in Photoshop CC on my Mac 10.6.8 the screen goes completely dark. For a while I thought it was a problem with my computer, but then went into account it only happens when I don't work in PS.I did some research and n