1. Home
  2. Computing & Technology
  3. Animation

Flash Color Quiz: What's Your Mood?

By , About.com Guide

10 of 10

The last thing that we need to do is assign ActionScripts to the controller movie clip (within an onClipEvent) to both display the variable text as a result in one dynamic text box, then test against the value of the variable to determine which text will be displayed in the expanded results:
onClipEvent (enterFrame) {
_root.colorbox.text = _root.tint;
if (_root.tint=="yellow"){
_root.colordes.text = "Yellow description text.";
}
}

This script first takes the string assigned to the variable _root.tint and assigns it to the text property of the dynamic text field named "colorbox", so that it displays the value chosen (in this case, yellow).

Next the script uses an if statement to check to see if the value of the variable from the quiz choice matches a set value. If it does, it tells the dynamic text field named "colordes" to display the text string inside quotes. Your complete script would have more than one option; it would repeat the if-statement test by using multiple statements to see if _root.tint matches the strings "blue", "green", etc. and assigning a different string to _root.colordes depending on the match to the tested value.

That's it. Finish fleshing out your if statements for your various choices, and you should have a working quiz.

View my example.

Explore Animation
About.com Special Features

Holiday Central

What to eat, where to go, fun things to do and how to save money on the perfect gifts. More >

Family Tech Center

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

  1. Home
  2. Computing & Technology
  3. Animation
  4. Flash Animation Tutorials
  5. Flash for Games & Fun Stuff
  6. Flash Color Quiz: What's Your Mood?

©2009 About.com, a part of The New York Times Company.

All rights reserved.