Code Snippets in Flash CS5

Code Snippets in Flash CS5
For those of us who don't like change, we will be happy to see that the workspace for Flash CS5 is basically unchanged from the CS4 version, with the exception of a few new and improved panels.

Flash CS5 has several new features for assisting with the ActionScript for your Flash movies. If you are a novice to ActionScript or a Flash developer who enjoys writing code, these new features will ease your daily workload and production time. The first one we will discuss is the new Code Snippets panel.

This great new feature for writing ActionScript is much like the Motion Presets feature. Code Snippets is a supply of prebuilt ActionScript code that you can add to your movie with just a click of your mouse. There are six categories of code snippets including Actions, Timeline Navigation, Animation, Load and Unload, Audio – Video and Event Handlers.

For example, in the Actions category we have a drag and drop snippet. If we double click on this action, we get a message asking us to select the object on the stage to which we wish to apply the code. So, let's draw a rectangle on the stage and try again. This time, Flash tells us that we need to convert the rectangle to a movie clip and offers to do this for us. When we click OK, the Actions panel automatically pops open with the new code highlighted.

Before we check out the code snippet, let's verify that Flash really did convert our rectangle to a movie clip. In the Properties Inspector, we see that we have a movie clip named Symbol 1 and the rectangle on the stage has been given an Instance Name of movieClip_1. You will also notice that Flash has added a new Actions layer above the default Layer 1 in the Timeline. Frame 1 of the Actions layer now has the little "a" that indicates that there is ActionScript attached to this frame. Flash has done all of this for us.

Moving on to the Actions panel, we see the new code. At the top, we see a short description of what the code does. If the code had required us to make any customized changes, we would have been given instructions. But this is a simple example and there are none. If we test our movie, we will indeed be able to drag our rectangle around the stage.

*Adobe provided a review copy to me free of charge.

Copyright 2018 Adobe Systems Incorporated. All rights reserved. Adobe product screen shot(s) reprinted with permission from Adobe Systems Incorporated. Adobe, Photoshop, Photoshop Album, Photoshop Elements, Illustrator, InDesign, GoLive, Acrobat, Cue, Premiere Pro, Premiere Elements, Bridge, After Effects, InCopy, Dreamweaver, Flash, ActionScript, Fireworks, Contribute, Captivate, Flash Catalyst and Flash Paper is/are either [a] registered trademark[s] or a trademark[s] of Adobe Systems Incorporated in the United States and/or other countries.





RSS
Related Articles
Editor's Picks Articles
Top Ten Articles
Previous Features
Site Map








Content copyright © 2023 by Diane Cipollo. All rights reserved.
This content was written by Diane Cipollo. If you wish to use this content in any manner, you need written permission. Contact Diane Cipollo for details.