We will continue on from our our example last week where we managed to map data values pertaining to “person” objects to visual movieclip properties.
You can download the template files that act as a starting point for this exercise here.
Coding Concepts
Arrays
An array is essentially a list of items. The items are indexed by numbers starting from zero, so we can refer to the first element of an array like:
myArray[0]
… the second element like:
myArray[1]
… and so forth.
A sound understanding of arrays will help you grasp this week’s example. I recommend taking a look at some of the following links:
- http://www.foundation-flash.com/tutorials/arrays/
- http://www.republicofcode.com/tutorials/flash/as3arrays/
- http://blog.0tutor.com/post.aspx?id=224
- http://www.oreillynet.com/pub/a/oreilly/digitalmedia/helpcenter/actionscript30cookbook/chapter5.html
- http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/Array.html
Loops
It is common to loop over all the items in an array to perform the same actions to each item. A loop is just a code structure that allows us to perform a given statement or statements multiple times (without haveing to write out those statements multiple times).
Take a look at these links that explain how loops work: