Join Joey Lott for an in-depth discussion in this video working in the environment, part of ActionScript 2.0 Essential Training.
When you first start working with something, it's typically a good idea to familiarize yourself with the environment. The first time that you're driving a car you want to know where all of the controls are. You want to know where the controls are for the headlights, the windshield wipers; you want to know where you can find the tachometer and the speedometer. That way you can drive the car with confidence knowing that whatever situation may arise you will be able to respond, using the tools that you have at your command. Well, the same thing is true with Flash and ActionScript. So the first thing we're going to do is take a look at the ActionScript environment.
When you're working with ActionScript the primary place that you're going to be working is in the Actions panel. You can open the Actions panel by choosing the Windows menu and then the Development Panels>Actions option. You may also notice that there's a keyboard shortcut that opens and closes the Actions panel. And that is F9. And I will be using F9 almost exclusively throughout this title. Because it's a huge timesaver. Rather than have to go through the menu each time. So I've got the Actions panel open. And what we see here is what I call - what's called the Script Pane.
This is where we can type all of our code into the Actions panel using the keyboard, or if we want to copy and paste we can do that here. Also, you'll see that over on the left side is the Actions toolbox. And there's also a Script Navigator. If you have the MX Professional version. That's this lower portion. But we're not going to be focusing on that in this title. So I am going go ahead and minimize that. So the Actions toolbox is a great place to look to for reference.
And we'll be looking at the Actions Tool Box more extensively in later lessons. So I am going to go ahead and minimize that for the time being. When you're working with the Actions panel you have your toolbar at the top. And many of those options are enabled only once you've entered some code. So if I entered some some code - and this is just an example of a variable declaration that we'll be taking a look at in a few minutes - so I'll type in a variable that I'll call nQuantity. Now, once I've done that you'll notice that many of the options on the toolbar are available.
And some of these we'll look at in more detail a little bit later on. The Find function, of course, works just as a regular Find function would work in any kind of text editor. The same with the Replace. And then you have a Check Syntax function, which is something we'll be looking at in later lessons. And then there's also a Show Code Hint. Now, code hints are a great feature in Flash. And what that means is that once you've typed in something that Flash recognizes as a special trigger, you have the opportunity of telling Flash to give you some hints about what code might come next.
And we'll be using that a lot throughout the lessons in this title. At the far right you have some options for opening the Help Panel. Which is a button called Reference. And the Help Panel is a great place to look for any kind of information about ActionScript that you might need just a little bit of a refresher on. You have the Search option. If you click on the Search button then you can type in a keyword. And if I wanted to search on variable, then I can get all of the help pages that have anything to do with the keyword variable.
And then I can also open the Table of Contents. Which is a set of folders that contain documents which are organized into different groups. Also know that you can Update your help content if any new content is available on line. Okay, I am going to go ahead and close that. And then we also have some Debug Options, which are something that we won't focus on in this title. And then you'll have a few options that I do want to point out. Particularly, the View Line Numbers option. So you'll see that my View Line Numbers option is already selected.
If I deselect it, then the line number in the left margin of my Script pane no longer displays the line numbers. I like to show the line numbers. It's a great way to be able to refer to particular lines of code. It's especially helpful when teaching or working in groups with people. And then there's also a Word Wrap option. And so you can turn on Word Wrap within your Script editor if you want. There's another thing that I'd like to point out quickly, and that's the Preferences. So that you can adjust the preferences to your liking for the Actions panel.
So if you open the menu for the Actions panel then you'll see that there is a Preference option. If you click on that, then it opens the Preferences Dialog Box. And it automatically selects the ActionScript tab. By default we have Automatic indentation. That means that there are particular code conventions which make our code more readable, where we indent particular lines of code. For example, within a function - and we'll be dealing with functions in a later lesson - and the function body is nested so that we can determine which part of our code is grouped together.
So Automatic indentation is turned on by default. If you don't want that you can deselect it. You can also select the Tab size. It defaults to be equivalent to 4 spaces. Code hints is something that we'll be looking at, as I said, a little bit later on. You can have the Code hints displayed automatically if you want. And the default is they are displayed automatically whenever Flash recognizes a particular trigger. And they also display immediately. And you can also change the Delay to anything up to 4 seconds, if you'd like. And the other thing to look at is you can change the text in your Actions panel.
So you can change the font size if you find that the font size is too small or too large. And you can also change the Syntax coloring. And you'll notice that in my code here, the Keyword "var", for example, and the keyword "Number" are highlighted in blue. That's because those are particular keywords that Flash recognizes, and it highlights them as blue because that's what I've set here in my preferences. And then the value of "nQuantity", which is a name that I made up, is simply displayed in black because it's unrecognized as having a particular significance in ActionScript.
So that's what we want to familiarize ourselves with in terms of the ActionScript environment. And then the next thing we'll look at is variables and data type.
Note: This product was previously named Learning ActionScript 2.0 in Flash MX 2004
- The work environment
- Datatypes and variables
- Movie clips
- CSS in Flash
- Video in Flash