开发者

Flex - error 1046 - some .as files don't get importet

I received a Flex project and when trying to compile it i get a few 1046 errors that say the Type was not found or was not a compile-time constant MyClass

however - the respective files are listed on the top of the file in an import clause like this:

import com.folder1.folder2.folder3.MyClass;

and if i check the folder structure, MyClass.as is there.

however, if i type this same line (import com.folder1.folder2.folder3.MyClass;) and check at each . what the autocompletion suggests, I see only a subset of the as classes that are actually there on the harddisk.

What determines which classes and folders are suggested by the autocompletion function? I don't get any compile error on the corresponding import statements that import MyClass

//edit:

screenshot 1 shows the file in which the error occurs that tries to import the class in question (Updater)

http://neo.cycovery.com/flex_problem.gif

screenshot 2 shows the file Updater.as

http://neo.cycovery.com/flex_problem2.gif

the censored part of the path matches in both cases (folder structure and package statement in Updater.as)

screenshot 3 shows where the error actually happens:

http://neo.cycovery.com/flex_problem3.gif

inte开发者_JAVA技巧restingly, the variable declaration

private var _updater:Updater = new Updater();

further up in the file does not give an error


This project is set up wrong. Its obvious your application can not find the classes.
Move your "com" folder and all of the contents into your "src" folder.
Or perhaps include the files in your source path?
right click on the project name->properties->flex Build Path->add folder


the import is based on the 'package' declaration within the file itself (at the top of the file). If the file's package declaration does not match the actual folder structure, you will get problems.


Check the classes you can't see in the autocompletion list. Maybe those classes' package name doesn't match the actual structure.

Rob


Check your actionscript source paths. Any chance that the folders you are seeing (events and objects) are in there explicitly, and the others are not? Normally, you have all your source inside a folder like src that is in the source path, so that the compiler can find anything anywhere inside it. But you can just as easily make your source paths too specific and just see a few things...

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜