Home
Username:
Password:
Adobe Flash ActionScript 3.0 for Designers Tutorials

Your First Script / The Actions Panel pt. 2

Subtitles of the Movie

Both the Actions Panel and the Script Window contain Toolbars here at the top of the window to access code assistance features that help simplify and streamline coding in ActionScript. The tools are a bit different depending on whether you're using the Actions Panel or the Script Window, but you'll be getting very familiar with the various tools here as we work through our scripts. But let me give you a rundown now of each of their names as well as a short description of each starting in the upper left-hand corner is this little Plus sign. It is the Add a new item to the script Icon. This displays the language elements that are also in the Actions Toolbox over here. Select an item by clicking on the little Plus sign and then rolling your mouse over and that'll then add it right there to the script. Let's go ahead and go to the bottom of the line here and add another one like so. Notice that I'm also getting these parameters here, these suggestions for parameters. Next is we have the Find button. This will find and replace any text that you specify in the script. Adjacent to that is the Insert Target Path Tool. This is in the Actions Panel only. This helps you set an absolute or relative Target Path for an action in the script. Notice that this tool provides a very handy diagram of your file structure letting you know where your movie clips and buttons are. In this case I have a series of buttons that are on the main Timeline. That's what the root means, right there. That's the main Timeline. Much more on this Insert Target Path Tool a little bit later in the tutorial. Next, we have the Check Syntax Tool. This checks for syntax errors in the current script. Syntax errors are then listed in the Output Panel if it finds any. Next is the Auto Format Tool. This formats your script for proper coding syntax and improved readability. Set Auto Formatting Preferences in the Preferences dialog box which is available from the Edit Menu or from the Actions Panel menu over here in the upper right-hand corner. Accidentally clicked on the Script Assist button, so let's move back out of Script Assist because you'll notice that not all of these tools are available in Script Assist Mode. Next here is the Show Code Hint Tool. If you've turned Off automatic code hinting use this Show Code Hint to display a code hint for the line of code you're working on. You just saw a Code Hint when I inserted that last line of code. Next is the Debug Options Tool. This is in the Actions Panel only. This sets and removes breakpoints so that you can proceed line by line through your script when debugging. You can use Debug Options only for ActionScript files, not ActionScript communication or Flash JavaScript files. Notice there's a little drop-down menu there. Your Debug options are Toggle Breakpoint or Remove All Breakpoints. Next, we have the Collapse Between Braces. If we go ahead and click in between, since I have some curly braces here, let's click anywhere between those two curly braces and then click on the Collapse Between Braces and notice that this will collapse everything between those two curly braces. Let's try another one up here. Notice that it cleans up and compresses long code. This tool is an association with the Expand All Tool, which will then go ahead and expand the scripts between the curly braces and then also select them so you can see very clearly what is between the curly braces. In between those two tools is the Collapse Selection, so I can just choose a selection of script to collapse and then uncollapse or expand everything by clicking on the Expand All button. Next, we get to the Apply Block Comment Tool. This is an important one for us and we'll be talking a lot about comments in this tutorial This tool adds a comment marker to the beginning and another comment marker to the end of a selected Code Block. Let's go ahead and paste some text in here that can be providing us a comment and let's go ahead and add some carriage returns here. Let's select this text here and now I'll click on the Apply Block Comment. Notice that it adds a comment tag to the beginning and end of that block of text. If you have a single line of text that you want to comment out, like this one right here, you can use the Single Line Comment Tool and that will just comment out that individual line. The next tool is the Remove Comment. That'll make that line uncommented, so you can use these tools in conjunction to add and take away comments. Next is the Show-Hide Toolbox Toggle. This displays or hides the Actions Toolbox giving you more room in your scripting environment here. Next, we have the Script Assist button. This is the Actions Panel only. In Script Assist Mode you're presented with a User Interface for entering the elements needed to create scripts. Notice you'll get this warning if you have problems, any errors in your script and Flash will not let you move into Script Assist Mode until you fix the errors. I have some errors here in this script. Hidden in the upper right-hand corner is the Help Tool. This displays reference information for the ActionScript element that was selected in the Script Pane when I clicked on the Help Tool. And the last tool I want to mention here, also only found in the Actions Panel, is the Panel Menu. That's way over here in the upper right-hand corner. You may miss this one. I also refer to these as contextual menus. Click on that and you get a series of commands and preferences that apply to the Actions Panel. For example you can pin scripts, auto format, check syntax, import script, export script, print, script assist and so on. OK, so now that you've had an orientation to the various elements in the Actions Panel let me now move on to the next movie and let's go back to the Navigation example that I gave you at the beginning of this section and start writing our first script.

Tutorial Information

Course: Adobe Flash ActionScript 3.0 for Designers
Author: James Gonzalez
SKU: 34060
ISBN: 1-935320-82-3
Release Date: 2009-11-09
Duration: 9.5 hrs / 101 lessons
Work Files: Yes
Captions: Available on CD and Online University
Compatibility: Vista/XP/2000, OS X, Linux
QuickTime 7, Flash 8

VTC Sign up & Benefits

  • Unlimited Access
  • 98,729 Video Tutorials (23,265 free)
  • Video Available as Flash or QuickTime
  • Over 1026 Courses
  • $30 for One Month Access
  • Multi-User Discounts Available