AS3 Library External Resource

How To: Implement an AS3 Library into Your Flash Environment

You’ve got the AS3 library of your interest downloaded, in this case, it will be CASA Lib. Now it is time to set up your Flash environment. What to do next? This tutorial is meant to walk you through on how to hook your Flash environment to a specific AS3 library.

Type of AS3 Libraries

AS3 libraries can be found in two forms: ActionScript files(.as) or compiled clips(.swc). In most cases, AS3 libraries you come across will be in a form of ActionScript class(s), but it is nice to know how to handle both types.

Tip: As a good practice, it is helpful to have a consistent location where you can place third party and/or personal AS3 libraries. This way there is no guessing as to where they go.

Let’s go off the assumption that you have download the CASA Lib library and you have created a folder within your Documents directory called AS3Library. The rest of this tutorial will go off this assumption.

Using a Flash Environment

Step 1: Create a new Flash document(.fla)

Start off by creating a new Flash document file.

Step 2: Access the ActionScript properties

Access the ActionScript properties by selecting File -> Publish Settings -> Flash -> Settings.

ActionScript Settings

Step 3: Determining the Type of the AS3 Library

Once within the ActionScript Settings, you will notice you can define the your Document Class along with your pathing to the external AS3 source and/or libraries. Depending on whether your AS3 LIbrary is of source(.as) or library(.swc) form, the next tab you select will be different.

AS3 Library Source(.as)

Add AS3 Library Source

AS3 Library(.swc)

Add AS3 Library .swc

Tip: As a good practice, if almost always best if you use relative positioning (versus absolute) when defining the path from the Flash document to the AS3 Library. This helps for portability of the project and when working in multiple platforms/environments.

Step 4: Define the Path to AS3 LIbrary

Since you know where your Flash document and AS3 Library is stored within your workspace, you can define where the AS3 Library is in relation to the Flash document. For example, I have added the working Flash document within the root level of a folder named AS3Sandbox within my Documents. In that case, my path to the library source will be “../AS3Library/”. If I where to point to the complied library instead it would have been “../AS3Library/libs/”. See below.

Defining AS3 LIbrary Source Path

Select AS3 Library Source

Defining AS3 Library Path

Select AS3 Library

Summary

Upon your selection, the Flash document is now able to access any and all of the AS3 libraries within the selected folder. As you download more AS3 libraries you can simply place them in this folder and you can instantly start to reference them within you Flash document. Now it’s time to get to the fun stuff like experimenting with your new toys.

If you have any questions, feel free to leave them within the comments.

One thought on “How To: Implement an AS3 Library into Your Flash Environment

Comments are closed.