Viewers: in countries Watching now:
In ActionScript 3.0 in Flash Professional CS5 Essential Training, Todd Perkins shows Flash designers how to incorporate ActionScript code into their projects and create interactive presentations and applications. The course includes a review of ActionScript language basics and the object-oriented programming (OOP) methodology, a tour of those Flash Professional CS5 features designed for developers, such as code hinting and the Code Snippets panel, and instructions on interacting with objects in the Library and placing code on the Timeline. Exercise files are included with the course.
Code snippets give you an excellent starting point when writing code, by giving you access to dozens of useful, prewritten blocks of ActionScript. To access the Code Snippets panel, you can click the Code Snippets button in the top-right of the Actions panel, or go to Window > Code Snippets. Now, you're probably already familiar with the Code Snippets panel, so I'm just going to do a quick review. The snippets are organized in categories: regular actions, actions for timeline navigation, for animation, loading and unloading files, et cetera.
Let's say I want to stop the Timeline. I could expand the Timeline Navigation, and double-click stop at this frame. In the Actions panel, you'll see the stop action is added. It says 'stop,' and there's parentheses, and then as semicolon, and there is a comment. You can tell it's a comment because it's gray. Remember that multiline comments start with a forward slash and an asterisk and then end with asterisk forward slash. This comment explains what the code does. Now, you've probably already done this before, if you've ever used the Code Snippets panel.
But another thing you can do with the Code Snippets panel, if you're an advanced user, is create your own code snippets. Let's go back to the Code Snippets panel and see how to do this. To create your own snippet, click the Gear icon at the top-right of the Code Snippets panel. Then choose Create New Code Snippet. Give your code snippet a Title. Give your code snippet a tooltip.
You can autofill from code that's already selected in the Actions panel if you want, or you can simply write your code in the Code area. This code doesn't really do anything, so you don't need to copy it down if you don't want to. Note that you can also check this box to automatically replace instance_name_here when you're applying the code snippet. You may have seen an example of that when you, say select a button, and then use a code snippet to make that link to a web site.
That's what you're essentially doing here. To create the code snippet that does that, you simply type instance_name_here, and Flash will automatically replace that code with the correct instance name when you select it on the stage and apply the code snippet. Keep in mind that if you didn't understand that, it's no big deal. That's something that you're going to understand more about when you learn more about ActionScript. So I'll click OK to create the code snippet, and then you can see my example snippet in the Custom section. So, I'm going to apply it into my code by double-clicking it, and there it is right there.
So if you ever find yourself constantly writing the exact same block of code, see if you can find it prewritten in the Code Snippets panel. If it's not there, you can always add it yourself, so you can save time when creating your projects.
Find answers to the most frequently asked questions about ActionScript 3.0 in Flash Professional CS5 Essential Training .
Here are the FAQs that matched your search "" :
Sorry, there are no matches for your search "" —to search again, type in another word or phrase and click search.
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.