[COLOR=#333333][SIZE=3][FONT=Times New Roman]Greetings,[/FONT][/SIZE][/COLOR]
[COLOR=#333333][SIZE=3][FONT=Times New Roman]I am an educator and I am designing an interactive activity for my students. I created two buttons named baby_B and baby_G, and an input textfield named text_entry. When a student presses baby_B, the letter “B” is entered into the input text field; if a student presses baby_G, the letter “G” is entered into the input text field.[/FONT][/SIZE][/COLOR]
[COLOR=#333333][SIZE=3][FONT=Times New Roman]For a student’s solution to the input text field to be correct, it has to contain values BBB, BBG, BGB, BGG, GGB, GBG, GBB, and GGG in any order. I created an array named solution_S with these values. I also have an enter the solution button named enter_btn. The student can check their solution by pressing the enter_btn button; if the input textfield is correct, the quiz moves on to the next frame in my timeline; if it is incorrect, it moves to a different frame in my timeline. So far I have the following script:[/FONT][/SIZE][/COLOR]
[COLOR=#333333][SIZE=3][FONT=Times New Roman]stop();[/FONT][/SIZE][/COLOR]
[COLOR=#333333][FONT=Times New Roman][SIZE=3] [/SIZE][/FONT][/COLOR]
[COLOR=#333333][SIZE=3][FONT=Times New Roman]baby_B.addEventListener(MouseEvent.CLICK, letterB);[/FONT][/SIZE][/COLOR]
[COLOR=#333333][SIZE=3][FONT=Times New Roman]function letterB(event:MouseEvent)[/FONT][/SIZE][/COLOR]
[COLOR=#333333][SIZE=3][FONT=Times New Roman]{[/FONT][/SIZE][/COLOR]
[COLOR=#333333][SIZE=3][FONT=Times New Roman] text_entry.appendText(“B”);[/FONT][/SIZE][/COLOR]
[COLOR=#333333][SIZE=3][FONT=Times New Roman]}[/FONT][/SIZE][/COLOR]
[COLOR=#333333][FONT=Times New Roman][SIZE=3] [/SIZE][/FONT][/COLOR]
[COLOR=#333333][SIZE=3][FONT=Times New Roman]baby_G.addEventListener(MouseEvent.CLICK, letterG);[/FONT][/SIZE][/COLOR]
[COLOR=#333333][SIZE=3][FONT=Times New Roman]function letterG(event:MouseEvent)[/FONT][/SIZE][/COLOR]
[COLOR=#333333][SIZE=3][FONT=Times New Roman]{[/FONT][/SIZE][/COLOR]
[COLOR=#333333][SIZE=3][FONT=Times New Roman] text_entry.appendText(“G”);[/FONT][/SIZE][/COLOR]
[COLOR=#333333][SIZE=3][FONT=Times New Roman]}[/FONT][/SIZE][/COLOR]
[COLOR=#333333][FONT=Times New Roman][SIZE=3] [/SIZE][/FONT][/COLOR]
[COLOR=#333333][SIZE=3][FONT=Times New Roman]enter_btn.addEventListener(MouseEvent.CLICK, check);[/FONT][/SIZE][/COLOR]
[COLOR=#333333][SIZE=3][FONT=Times New Roman]function check(event:MouseEvent):void {[/FONT][/SIZE][/COLOR]
[COLOR=#333333][SIZE=3][FONT=Times New Roman] var solution_S:Array=[“BBB”,“BBG”,“BGB”,“BGG”,“GBB”,“GBG”,“GGB”,“GGG”];[/FONT][/SIZE][/COLOR]
[COLOR=#333333][SIZE=3][FONT=Times New Roman] [/FONT][/SIZE][/COLOR]
[COLOR=#333333][SIZE=3][FONT=Times New Roman] if(solution_S.indexOf(text_entry.text)>=0)[/FONT][/SIZE][/COLOR]
[COLOR=#333333][SIZE=3][FONT=Times New Roman] {[/FONT][/SIZE][/COLOR]
[COLOR=#333333][SIZE=3][FONT=Times New Roman] gotoAndStop(61);[/FONT][/SIZE][/COLOR]
[COLOR=#333333][SIZE=3][FONT=Times New Roman] }[/FONT][/SIZE][/COLOR]
[COLOR=#333333][SIZE=3][FONT=Times New Roman]else[/FONT][/SIZE][/COLOR]
[COLOR=#333333][SIZE=3][FONT=Times New Roman]{[/FONT][/SIZE][/COLOR]
[COLOR=#333333][SIZE=3][FONT=Times New Roman] gotoAndStop(62);[/FONT][/SIZE][/COLOR]
[COLOR=#333333][SIZE=3][FONT=Times New Roman]}[/FONT][/SIZE][/COLOR]
[COLOR=#333333][SIZE=3][FONT=Times New Roman]}[/FONT][/SIZE][/COLOR]
[COLOR=#333333][FONT=Times New Roman][SIZE=3] [/SIZE][/FONT][/COLOR]
[COLOR=#333333][SIZE=3][FONT=Times New Roman]The enter button works correctly when any single element of the array is entered into the input text. However, all of entries must be in the input text – but they can be in any order – for a solution to be correct. How can I do this? Thanks![/FONT][/SIZE][/COLOR]