Start learning with our library of video tutorials taught by experts. Get started
Viewers: in countries Watching now:
Through several hands-on tutorials, instructor Todd Perkins shows how to best build dynamic, streamlined sites using Flash CS3 Professional. Learn how to create custom keyboard shortcuts, apply advanced text techniques such as animating scrolling text with custom easing controls, and using advanced animation techniques. Flash CS3 Professional Beyond the Basics covers many challenging features, including adding complex interactivity to a Flash CS3 project and getting Flash content on a phone. Exercise files accompany the tutorials.
Another important part of ActionScript 3.0 is something called an array. In this movie we'll talk about arrays and how to create them and work with them in Flash. If you're following along and working in 05_arrays.fla in the Chapter 02 folder in the Exercise Files folder. You can also just create a blank document and rename layer one to actions. So let's select the first keyframe of actions layer and open up the Actions panel. To do that press Option+F9 on the Mac, or F9 on the PC. And now in the Actions panel let's create an array. To create an array type var and then space.
And that will create a variable to hold our array. Now we'll create a name for our array. I'm going to call my array my_ary. Set the data type using a colon to Array with a capital A. I'll set that equal to a new array by using shorthand notation. Remember the shorthand notation to create an array is using square brackets. Inside of the square brackets I'm going to type the values of my array and I'll separate the values with commas. The date inside of an array can be one data type or multiple data types. It doesn't matter what type of data is inside the array.
For example, the first value in my array can be 5, a number. The second value can be my name, Todd, in quotes. Remember quotes in Flash indicate a string. A string is a text value So a comma, and the next value we'll do a boolean value. Remember boolean is true or false. The value we'll pass then is true. Remember that's not in quotes because it's not a string but a true or false value. So there's a look at creating an array. But what if wanted to access the data inside of the array. Remember that each item in an array has an index number.
In Flash an array index starts at zero and then one and two and so on. So the number five in here would be my array index zero. The text value Todd, would be my array index one. And true would be my array index 2. Let's go to the next line and talk about how to access data in an array. I'm going to type trace and parentheses and a semicolon to end the statement. Inside of the parentheses I'm going to trace the value my_ary(1) index one. Now to tell Flash I'm going to reference an index of an array I use square brackets.
The value that you pass into the square brackets, represents the index of the array that you want to reference. So I'm tracing my array index one, which when I test the movie should give me a value of Todd. So let's test the movie and make sure it works. Command+Return on the Mac, Ctrl+Enter on the PC. And there's Todd in the Output window. I'm going to close the Output window, and the Flash player window. And there's a look at creating and working with an array.
There are currently no FAQs about Flash CS3 Professional Beyond the Basics.
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.