﻿<?xml version="1.0" encoding="UTF-8"?>
<CodeSnippets>
<!--
This file determines which code snippets appear in the Code Snippets panel.

isBranch attribute - Set to "false" for snippets.
title - The name of the snippet to display in the Code Snippets panel.
description - The description of the snippet to display in the tooltip.
requiresSymbol - Set to true if snippet requires an object to be selected on stage.
code - The code to insert.  Actual code should be placed inside the CDATA block as in this example.
minPlayerVersion - Require FLA file to meet a minimum Player version.
maxPlayerVersion -  Require FLA file to be less than or equal to a maximum Player version.
minASVersion - Require FLA file to meet a minimum ActionScript version.
maxASVersion - Require FLA file to be less than or equal to a maximum ActionScript version.

To create your own code snippets copy the following empty one and paste it into the category where you want it to appear.

	<snippet isBranch="false">
	  <title>Custom Snippet</title>
	  <description>This is an example of a custom code snippet.</description>
	  <requiresSymbol>true</requiresSymbol>
	  <code><![CDATA[
// Code goes here
trace("A custom code snippet");
	  ]]></code>
	</snippet>
-->
<snippets>
  <category title="Actions"
      isBranch="true" expanded="false"
      description="Code for common interactions">
	<snippet isBranch="false">
	  <title>Click to Go to Web Page</title>
	  <description>Clicking on the specified object loads a URL.</description>
	  <requiresSymbol>true</requiresSymbol>
	  <minASVersion>3</minASVersion>
	  <ADOBE_PIP_ID>Click_to_Go_to_Web_Page</ADOBE_PIP_ID>
	  <code><![CDATA[
/* Click to Go to Web Page
Clicking on the specified symbol instance loads the URL in a new browser window.

Instructions:
1. Replace http://www.adobe.com with the desired URL address.
   Keep the quotation marks ("").
*/

instance_name_here.addEventListener(MouseEvent.CLICK, fl_ClickToGoToWebPage);

function fl_ClickToGoToWebPage(event:MouseEvent):void
{
	navigateToURL(new URLRequest("http://www.adobe.com"), "_blank");
}
]]></code>
	</snippet>
	<snippet isBranch="false">
	  <title>Custom Mouse Cursor</title>
	  <description>Replaces the default mouse cursor with the specified object.</description>
	  <requiresSymbol>true</requiresSymbol>
	  <minASVersion>3</minASVersion>
	  <ADOBE_PIP_ID>Custom_Mouse_Cursor</ADOBE_PIP_ID>
	  <code><![CDATA[
/* Custom Mouse Cursor
Replaces the default mouse cursor with the specified symbol instance.
*/

stage.addChild(instance_name_here);
instance_name_here.mouseEnabled = false;
instance_name_here.addEventListener(Event.ENTER_FRAME, fl_CustomMouseCursor);

function fl_CustomMouseCursor(event:Event)
{
	instance_name_here.x = stage.mouseX;
	instance_name_here.y = stage.mouseY;
}
Mouse.hide();

//To restore the default mouse pointer, uncomment the following lines:
//instance_name_here.removeEventListener(Event.ENTER_FRAME, fl_CustomMouseCursor);
//stage.removeChild(instance_name_here);
//Mouse.show();
]]></code>
	</snippet>
	<snippet isBranch="false">
	  <title>Drag and Drop</title>
	  <description>Makes the object moveable with drag and drop.</description>
	  <requiresSymbol>true</requiresSymbol>
	  <minASVersion>3</minASVersion>
	  <ADOBE_PIP_ID>Drag_and_Drop</ADOBE_PIP_ID>
	  <code><![CDATA[
/* Drag and Drop
Makes the specified symbol instance moveable with drag and drop.
*/

instance_name_here.addEventListener(MouseEvent.MOUSE_DOWN, fl_ClickToDrag);

function fl_ClickToDrag(event:MouseEvent):void
{
	instance_name_here.startDrag();
}

stage.addEventListener(MouseEvent.MOUSE_UP, fl_ReleaseToDrop);

function fl_ReleaseToDrop(event:MouseEvent):void
{
	instance_name_here.stopDrag();
}
]]></code>
	</snippet>
	<snippet isBranch="false">
	  <title>Play a Movie Clip</title>
	  <description>Plays the specified movie clip on stage.</description>
	  <requiresSymbol>true</requiresSymbol>
	  <ADOBE_PIP_ID>Play_a_Movie_Clip</ADOBE_PIP_ID>
	  <code><![CDATA[
/* Play a Movie Clip
Plays the specified movie clip on stage.

Instructions:
1. Use this code for movie clips that are currently stopped.
*/

instance_name_here.play();
]]></code>
	</snippet>
	<snippet isBranch="false">
	  <title>Stop a Movie Clip</title>
	  <description>Stops the specified movie clip on stage.</description>
	  <requiresSymbol>true</requiresSymbol>
	  <ADOBE_PIP_ID>Stop_a_Movie_Clip</ADOBE_PIP_ID>
	  <code><![CDATA[
/* Stop a Movie Clip
Stops the specified movie clip on stage.

Instructions:
1. Use this code for movie clips that are currently playing.
*/

instance_name_here.stop();
]]></code>
	</snippet>
	<snippet isBranch="false">
	  <title>Click to Hide an Object</title>
	  <description>Clicking on the specified object hides it.</description>
	  <requiresSymbol>true</requiresSymbol>
	  <minASVersion>3</minASVersion>
	  <ADOBE_PIP_ID>Click_to_Hide_an_Object</ADOBE_PIP_ID>
	  <code><![CDATA[
/* Click to Hide an Object
Clicking on the specified symbol instance hides it.

Instructions:
1. Use this code for objects that are currently visible.
*/

instance_name_here.addEventListener(MouseEvent.CLICK, fl_ClickToHide);

function fl_ClickToHide(event:MouseEvent):void
{
	instance_name_here.visible = false;
}
]]></code>
	</snippet>
	<snippet isBranch="false">
	  <title>Show an Object</title>
	  <description>Shows the specified object.</description>
	  <requiresSymbol>true</requiresSymbol>
	  <minASVersion>3</minASVersion>
	  <ADOBE_PIP_ID>Show_an_Object</ADOBE_PIP_ID>
	  <code><![CDATA[
/* Show an Object
Shows the specified symbol instance.

Instructions:
1. Use this code to show objects that are currently hidden.
*/

instance_name_here.visible = true;
]]></code>
	</snippet>

	<snippet isBranch="false">
	  <title>Click to Position an Object</title>
	  <description>Moves the specified object to the coordinates you specify.</description>
	  <requiresSymbol>true</requiresSymbol>
	  <minASVersion>3</minASVersion>
	  <ADOBE_PIP_ID>Click_to_Position_an_Object</ADOBE_PIP_ID>
	  <code><![CDATA[
/* Click to Position an Object
Moves the specified symbol instance to the x-coordinate and y-coordinate you specify.

Instructions:
1. Replace the value 200 with the x-coordinate
   where you want to position the object.
2. Replace the value 100 witht he y-coordinate where you want to position the object.
*/

instance_name_here.addEventListener(MouseEvent.CLICK, fl_ClickToPosition);

function fl_ClickToPosition(event:MouseEvent):void
{
	instance_name_here.x = 200;
	instance_name_here.y = 100;
}
]]></code>
	</snippet>

	<snippet isBranch="false">
	  <title>Click to Display a TextField</title>
	  <description>Clicking on the specified object displays a TextField.</description>
	  <requiresSymbol>true</requiresSymbol>
	  <minASVersion>3</minASVersion>
	  <ADOBE_PIP_ID>Click_to_Display_a_TextField</ADOBE_PIP_ID>
	  <code><![CDATA[
/* Click to Display a TextField
Clicking on the specified symbol instance creates and displays a TextField at the x-coordinate and y-coordinate you specify.

Instructions:
1. Replace the value 200 with the x-coordinate where you want to position the TextField.
2. Replace the value 100 with the y-coordinate where you want to position the TextField.
3. Replace the string value "Lorem ipsum dolor sit amet" with the text you want to display in the TextField that appears. Keep the quotation marks.
*/

instance_name_here.addEventListener(MouseEvent.CLICK, fl_ClickToPosition);

var fl_TF:TextField;
var fl_TextToDisplay:String = "Lorem ipsum dolor sit amet."
function fl_ClickToPosition(event:MouseEvent):void
{
	fl_TF = new TextField();
	fl_TF.autoSize = TextFieldAutoSize.LEFT;
	fl_TF.background = true;
	fl_TF.border = true;
	fl_TF.x = 200;
	fl_TF.y = 100;
	fl_TF.text = fl_TextToDisplay;
	addChild(fl_TF);
}
]]></code>
	</snippet>

	<snippet isBranch="false">
	  <title>Generate a Random Number</title>
	  <description>Generates a random number between 0 and a number you specify.</description>
	  <ADOBE_PIP_ID>Generate_a_Random_Number</ADOBE_PIP_ID>
	  <code><![CDATA[
/* Generate a Random Number
Generates a random number between 0 and a limit number you specify.

Instructions:
1. To change the maximum random value, change the number 100 in the last line of this snippet to the number you want to use.
2. This code outputs the random number to the Output panel.
*/

function fl_GenerateRandomNumber(limit:Number):Number
{
	var randomNumber:Number = Math.floor(Math.random()*(limit+1));
	return randomNumber;
}
trace(fl_GenerateRandomNumber(100));
]]></code>
	</snippet>

	<snippet isBranch="false">
	  <title>Bring Object to the Front</title>
	  <description>Brings any clicked object to the front.</description>
	  <minASVersion>3</minASVersion>
	  <ADOBE_PIP_ID>Bring_Object_to_the_Front</ADOBE_PIP_ID>
	  <code><![CDATA[
/* Bring Any Clicked Object to the Front
Clicking on any symbol on the Stage moves it in front of all other instances.
*/

// This code makes all symbol instances on stage clickable by making them listen for the CLICK event.
for (var fl_ChildIndex:int = 0;
		fl_ChildIndex < this.numChildren;
		fl_ChildIndex++)
{
	this.getChildAt(fl_ChildIndex).addEventListener(MouseEvent.CLICK, fl_ClickToBringToFront);
}

// This is the function that moves the clicked object to the front of the display list

function fl_ClickToBringToFront(event:MouseEvent):void
{
	this.addChild(event.currentTarget as DisplayObject);
}
]]></code>
	</snippet>

	<snippet isBranch="false">
	  <title>Simple Timer</title>
	  <description>Displays a countdown timer in the Output panel until 30 seconds elapse.</description>
	  <minASVersion>3</minASVersion>
	  <ADOBE_PIP_ID>Simple_Timer</ADOBE_PIP_ID>
	  <code><![CDATA[
/* Simple Timer
Displays a countdown timer in the Output panel until 30 seconds elapse.
This code is a good place to start for creating timers for your own purposes.

Instructions:
1. To change the number of seconds in the timer, change the value 30 in the first line below to the number of seconds you want.
*/

var fl_TimerInstance:Timer = new Timer(1000, 30);
fl_TimerInstance.addEventListener(TimerEvent.TIMER, fl_TimerHandler);
fl_TimerInstance.start();

var fl_SecondsElapsed:Number = 1;
function fl_TimerHandler(event:TimerEvent):void
{
	trace("Seconds elapsed: " + fl_SecondsElapsed);
	fl_SecondsElapsed++;
}
]]></code>
	</snippet>
	<snippet isBranch="false">
	  <title>Countdown Timer</title>
	  <description>Counts down from a specified number of seconds.</description>
	  <minASVersion>3</minASVersion>
	  <ADOBE_PIP_ID>Countdown_Timer</ADOBE_PIP_ID>
	  <code><![CDATA[
/* Countdown Timer
Counts down from a specified number of seconds.

Instructions:
1. To change the length of the countdown, change the value 10 in the first line below to the number of seconds you want.
*/

var fl_SecondsToCountDown:Number = 10;

var fl_CountDownTimerInstance:Timer = new Timer(1000, fl_SecondsToCountDown);
fl_CountDownTimerInstance.addEventListener(TimerEvent.TIMER, fl_CountDownTimerHandler);
fl_CountDownTimerInstance.start();

function fl_CountDownTimerHandler(event:TimerEvent):void
{
	trace(fl_SecondsToCountDown + " seconds");
	fl_SecondsToCountDown--;
}
]]></code>
	</snippet>
	</category>


	<category title="Timeline Navigation"
	    isBranch="true"
	    description="Code to control movie playback">
	<snippet isBranch="false">
	  <title>Stop at this Frame</title>
	  <description>The Flash timeline will stop/pause at the frame where you insert this code.</description>
	  <ADOBE_PIP_ID>Stop_at_this_Frame</ADOBE_PIP_ID>
	  <code><![CDATA[
/* Stop at This Frame
The Flash timeline will stop/pause at the frame where you insert this code.
Can also be used to stop/pause the timeline of movieclips.
*/

stop();
]]></code>
	</snippet>

	<snippet isBranch="false">
	  <title>Click to Go to Frame and Stop</title>
	  <description>Clicking the object moves the playhead to the specified frame and stops the playhead.</description>
	  <requiresSymbol>true</requiresSymbol>
	  <minASVersion>3</minASVersion>
	  <ADOBE_PIP_ID>Click_to_Go_to_Frame_and_Stop</ADOBE_PIP_ID>
	  <code><![CDATA[
/* Click to Go to Frame and Stop
Clicking on the specified symbol instance moves the playhead to the specified frame in the timeline and stops the movie.
Can be used on the main timeline or on movie clip timelines.

Instructions:
1. Replace the number 5 in the code below with the frame number you would like the playhead to move to when the symbol instance is clicked.
*/

instance_name_here.addEventListener(MouseEvent.CLICK, fl_ClickToGoToAndStopAtFrame);

function fl_ClickToGoToAndStopAtFrame(event:MouseEvent):void
{
	gotoAndStop(5);
}
]]></code>
	</snippet>

	<snippet isBranch="false">
	  <title>Click to Go to Frame and Play</title>
	  <description>Clicking the object moves the playhead to the specified frame and continues playing.</description>
	  <requiresSymbol>true</requiresSymbol>
	  <minASVersion>3</minASVersion>
	  <ADOBE_PIP_ID>Click_to_Go_to_Frame_and_Play</ADOBE_PIP_ID>
	  <code><![CDATA[
/* Click to Go to Frame and Play
Clicking on the specified symbol instance moves the playhead to the specified frame in the timeline and continues playback from that frame.
Can be used on the main timeline or on movie clip timelines.

Instructions:
1. Replace the number 5 in the code below with the frame number you would like the playhead to move to when the symbol instance is clicked.
*/

instance_name_here.addEventListener(MouseEvent.CLICK, fl_ClickToGoToAndPlayFromFrame);

function fl_ClickToGoToAndPlayFromFrame(event:MouseEvent):void
{
	gotoAndPlay(5);
}
]]></code>
	</snippet>
	<snippet isBranch="false">
	  <title>Click to Go to Next Frame and Stop</title>
	  <description>Clicking the object moves the playhead to the next frame and stops the playhead.</description>
	  <requiresSymbol>true</requiresSymbol>
	  <minASVersion>3</minASVersion>
	  <ADOBE_PIP_ID>Click_to_Go_to_Next_Frame_and_Stop</ADOBE_PIP_ID>
	  <code><![CDATA[
/* Click to Go to Next Frame and Stop
Clicking on the specified symbol instance moves the playhead to the next frame and stops the movie.
*/

instance_name_here.addEventListener(MouseEvent.CLICK, fl_ClickToGoToNextFrame);

function fl_ClickToGoToNextFrame(event:MouseEvent):void
{
	nextFrame();
}
]]></code>
	</snippet>

	<snippet isBranch="false">
	  <title>Click to Go to Previous Frame and Stop</title>
	  <description>Clicking the object moves the playhead to the previous frame and stops the playhead.</description>
	  <requiresSymbol>true</requiresSymbol>
	  <minASVersion>3</minASVersion>
	  <ADOBE_PIP_ID>Click_to_Go_to_Previous_Frame_and_Stop</ADOBE_PIP_ID>
	  <code><![CDATA[
/* Click to Go to Previous Frame and Stop
Clicking on the specified symbol instance moves the playhead to the previous frame and stops the movie.
*/

instance_name_here.addEventListener(MouseEvent.CLICK, fl_ClickToGoToPreviousFrame);

function fl_ClickToGoToPreviousFrame(event:MouseEvent):void
{
	prevFrame();
}
]]></code>
	</snippet>
	<snippet isBranch="false">
	  <title>Click to Go to Next Scene and Play</title>
	  <description>Clicking the object moves the playhead to the next scene and continues playing.</description>
	  <requiresSymbol>true</requiresSymbol>
	  <minASVersion>3</minASVersion>
	  <ADOBE_PIP_ID>Click_to_Go_to_Next_Scene_and_Play</ADOBE_PIP_ID>
	  <code><![CDATA[
/* Click to Go to Next Scene and Play
Clicking on the specified symbol instance moves the playhead to the next scene in the timeline and continues playback in that scene.
*/

instance_name_here.addEventListener(MouseEvent.CLICK, fl_ClickToGoToNextScene);

function fl_ClickToGoToNextScene(event:MouseEvent):void
{
	MovieClip(this.root).nextScene();
}
]]></code>
	</snippet>
	<snippet isBranch="false">
	  <title>Click to Go to Previous Scene and Play</title>
	  <description>Clicking the object moves the playhead to the previous scene and continues playing.</description>
	  <requiresSymbol>true</requiresSymbol>
	  <minASVersion>3</minASVersion>
	  <ADOBE_PIP_ID>Click_to_Go_to_Previous_Scene_and_Play</ADOBE_PIP_ID>
	  <code><![CDATA[
/* Click to Go to Previous Scene and Play
Clicking on the specified symbol instance moves the playhead to the previous scene in the timeline and continues playback in that scene.
*/

instance_name_here.addEventListener(MouseEvent.CLICK, fl_ClickToGoToPreviousScene);

function fl_ClickToGoToPreviousScene(event:MouseEvent):void
{
	MovieClip(this.root).prevScene();
}
]]></code>
	</snippet>
	<snippet isBranch="false">
	  <title>Click to Go to Scene and Play</title>
	  <description>Clicking the object plays the movie from the specified scene and frame.</description>
	  <requiresSymbol>true</requiresSymbol>
	  <minASVersion>3</minASVersion>
	  <ADOBE_PIP_ID>Click_to_Go_to_Scene_and_Play</ADOBE_PIP_ID>
	  <code><![CDATA[
/* Click to Go to Scene and Play
Clicking on the specified symbol instance plays the movie from the specified scene and frame.

Instructions:
1. Replace "Scene 3" with the name of the scene you would like play.
2. Replace 1 with the frame number you would like the movie to play from in the specified scene.
*/

instance_name_here.addEventListener(MouseEvent.CLICK, fl_ClickToGoToScene);

function fl_ClickToGoToScene(event:MouseEvent):void
{
	MovieClip(this.root).gotoAndPlay(1, "Scene 3");
}
]]></code>
	</snippet>
	</category>


	<category title="Animation"
	    isBranch="true"
	    description="Code to change an object's properties over time">

	<snippet isBranch="false">
	  <title>Move with Keyboard Arrows</title>
	  <description>Allows the object to be moved with the keyboard arrows.</description>
	  <requiresSymbol>true</requiresSymbol>
	  <minASVersion>3</minASVersion>
	  <ADOBE_PIP_ID>Move_with_Keyboard_Arrows</ADOBE_PIP_ID>
	  <code><![CDATA[
/* Move with Keyboard Arrows
Allows the specified symbol instance to be moved with the keyboard arrows.

Instructions:
1. To increase or decrease the amount of movement, replace the number 5 below with the number of pixels you want the symbol instance to move with each key press.
Note the number 5 appears four times in the code below.
*/

stage.addEventListener(KeyboardEvent.KEY_DOWN, fl_PressKeyToMove);

function fl_PressKeyToMove(event:KeyboardEvent):void
{
	switch (event.keyCode)
	{
		case Keyboard.UP:
		{
			instance_name_here.y -= 5;
			break;
		}
		case Keyboard.DOWN:
		{
			instance_name_here.y += 5;
			break;
		}
		case Keyboard.LEFT:
		{
			instance_name_here.x -= 5;
			break;
		}
		case Keyboard.RIGHT:
		{
			instance_name_here.x += 5;
			break;
		}
	}
}
]]></code>
	</snippet>

	<snippet isBranch="false">
	  <title>Move Horizontally</title>
	  <description>Moves the object to the left or right.</description>
	  <requiresSymbol>true</requiresSymbol>
	  <minASVersion>3</minASVersion>
	  <ADOBE_PIP_ID>Move_Horizontally</ADOBE_PIP_ID>
	  <code><![CDATA[
/* Move Horizontally
Moves the specified symbol instance to the left or right by decreasing or increasing its x property by the specified number of pixels.

Instructions:
1. The default movement of the code as written is to the left.
2. To move the symbol instance to the right, change '-=' to '+=' below.
3. The '-=' operator is a shortcut to typing 'instance_name_here.x = instance_name_here.x - 100'.
4. To change the distance the symbol instance moves, change the number 100 below to the number of pixels you want the symbol instance to move.
*/

instance_name_here.x -= 100;
]]></code>
	</snippet>
	<snippet isBranch="false">
	  <title>Move Vertically</title>
	  <description>Moves the object up or down.</description>
	  <requiresSymbol>true</requiresSymbol>
	  <minASVersion>3</minASVersion>
	  <ADOBE_PIP_ID>Move_Vertically</ADOBE_PIP_ID>
	  <code><![CDATA[
/* Move Vertically
Moves the symbol instance up or down by decreasing or increasing its y property by the specified number of pixels.

Instructions:
1. The default movement of the code as written is up.
2. To move the symbol instance down, change '-=' to '+=' below.
3. The '-=' operator is a shortcut to typing 'instance_name_here.y = instance_name_here.y - 100'.
4. To change the distance the symbol instance moves, change the number 100 below to the number of pixels you want the symbol instance to move.
*/

instance_name_here.y -= 100;
]]></code>
	</snippet>

	<snippet isBranch="false">
	  <title>Rotate Once</title>
	  <description>Rotates the object one time in either direction.</description>
	  <requiresSymbol>true</requiresSymbol>
	  <minASVersion>3</minASVersion>
	  <ADOBE_PIP_ID>Rotate_Once</ADOBE_PIP_ID>
	  <code><![CDATA[
/* Rotate Once
Rotates the symbol instance by updating its rotation property by the specified number of degrees.

Instructions:
1. The default rotation of the code as written is clock-wise.
2. To rotate the symbol instance counter clock-wise, change '+=' to '-=' below.
3. The '+=' operator is a shortcut to typing 'instance_name_here.rotation = instance_name_here.rotation + 45'.
4. To change the amount the symbol instance rotates, change the value 45 below to the number of degrees of rotation you want.
*/

instance_name_here.rotation += 45;
]]></code>
	</snippet>
	<snippet isBranch="false">
	  <title>Rotate Continuously</title>
	  <description>Rotates the object continuously in either direction.</description>
	  <requiresSymbol>true</requiresSymbol>
	  <minASVersion>3</minASVersion>
	  <ADOBE_PIP_ID>Rotate_Continuously</ADOBE_PIP_ID>
	  <code><![CDATA[
/* Rotate Continuously
Rotates symbol instance continuously by updating its rotation property within an ENTER_FRAME event.

Instructions:
1. The default rotation of the code as written is clock-wise.
2. To change the direction of the rotation to counter clock-wise, change '+=' to '-=' below.
3. The '+=' operator is a shortcut to typing 'instance_name_here.rotation = instance_name_here.rotation + 10'.
4. To change the speed at which the symbol instance rotates, change the number 10 below to the number of degrees you want to rotate the symbol instance each frame. Higher numbers cause faster rotation.
5. Because the animation uses an ENTER_FRAME event, it progresses only when the playhead moves to a new frame, and the speed of the animation is also affected by the frame rate of the FLA file.
*/

instance_name_here.addEventListener(Event.ENTER_FRAME, fl_RotateContinuously);

function fl_RotateContinuously(event:Event)
{
	instance_name_here.rotation += 10;
}
]]></code>
	</snippet>

	<snippet isBranch="false">
	  <title>Animate Horizontally</title>
	  <description>Animates the object horizontally across the stage.</description>
	  <requiresSymbol>true</requiresSymbol>
	  <minASVersion>3</minASVersion>
	  <ADOBE_PIP_ID>Animate_Horizontally</ADOBE_PIP_ID>
	  <code><![CDATA[
/* Animate Horizontally
Moves the symbol instance left or right across the stage by decreasing or increasing its x property within an ENTER_FRAME event.

Instructions:
1. The default direction of the animation is to the left.
2. To change the direction of the animation to the right, change '-=' to '+=' below.
3. The '-=' operator is a shortcut to typing 'instance_name_here.x = instance_name_here.x - 10'.
4. To change the speed at which the symbol instance moves, change the number 10 below to the number of pixels you want the symbol instance to move in each frame.
5. Because the animation uses an ENTER_FRAME event, it progresses only when the playhead moves to a new frame, and the speed of the animation is also affected by the frame rate of the FLA file.
*/

instance_name_here.addEventListener(Event.ENTER_FRAME, fl_AnimateHorizontally);

function fl_AnimateHorizontally(event:Event)
{
	instance_name_here.x -= 10;
}
]]></code>
	</snippet>
	<snippet isBranch="false">
	  <title>Animate Vertically</title>
	  <description>Animates the object vertically on the stage.</description>
	  <requiresSymbol>true</requiresSymbol>
	  <minASVersion>3</minASVersion>
	  <ADOBE_PIP_ID>Animate_Vertically</ADOBE_PIP_ID>
	  <code><![CDATA[
/* Animate Vertically
Moves the symbol instance vertically on the stage by decreasing or increasing its y property within an ENTER_FRAME event.

Instructions:
1. The default direction of the animation is up.
2. To change the direction of the animation to down, change '-=' to '+=' below.
3. The '-=' operator is a shortcut to typing 'instance_name_here.y = instance_name_here.y - 10'.
4. To change the speed at which the symbol instance moves, change the number 10 below to the number of pixels you want the symbol instance to move in each frame.
5. Because the animation uses an ENTER_FRAME event, it progresses only when the playhead moves to a new frame, and the speed of the animation is also affected by the frame rate of the FLA file.
*/

instance_name_here.addEventListener(Event.ENTER_FRAME, fl_AnimateVertically);

function fl_AnimateVertically(event:Event)
{
	instance_name_here.y -= 10;
}
]]></code>
	</snippet>

	<snippet isBranch="false">
	  <title>Fade In a Movie Clip</title>
	  <description>Fades in the object.</description>
	  <requiresSymbol>true</requiresSymbol>
	  <minASVersion>3</minASVersion>
	  <ADOBE_PIP_ID>Fade_In_a_Movie_Clip</ADOBE_PIP_ID>
	  <code><![CDATA[
/* Fade In Movie Clip
Fades in the symbol instance by increasing its alpha property within an ENTER_FRAME event until it is fully visible.
Instructions:
1. To change the speed at which the symbol instance fades in, change the 0.01 value below (valid values are in the range 0.0 - 1.0). Higher values cause faster fade in.
2. The '+=' operator is a shortcut to typing 'instance_name_here.alpha = instance_name_here.alpha + 0.1'.
3. Because the animation uses an ENTER_FRAME event, it progresses only when the playhead moves to a new frame, and the speed of the animation is also affected by the frame rate of the FLA file.
*/

instance_name_here.addEventListener(Event.ENTER_FRAME, fl_FadeSymbolIn);
instance_name_here.alpha = 0;

function fl_FadeSymbolIn(event:Event)
{
	instance_name_here.alpha += 0.01;
	if(instance_name_here.alpha >= 1)
	{
		instance_name_here.removeEventListener(Event.ENTER_FRAME, fl_FadeSymbolIn);
	}
}
]]></code>
	</snippet>
	<snippet isBranch="false">
	  <title>Fade Out a Movie Clip</title>
	  <description>Fades out the object.</description>
	  <requiresSymbol>true</requiresSymbol>
	  <minASVersion>3</minASVersion>
	  <ADOBE_PIP_ID>Fade_Out_a_Movie_Clip</ADOBE_PIP_ID>
	  <code><![CDATA[
/* Fade Out Movie Clip
Fades out the symbol instance by decreasing its alpha property within an ENTER_FRAME event until it is invisible.

Instructions:
1. To change the speed at which the symbol instance fades out, change the 0.01 value below (valid values are in the range 0.0 - 1.0). Higher values cause faster fade out.
2. The '-=' operator is a shortcut to typing 'instance_name_here.alpha = instance_name_here.alpha - 0.1'.
3. Because the animation uses an ENTER_FRAME event, it progresses only when the playhead moves to a new frame, and the speed of the animation is also affected by the frame rate of the FLA file.
*/

instance_name_here.addEventListener(Event.ENTER_FRAME, fl_FadeSymbolOut);
instance_name_here.alpha = 1;

function fl_FadeSymbolOut(event:Event)
{
	instance_name_here.alpha -= 0.01;
	if(instance_name_here.alpha <= 0)
	{
		instance_name_here.removeEventListener(Event.ENTER_FRAME, fl_FadeSymbolOut);
	}
}
]]></code>
	</snippet>
  </category>


  <category title="Load and Unload"
      isBranch="true"
      description="Code to load and unload assets">
	<snippet isBranch="false">
	  <title>Click to Load/Unload SWF or Image</title>
	  <description>Click to load an object, click again to unload it.</description>
	  <requiresSymbol>true</requiresSymbol>
	  <minASVersion>3</minASVersion>
	  <ADOBE_PIP_ID>Click_to_Load_Unload_SWF_or_Image</ADOBE_PIP_ID>
	  <code><![CDATA[
/* Click to Load/Unload SWF or Image from a URL.
Clicking on the symbol instance loads and displays the specified SWF or image URL. Clicking on the symbol instance a second time unloads the SWF or image.

Instructions:
1. Replace "http://www.helpexamples.com/flash/images/image1.jpg" below with the desired URL address of the SWF or image. Keep the quotation marks ("").
2. Files from internet domains separate from the domain where the calling SWF resides cannot be loaded without special configuration.
*/

instance_name_here.addEventListener(MouseEvent.CLICK, fl_ClickToLoadUnloadSWF);

var fl_Loader:Loader;

//This variable keeps track of whether you want to load or unload the SWF
var fl_ToLoad:Boolean = true;

function fl_ClickToLoadUnloadSWF(event:MouseEvent):void
{
	if(fl_ToLoad)
	{
		fl_Loader = new Loader();
		fl_Loader.load(new URLRequest("http://www.helpexamples.com/flash/images/image1.jpg"));
		addChild(fl_Loader);
	}
	else
	{
		fl_Loader.unload();
		removeChild(fl_Loader);
		fl_Loader = null;
	}
	// Toggle whether you want to load or unload the SWF
	fl_ToLoad = !fl_ToLoad;
}
]]></code>
	</snippet>

	<snippet isBranch="false">
	  <title>Click to Load Image from Library</title>
	  <description>Loads and displays an image from the Library.</description>
	  <requiresSymbol>true</requiresSymbol>
	  <minASVersion>3</minASVersion>
	  <ADOBE_PIP_ID>Click_to_Load_Image_from_Library</ADOBE_PIP_ID>
	  <code><![CDATA[
/* Click to Load Image from Library
Clicking the symbol instance displays the specified image from Library.
To load an image from the Library it must be located in the Library with its Export for ActionScript property turned on and a valid class name.

Instructions:
1. Right click on any bitmap symbol inside the library and select "Properties...".
2. Click the "Advanced" button to expand the "Bitmap Properties" dialog.
3. Enable the "Export for Actionscript" option.
4. Type 'MyImage' in the Class text field.
5. Click OK twice.
*/

instance_name_here.addEventListener(MouseEvent.CLICK, fl_ClickToLoadImageFromLibrary);

function fl_ClickToLoadImageFromLibrary(event:MouseEvent):void
{
	// If you want to add a different image from the library,
	// enter a different name in the Class text field at step 4 above and in the code below.
	var libImage:MyImage = new MyImage(0,0);

	var holder:Bitmap = new Bitmap(libImage);
	addChild(holder);
}
]]></code>
	</snippet>

	<snippet isBranch="false">
	  <title>Add Instance from Library</title>
	  <description>Adds an instance of the specified Library symbol to the stage.</description>
	  <minASVersion>3</minASVersion>
	  <ADOBE_PIP_ID>Add_Instance_from_Library</ADOBE_PIP_ID>
	  <code><![CDATA[
/* Add Instance from Library to the Stage
Adds an instance of the specified MovieClip or Button Library symbol to the stage. If you want to add a Bitmap Library symbol to the stage, please use the "Click to Load Image from Library" code snippet.

Instructions:
1. Right click on any symbol inside the library and select "Properties...".
2. Click the "Advanced" button to expand the "Symbol Properties" dialog.
3. Enable the "Export for Actionscript" option.
4. Type 'LibrarySymbol' in the Class text field.
5. Click OK twice.
*/

// If you want to add a different symbol from the library,
// enter a different name in the Class text field at step 4 above and in the code below.
var fl_MyInstance:LibrarySymbol = new LibrarySymbol();
addChild(fl_MyInstance);
]]></code>
	</snippet>

	<snippet isBranch="false">
	  <title>Remove Instance from Stage</title>
	  <description>Removes the specified symbol instance from the stage.</description>
	  <requiresSymbol>true</requiresSymbol>
	  <minASVersion>3</minASVersion>
	  <ADOBE_PIP_ID>Remove_Instance_from_Stage</ADOBE_PIP_ID>
	  <code><![CDATA[
/* Remove Instance from Stage
Removes the specified symbol instance from the stage.
*/

removeChild(instance_name_here);
]]></code>
	</snippet>

	<snippet isBranch="false">
	  <title>Load External Text</title>
	  <description>Loads and displays a text file in the Output panel.</description>
	  <minASVersion>3</minASVersion>
	  <ADOBE_PIP_ID>Load_External_Text</ADOBE_PIP_ID>
	  <code><![CDATA[
/* Load External Text
Loads an external text file and displays it in the Output panel.

Instructions:
1. Replace "http://www.helpexamples.com/flash/text/loremipsum.txt" with the URL address of the text file you would like to load.
The address can be a relative link or an "http://" link.
The address must be placed inside quotation marks ("").
*/

var fl_TextLoader:URLLoader = new URLLoader();
var fl_TextURLRequest:URLRequest = new URLRequest("http://www.helpexamples.com/flash/text/loremipsum.txt");

fl_TextLoader.addEventListener(Event.COMPLETE, fl_CompleteHandler);

function fl_CompleteHandler(event:Event):void
{
	var textData:String = new String(fl_TextLoader.data);
	trace(textData);
}

fl_TextLoader.load(fl_TextURLRequest);
]]></code>
	</snippet>

	</category>

	<category title="Audio and Video"
	    isBranch="true"
	    description="Code for working with audio and video">
	<snippet isBranch="false">
      <title>Click to Play/Stop Sound</title>
      <description>Click to play a sound, click again to stop it.</description>
	  <requiresSymbol>true</requiresSymbol>
	  <minASVersion>3</minASVersion>
	  <ADOBE_PIP_ID>Click_to_Play_Stop_Sound</ADOBE_PIP_ID>
	  <code><![CDATA[
/* Click to Play/Stop Sound
Clicking on the symbol instance plays the specified sound.
Clicking on the symbol instance a second time stops the sound.

Instructions:
1. Replace "http://www.helpexamples.com/flash/sound/song1.mp3" below with the desired URL address of your sound file. Keep the quotation marks ("").
*/

instance_name_here.addEventListener(MouseEvent.CLICK, fl_ClickToPlayStopSound);

var fl_SC:SoundChannel;

//This variable keeps track of whether you want to play or stop the sound
var fl_ToPlay:Boolean = true;

function fl_ClickToPlayStopSound(evt:MouseEvent):void
{
	if(fl_ToPlay)
	{
		var s:Sound = new Sound(new URLRequest("http://www.helpexamples.com/flash/sound/song1.mp3"));
		fl_SC = s.play();
	}
	else
	{
		fl_SC.stop();
	}
	fl_ToPlay = !fl_ToPlay;
}
]]></code>
	</snippet>

	<snippet isBranch="false">
	  <title>Click to Stop All Sounds</title>
	  <description>Clicking the object stops all sounds currently playing.</description>
	  <requiresSymbol>true</requiresSymbol>
	  <minASVersion>3</minASVersion>
	  <ADOBE_PIP_ID>Click_to_Stop_All_Sounds</ADOBE_PIP_ID>
	  <code><![CDATA[
/* Click to Stop All Sounds
Clicking on the symbol instance stops all sounds currently playing.
*/

instance_name_here.addEventListener(MouseEvent.CLICK, fl_ClickToStopAllSounds);

function fl_ClickToStopAllSounds(event:MouseEvent):void
{
	SoundMixer.stopAll();
}
]]></code>
	</snippet>

	<snippet isBranch="false">
	  <title>On Cue Point Event</title>
	  <description>Assigns a function to be executed each time a cue point is passed in the selected video.</description>
	  <requiresSymbol>true</requiresSymbol>
	  <minASVersion>3</minASVersion>
	  <ADOBE_PIP_ID>On_Cue_Point_Event</ADOBE_PIP_ID>
	  <code><![CDATA[
/* On Cue Point Event Handler
Executes the fl_CuePointHandler function defined below each time a cue point is passed in the specified video instance.

Instructions:
1. Add your custom code on a new line after the line that says "// Start your custom code" below.
The code will execute when cue points are reached in a video that is playing.
*/

import fl.video.MetadataEvent;

instance_name_here.addEventListener(MetadataEvent.CUE_POINT, fl_CuePointHandler);

function fl_CuePointHandler(event:MetadataEvent):void
{
	// Start your custom code
	// This snippet code displays the cue point's name in the Output panel
	trace(event.info.name);
	// End your custom code
}
]]></code>
	</snippet>

	<snippet isBranch="false">
	  <title>Click to Play Video</title>
	  <description>Clicking the object plays a video inside an FLVPlayback component.</description>
	  <requiresSymbol>true</requiresSymbol>
	  <minASVersion>3</minASVersion>
	  <ADOBE_PIP_ID>Click_to_Play_Video</ADOBE_PIP_ID>
	  <code><![CDATA[
/* Click To Play Video (Requires FLVPlayback component)
Clicking on the symbol instance plays a video in the  specified FLVPlayback component instance.

Instructions:
1. Replace video_instance_name below with the instance name of the FLVPlayback component that you want to play the video.
   The specified instance of FLVPlayback video component on stage will play.
2. Make sure you have assigned a video source file in the properties of the FLVPlayback component instance.
*/

instance_name_here.addEventListener(MouseEvent.CLICK, fl_ClickToPlayVideo);

function fl_ClickToPlayVideo(event:MouseEvent):void
{
	// Replace video_instance_name with the instance name of the video component
	video_instance_name.play();
}
]]></code>
	</snippet>

	<snippet isBranch="false">
	  <title>Click to Pause Video</title>
	  <description>Clicking the object pauses the video in an FLVPlayback component.</description>
	  <requiresSymbol>true</requiresSymbol>
	  <minASVersion>3</minASVersion>
	  <ADOBE_PIP_ID>Click_to_Pause_Video</ADOBE_PIP_ID>
	  <code><![CDATA[
/* Click To Pause Video (Requires FLVPlayback component)
Clicking on the symbol instance pauses the video in the specified FLVPlayback component instance.

Instructions:
1. Replace video_instance_name below with the instance name of the FLVPlayback component that you want to pause.
*/

instance_name_here.addEventListener(MouseEvent.CLICK, fl_ClickToPauseVideo);

function fl_ClickToPauseVideo(event:MouseEvent):void
{
	// Replace video_instance_name with the instance name of the video component
	video_instance_name.pause();
}
]]></code>
	</snippet>

	<snippet isBranch="false">
	  <title>Click to Rewind Video</title>
	  <description>Clicking the object rewinds the video in an FLVPlayback component.</description>
	  <requiresSymbol>true</requiresSymbol>
	  <minASVersion>3</minASVersion>
	  <ADOBE_PIP_ID>Click_to_Rewind_Video</ADOBE_PIP_ID>
	  <code><![CDATA[
/* Click To Rewind Video (Requires FLVPlayback component)
Clicking on the symbol instance rewinds the video in the specified FLVPlayback component instance.

Instructions:
1. Replace video_instance_name below with the instance name of the FLVPlayback component that you want to rewind.
*/

instance_name_here.addEventListener(MouseEvent.CLICK, fl_ClickToPauseVideo);

function fl_ClickToPauseVideo(event:MouseEvent):void
{
	// Replace video_instance_name with the instance name of the video component
	video_instance_name.seek(0);
}
]]></code>
	</snippet>

	<snippet isBranch="false">
	  <title>Click to Set Video Source</title>
	  <description>Clicking the object replaces the video in an FLVPlayback component.</description>
	  <requiresSymbol>true</requiresSymbol>
	  <minASVersion>3</minASVersion>
	  <ADOBE_PIP_ID>Click_to_Set_Video_Source</ADOBE_PIP_ID>
	  <code><![CDATA[
/* Click To Set Video Source (Requires FLVPlayback)
Clicking on the specified symbol instance plays a new video file in the specified FLVPlayback component instance. The specified FLVPlayback component instance will pause.

Instructions:
1. Replace video_instance_name below with the instance name of the FLVPlayback component that you want to play the new video file.
2. Replace "http://www.helpexamples.com/flash/video/water.flv" below with the URL of the new video file you want to play. Keep the quotation marks ("").
*/

instance_name_here.addEventListener(MouseEvent.CLICK, fl_ClickToSetSource);

function fl_ClickToSetSource(event:MouseEvent):void
{
	video_instance_name.source = "http://www.helpexamples.com/flash/video/water.flv";
}
]]></code>
	</snippet>

	<snippet isBranch="false">
	  <title>Click to Seek to Cue Point</title>
	  <description>Clicking the object seeks to a cue point of the video in an FLVPlayback component.</description>
	  <requiresSymbol>true</requiresSymbol>
	  <minASVersion>3</minASVersion>
	  <ADOBE_PIP_ID>Click_to_Seek_to_Cue_Point</ADOBE_PIP_ID>
	  <code><![CDATA[
/* Click to Seek to Cue Point (Requires FLVPlayback component)
Clicking on the specified symbol instance seeks to a cue point of the video in the specified FLVPlayback component instance.

Instructions:
1. Replace video_instance_name below with the instance name of the FLVPlayback component that you want to seek.
2. Replace "Cue Point 1" below with the name of the cue point to seek to. Keep the quotation marks ("").
*/

instance_name_here.addEventListener(MouseEvent.CLICK, fl_ClickToSeekToCuePoint);

function fl_ClickToSeekToCuePoint(event:MouseEvent):void
{
	// Replace video_instance_name with the instance name of the video component.
	// Replace "Cue Point 1" with the name of the cue point to seek to.
	var cuePointInstance:Object = video_instance_name.findCuePoint("Cue Point 1");
	video_instance_name.seek(cuePointInstance.time);
}
]]></code>
	</snippet>

	<snippet isBranch="false">
	  <title>Create a NetStream Video</title>
	  <description>Begins playing a video file without using the FLVPlayback component.</description>
	  <requiresSymbol>false</requiresSymbol>
	  <minASVersion>3</minASVersion>
	  <ADOBE_PIP_ID>Create_a_NetStream_Video</ADOBE_PIP_ID>
	  <code><![CDATA[
/* Create a NetStream Video
Displays a video on stage without using the FLVPlayback video component.

Instructions:

1. If you are connecting to a video file that is on a streaming server such as Adobe Flash Media Server 2, replace 'null' below with the URL address of the video file. Place quotation marks ("") around the URL address.
2. If you are connecting to a local video file or one that is not using a streaming server, leave 'null' in place below.
3. Replace "http://www.helpexamples.com/flash/video/water.flv" with the URL of the video you want to play. Keep the quotation marks ("").
*/

var fl_NC:NetConnection = new NetConnection();
fl_NC.connect(null);    // starts a connection; null is used unless using Flash Media Server

var fl_NS:NetStream = new NetStream(fl_NC);
fl_NS.client = {};

var fl_Vid:Video = new Video();
fl_Vid.attachNetStream(fl_NS);
addChild(fl_Vid);

fl_NS.play("http://www.helpexamples.com/flash/video/water.flv");
]]></code>
	</snippet>
	</category>

	<category title="Event Handlers"
	    isBranch="true"
	    description="Code to handle basic user input">
	<snippet isBranch="false">
	  <title>Mouse Click Event</title>
	  <description>Clicking the object executes a function containing your custom code.</description>
	  <requiresSymbol>true</requiresSymbol>
	  <minASVersion>3</minASVersion>
	  <ADOBE_PIP_ID>Mouse_Click_Event</ADOBE_PIP_ID>
	  <code><![CDATA[
/* Mouse Click Event
Clicking on the specified symbol instance executes a function in which you can add your own custom code.

Instructions:
1. Add your custom code on a new line after the line that says "// Start your custom code" below.
The code will execute when the symbol instance is clicked.
*/

instance_name_here.addEventListener(MouseEvent.CLICK, fl_MouseClickHandler);

function fl_MouseClickHandler(event:MouseEvent):void
{
	// Start your custom code
	// This example code displays the words "Mouse clicked" in the Output panel.
	trace("Mouse clicked");
	// End your custom code
}
]]></code>
	</snippet>

 	<snippet isBranch="false">
	  <title>Mouse Over Event</title>
	  <description>Mousing over the object executes a function containing your custom code.</description>
	  <requiresSymbol>true</requiresSymbol>
	  <minASVersion>3</minASVersion>
	  <ADOBE_PIP_ID>Mouse_Over_Event</ADOBE_PIP_ID>
	  <code><![CDATA[
/* Mouse Over Event
Mousing over the symbol instance executes a function in which you can add your own custom code.

Instructions:
1. Add your custom code on a new line after the line that says "// Start your custom code" below.
   The code will execute when the symbol instance is moused over.
*/

instance_name_here.addEventListener(MouseEvent.MOUSE_OVER, fl_MouseOverHandler);

function fl_MouseOverHandler(event:MouseEvent):void
{
	// Start your custom code
	// This example code displays the words "Moused over" in the Output panel.
	trace("Moused over");
	// End your custom code
}
]]></code>
	</snippet>

	<snippet isBranch="false">
	  <title>Mouse Out Event</title>
	  <description>Mousing out of the object executes a function containing your custom code.</description>
	  <requiresSymbol>true</requiresSymbol>
	  <minASVersion>3</minASVersion>
	  <ADOBE_PIP_ID>Mouse_Out_Event</ADOBE_PIP_ID>
	  <code><![CDATA[
/* Mouse Out Event
Mousing out of the symbol instance executes a function in which you can add your own custom code.

Instructions:
1. Add your custom code on a new line after the line that says "// Start your custom code" below.
   The code will execute when the symbol instance is moused out of.
*/

instance_name_here.addEventListener(MouseEvent.MOUSE_OUT, fl_MouseOutHandler);

function fl_MouseOutHandler(event:MouseEvent):void
{
	// Start your custom code
	// This example code displays the words "Moused out" in the Output panel.
	trace("Moused out");
	// End your custom code
}
]]></code>
	</snippet>

	<snippet isBranch="false">
	  <title>Key Pressed Event</title>
	  <description>Assigns a function to be executed each time a key is pressed.</description>
	  <minASVersion>3</minASVersion>
	  <ADOBE_PIP_ID>Key_Pressed_Event</ADOBE_PIP_ID>
	  <code><![CDATA[
/* Key Pressed Event
Executes the function fl_KeyboardDownHandler defined below when any keyboard key is pressed.

Instructions:
1. Add your custom code on a new line after the line that says "// Start your custom code" below.
   The code will execute when any key is pressed.
*/

stage.addEventListener(KeyboardEvent.KEY_DOWN, fl_KeyboardDownHandler);

function fl_KeyboardDownHandler(event:KeyboardEvent):void
{
	// Start your custom code
	// This example code displays the words "Key Code Pressed:" and the keycode of the pressed key in the Output panel.
	trace("Key Code Pressed: " + event.keyCode);
	// End your custom code
}
]]></code>
	</snippet>

	<snippet isBranch="false">
	  <title>Enter Frame Event</title>
	  <description>Assigns a function to be executed each time the playhead moves into a new frame.</description>
	  <minASVersion>3</minASVersion>
	  <ADOBE_PIP_ID>Enter_Frame_Event</ADOBE_PIP_ID>
	  <code><![CDATA[
/* Enter Frame Event
Executes the function fl_EnterFrameHandler defined below each time the playhead moves into a new frame of the timeline.

Instructions:
1. Add your custom code on a new line after the line that says "// Start your custom code" below.
   The code will execute when the playhead moves into a new timeline frame.
*/

addEventListener(Event.ENTER_FRAME, fl_EnterFrameHandler);

function fl_EnterFrameHandler(event:Event):void
{
	//Start your custom code
	// This example code displays the words "Entered frame" in the Output panel.
	trace("Entered frame");
	// End your custom code
}
]]></code>
	</snippet>
	</category>
</snippets>
</CodeSnippets>
