Creating User Interface (UI) Interactions with Flash Designing the Prompts Selecting the UI Components Naming the Instances Writing the ActionScript Testing the Feedback
Interacting with Users Create the frame that will prompt the user for input. Create any feedback frames that you can anticipate needing. Give each User Interface (UI) component a logically meaningful instance name. Use ActionScript for the branching.
Creating the Layers Create the following three layers: a “text” layer that will contain the text; a “buttons” layer to contain the buttons; an “actions” layer that will contain the ActionScript.
Designing the Prompt In this example, we create a multiple choice question. The prompt will include the following UI components: One radio button for each choice. A submit button.
The Question Frame Make this be Frame 1: Who is buried in Grant’s tomb? ◦ Beethoven ◦ Grant ◦ Mozart
Feedback for a Wrong Answer Make this be Frame 3: No, that is not correct. Think about the name on the tomb, which is Grant.
Feedback for a Correct Answer Make this be Frame 5: Correct! Grant is indeed buried in Grant’s tomb. Nice work!
Naming the Instances Name the radio buttons: Beethoven Grant Mozart Name the submit button: submit_btn Name the try again button: retry_btn
Submit button ActionScript Put this in Frame 1: stop(); submit_btn.onRelease = function () { if (Grant.selected) { gotoAndStop(5); } else { gotoAndStop(3); } };
Retry button ActionScript Put this in Frame 3: retry_btn.onRelease = function () { gotoAndStop(1); };