Breaking Down the Interactive Process Flash

Before you can become an ActionScript code warrior, you need to realize that this isn’t just a weekend activity—if you want to excel at Flash ActionScripting, you’ll need to commit the time and energy necessary for the proper revelations to occur. You need to create some trials for yourself, to test your textbook knowledge and allow you to apply problem-solving techniques.

You might be thinking, “Oh no, you mean it’s like geometry, where I’m given a problem, and I have to use theorems and postulates to create a proof?” Not exactly, but programming, like geometry, requires strong reasoning and justification skills. You need to be able to understand how values (for example, the height of a Movie Clip instance) are determined, what type of changes you can perform on those values, and how changes to one value might affect another value. Confused? Don’t worry, we take this one step at a time.

Define your problems
Regardless of what interactive authoring tool you use (DHTML and JavaScript, Flash, Director, and so on), you can’t begin any production work until you have a clear idea of the product. What is it that you are setting out to do? At this point in the process, you should use natural language to describe your problems; that is, define your objective (or problem) in a way that you understand it. For example, let’s say that you want to make a quiz. You’ll have to run through a list of goals for that interactive product:

  • Is it a true/false test?
  • Or will it be multiple choice?
  • Or fill-in-the-blank?
  • An essay test?
  • How many questions will be in the quiz?
  • Will there be a time limit for each question?
  • Will you notify the person of wrong answers?
  • How many chances does the person get to answer correctly?
  • There are other questions, of course, that could help define what your product will encompass. Don’t try to start Flash production without setting some project parameters for yourself.

Clarify the solution
After you have defined the boundaries for the project, you can start to map the process with which your product will operate. This step involves the procedure of the experience (in other words, how the person will use the product you are creating).

With our quiz example, you might clarify the solution as:

  1. User starts movie, and types his/her name.
  2. After submitting the name, the user will be told that they have 10 minutes to complete a 25-question quiz that’s a combination of true/false and multiplechoice questions.
  3. Upon acknowledging the instructions (by pressing a key or clicking a button), the timer starts and the user is presented with the first question.
  4. The timer is visible to the user.
  5. The first question is a true/false question, and the correct answer is false.
  6. If the user enters a true response, then a red light graphic will appear and the sound of a buzzer will play. The user will be asked to continue with the next question.
  7. If the user enters a false response, then a green light graphic will appear and the sound of applause will play. The user will be asked to continue with the next question.
  8. This process repeats until the last question is answered, at which point the score is tallied and presented to the user.

The preceding eight steps are very close to a process flowchart. In real-life production, you would want to clarify Step 8 for each question in the same amount of detail as Steps 5 to 7 did. As you can see, once you start to map the interactive experience, you’ll have a much better starting point for your scripting work. Notice, that we’re already using logic, with our if statements in Steps 6 and 7. We’re also determining object properties such as _visible in Step 4. While we may not know all the ActionScript involved with starting a timer, we know that we have to learn how time can be measured in a Flash movie.

Translate the solution into the interactive language
After you have created a process for the movie to follow, you can start to convert each step into a format that Flash can use. This step will consume much of your time, as you look up concepts and keywords in the ActionScript Reference Guide.

It’s likely that you won’t be able to find a prebuilt Flash movie example to use as a guide, or if you do, that you’ll need to customize it to suit the particular needs of your project. For our quiz example, we could start to translate the solution as:

  1. Frame 1: Movie stops. User enters name into a text field.
    1. Frame 1: User clicks a submit Button symbol instance to initiate the quiz.
    2. The instructions are located on frame 2. Therefore, the Button action uses a gotoAndStop(2) action to move the playhead to the next frame.
    3. Frame 2: Static text will be shown, indicating the guidelines for the quiz.
  2. Frame 2: User clicks a start quiz Button symbol instance. An action on the Button instance starts a timer and moves the playhead to frame 3.
  3. Frame 3: The current time of the timer is displayed in a text field, in the upper-right corner of the Stage.
  4. Frame 3: The first question is presented in the center of the Stage. A button with the text True and a button with the text False are located just beneath the question. The correct answer for the question is hidden in a variable name/value. The variable’s name is answer, and its value is false. This variable declaration appears as a Frame Action on frame 3. A variable, called score, will also be declared to keep track of the correct answer count. Its starting value will be 0.
    1. Frame 3: If the user clicks the True button, then an if/else action will check whether answer’s value is equal to true. If it is, then an action will set the _visible of a greenLight Movie Clip instance to true, and initiate and play a new Sound Object for the applause.wav file in our Library. Also, the value of score will increase by 1. If the value of answer is not true, then an action will set the _visible of a redLight Movie Clip instance to true, and initiate and play a new Sound Object for the error.wav file in our Library. The value of score will be left as is.
    2. Frame 3: A Button instance will appear, and when clicked, take the user to frame 4.
    1. Frame 3: If the user clicks the False button, then an if/else action will check whether answer’s value is equal to true. If it is, then an action will set the _visible of a greenLight Movie Clip instance to true, and initiate and play a new Sound Object for the applause.wav file in our Library. Also, the value of score will be increased by 1. If the value of answer is not true, then an action will set the _visible of a redLight Movie Clip instance to true, and initiate and play a new Sound Object for the error.wav file in our Library. The value of score will be left as is.
    2. Frame 3: A Button instance will appear, and when clicked, it will take the user to frame 4.

While there is more than one way we could have translated this into ActionScriptlike syntax, you’ll notice that a few key concepts are presented in the translation:

where events occur (frames or buttons), and what elements (for example, Button symbols or Movie Clip instances) are involved. Most importantly, you’ll notice that we used the same procedure for both the True and the False buttons. Even though we could hardwire the answer directly in the Button actions, we would have to change our Button actions for each question. By placing the same logic within each Button instance, we only have to change the value of the answer variable from frame to frame (or from question to question). Granted, this example was already translated for you, and 90 percent of your scripting woes will be in the translation process before you even have a testable Flash movie. You need to learn the basic terminology and syntax of the ActionScript language before you can start to write the scripting necessary for Steps 1 to 7. And that’s exactly what the rest do.



Face Book Twitter Google Plus Instagram Youtube Linkedin Myspace Pinterest Soundcloud Wikipedia

All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

Flash Topics