Flash11: ActionScript 3: Using the Code Snippets Panel

From virtualMV2015wiki
Jump to: navigation, search
 Home  Flash11 (CS5) <

CS5 Introduces a new feature that provides instant access to regularly used code snippets, all filed in an easy to use and access panel.

Icon Objective.png

Objective

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: Sd codesnippetspanel.png Dock or float in a convenient place for you: Sd dockedpanel.png

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.

Sd converttomovieclip.png


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.

Sd readymadeas.png

This is just one of the new and useful features in the latest Adobe Release.

Resources

Video Tutorials at Adobe TV [1]

Code Snippets at Adobe[2]


Icon References.png References

  1. Adobe TV(2010), retrieved 29 August 2010, from http://tv.adobe.com/product/flash/
  2. 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

 

Day, S. (2010). Flash11: ActionScript 3: Using the Code Snippets Panel. Retrieved December 14, 2017, from http://www.virtualmv.com/wiki/index.php?title=Flash11%3A_ActionScript_3%3A_Using_the_Code_Snippets_Panel