开发者

How to include external actionscript library into flash?

开发者 https://www.devze.com 2023-01-12 12:28 出处:网络
Sorry for the dumb question, but I\'ve spent already hours trying to fi开发者_运维知识库gure this out (I am not a flash developer).

Sorry for the dumb question, but I've spent already hours trying to fi开发者_运维知识库gure 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.


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.


Your Flash project should be able find the external libraries. Flash usually starts searching for them in the same folder that the FLA is saved in, then it looks in the common classes folders in your user settings folder...

Sometimes external code might be located in a folder that's not part of the package, e.g: src or classes in this case you have to manually add a path pointing to that location. For more info on this please check this acticle.

I hope this helps!

0

精彩评论

暂无评论...
验证码 换一张
取 消