Lesson 6. Creating and Manipulating Data

When you use Flash to create an application, you use the Text tool to enter information directly onto the stage. Text that you enter in this manner is said to be hard coded because it's permanent once the SWF file is published. If you want to alter data that's hard coded into your Flash application, you must edit the Flash source filea cumbersome and unnecessary process because Flash lets you define areas where text can be displayed dynamically. Instead of being set when the SWF is published, dynamic data is processed and stored at run time (while the SWF file is running), which means you can change it as often as you want. Dynamic data can be user-supplied information, data loaded from another file, or even information you can't control, such as the current time. You can use this type of data to display information, make decisions, manipulate the position of movie clips, and much more.

This temperature converter manipulates data by converting values from one scale to anotherFahrenheit to Celsius.

graphics/06inf01.gif

In this lesson, you'll learn how to create objects, variables, and arrays (all elements of a data-driven project), as well as how to manipulate data already within your project (such as numbers and strings of text) in order to display your data in new and useful ways.

WHAT YOU WILL LEARN

In this lesson, you will:

  • Learn the power of dynamic data

  • Create text fields

  • Create variables

  • Create arrays

  • Store information in objects

  • Retrieve information from storage dynamically

  • Build expressions

  • Learn about precedence

  • Manipulate numbers with the Math class

  • Gain experience with the methods of the String class

APPROXIMATE TIME

This lesson takes approximately one and one half hours to complete.

LESSON FILES

Starting Files:

Lesson06/Assets/newsFlash1.fla

Lesson06/Assets/tempConverter1.fla

Lesson06/Assets/madlibs1.fla

Completed Projects:

newsFlash5.fla

tempConverter2.fla

madlibs2.fla