Flash11: ActionScript 3: Using the Code Snippets Panel
|Flash11 (CS5) <|
|Table of contents|
CS5 Introduces a new feature that provides instant access to regularly used code snippets, all filed in an easy to use and access panel.
By the end of this exercise you should be able to access and implement commonly used code snippets.
Accessing the Panel
The Code snippets panel is located in the Windows menu on the toolbar. Clicking Code Snippets will float the snippets panel. Keep it floated or drag to drop in or next to any existing panel or dock. It is quite useful to have this docked in under the library.
|Open the code snippets panel:||Dock or float in a convenient place for you:|
Using the Code
You now have an easily access resource containing a number of ready to use and adapt ActionScript snippets. Create a small square on the stage using the shape tool. Make sure it is selected, then open the snippets panel and open the Event Handlers folder. Double click on Mouse Click Event. You will get a message telling your shape will need to be converted to a movie clip before the code snippet can be applied. Flash 11 automatically does this for you each time you apply a snippet, so you can tick the box "Don't show Again" and Click OK.
The Actions panel will open and you will presented with ready made script set to go. The .addEventListener and MouseEvent function are added ready for customizing. It would be a good idea at this stage to give your object a unique name and reflect that in the code (to prevent meaningless movieClip_2, movieClip_3 scenarios as your project develops.), and likewise your function name.
This is just one of the new and useful features in the latest Adobe Release.
Video Tutorials at Adobe TV 
Code Snippets at Adobe
- Adobe TV(2010), retrieved 29 August 2010, from http://tv.adobe.com/product/flash/
- Adobe, Code Snippets for Beginning ActionScript 3 Developers(2010), retrieved 28 August 2010, from http://www.adobe.com/devnet/flash/articles/code_snippets_panel_03.html