How to include external actionscript library into flash

actionscript-3flash

Sorry for the dumb question, but I've spent already hours trying to figure this out (I am not a flash developer).

I have downloaded some external actionscript library in a form of a bunch of folders with .as files that have the following folder structure:

  • com/helper_lib1/*.as
  • com/helper_lib2/*.as
  • com/primary_lib/LibClass.as <- primary lib I want to use

lib.as has the following code:

package com.primary_lib{
    import com.helper_lib1.*;
    import com.helper_lib2.*;
    public class LibClass extends MovieClip{
        .....

Now I have some fla project where I want to use this com/primary_lib/lib.as, something like:

import com.primary_lib.LibClass;
var test:LibClass = new LibClass();
...

How to include this library into my project and where should I put all those files? I already tried putting them into every possible folder but I always get definition com.primary_lib:LibClass could not be found error. Can someone please walk me through this process on a basic level as I don't know much about flash (I'm using CS4).

Thanks.

Best Answer

It looks like the problem is the filename. Actionscript classes must have their filename and location match the class name and package so your com.primary_lib:LibClass should be at com/primary_lib/LibClass.as Hope that does the trick.

Related Topic