0
votes

I have an issue using external as files. I'm working with a Flash Professional project in Flash Builder

Here is some code on the timeline (I got the code like this, don't have the time to abandon this practice because of deadlines):

import com.companyname.AwesomeClass;
include "external.as";

And here's external.as

function doSomething(value:AwesomeClass) {
    trace("value="+value.toString());
}

I'm getting an error on line 1 (function signature) in external.as: "1046: Type was not found or was not a compile time constant: AwesomeClass"

There's no error on the import statement, and if I put that import statement in external.as, I still get the error on the function signature line (but not on the import line, it has no problem with that)

Any reason some of these linkages are getting screwed up?

2
Not sure if it's relevant (this was from FlexBuilder), but I've seen it have issues like this where it cached an error and wouldn't recompile. See here for the fix I found: blog.aherrman.com/2010/05/… - Herms
I'll take a look, but that doesn't seem likely. I'm started and restarted both programs, and added and readded the project. I also get the error when I open the .fla in Flash Pro and hit test movie from there (no interaction with Flash Builder) - Esaevian
The restarting and rebuilding the project are things that didn't help me when I ran into my issue. Though if you're dealing with an FLA then I'm guessing you're hitting something different than I did. - Herms
What happens if you copy-paste the contents of external.as into the location of the include? This should essentially be what the include does, but it seems something goes wrong somewhere. - grapefrukt

2 Answers

0
votes

Include can fail for a couple different issues. If the include file has bad file permissions (read access restricted), the compile will just flat out ignore the import. In general, it's bad practice to use include statements from within Flash as ActionScript already has great support for packages to organize class structures.

Check out this article for more information on include: http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/statements.html#include

0
votes

Just add the include in both files if necessary. Sounds silly, but AS3 shouldn't include it twice. Your problem is likely due to where the included text is being inserted in the file during compilation.