Code Snippets are pieces of predefined code that can be reused, saved in the "Code Snippets" panel. They are organized on cathegories and functions, such as: "Animation", "Timeline Navigation", and others.
You can open this panel from the Window -> Code Snippets menu, or the button "Code Snippets" found in the Actions panel (as you can see in the following image).

Code Snippets
Flash has a few functions /codes saved in "Code Snippets". For example, to make a button execute a jump to a certain frame, instead of writing the whole code (with the necessary event and function), you can add it directly from the "Code Snippets" panel, being saved in the "Timeline Navigation" catalogue, with the name "Click to Go to Frame and Play".
To add a code-snippet into your script, double-click on its name, select it and click the button "Add to current Frame".
• Flash has in "Code Snippets" some of the most used functions for working with ActionScript. To learn about them you must browse their list, the name with which they are saved also explains their role.

Besides these predefined functions included in Adobe Flash, you can also add your own pieces of code to be stored in "Code Snippets", useful when you usually use a same code expression, functions or any code.
• To add your own code in the "Code Snippets" panel, you must click on the panel's options menu (upper-right)and choose the option Create New Code Snippet, Flash will open a window as the one in the following image.
Create Code Snippets
- At Title you must write the name (as suggestive as possible) that will appear for that code added in "Code Snippets".
- The description that is writte at Tooltip will appear when the mouse is positioned over the name stored in the panel.
- You write the ActionScript code in the text area, Code. If a certain piece of the code is already selected in the "Actions panel", use Auto-fill button to add the selected code in the "Code" area.
- After pressing the OK button, the respective code is added with the name specified at "Title" in a folder named "Custom" (created automatically by Flash).

Predefined codes as well as those added in "Code Snippets" are stored in a XML file.
- To re-edit a Code Snippet, right-click on its name and choose Edit Code Snippets XML. This will open the XML file with all the predefined codes from the panel. Then, you must find the code in that file (with "Ctrl+F") and edit it. Then click File -> Save.
- The option "Copy to Clipboard" (which appers when you right-click on a code-snippet) copies the respective code in memory, and then it can be added (with Paste) in the "Actions panel".
- With "Delete Code Snippet" the respective code will be deleted from the panel.
- The XML file with all the codes stored in "Code Snippets" can be exported with the option "Export Code Snippets XML".
- With "Reset to Default XML" the "Code Snippets" panel is restored to it's initial predefined codes.

Daily Test with Code Example

Which tag is used in <table> to create table header cell?
<thead> <th> <td>
  <th>Title 1</th>
  <th>Title 2</th>
Which CSS property sets the distance between lines?
line-height word-spacing margin
.some_class {
  line-height: 150%;
Which function opens a new browser window.
alert() confirm() open()
document.getElementById("id_button").onclick = function(){"");
Indicate the PHP function that returns an array with names of the files and folders inside a directory.
mkdir() scandir() readdir()
$ar_dir = scandir("dir_name");
Code Snippets - Add and Create

Last accessed pages

  1. Bubbles3 (24834)
  2. Working with getElementsByTagName (8601)
  3. Splat Operator in PHP (1435)
  4. Super Dragon Mahjongg (2554)
  5. Script Users Register, Login, Online (14792)

Popular pages this month

  1. Qwop (4094)
  2. Bubbles3 (3537)
  3. Butterfly Kyodai (2503)
  4. Zuma Deluxe (2305)
  5. Backgammon (1198)