2
votes

I'm seeing an issue a few times now using FlashBuilder 4.5. First I create a new ActionScript Project, then add a Library Project's bin folder to the build path, and reference the Library Project. I code the new project, and everything works fine. But later, when I'm optimizing the code, I'll create a new ActionScript class file in the Library Project, save it, and then change an already defined function within the ActionScript Project to use this new ActionScript class in the Library Project instead of some other class in the Library Project. The class file is in the Library Project's src folder, under (default package), same as all the other files the ActionScript Project is using successfully.

At this point, FlashBuilder shows an error "Type was not found or was not a compile-time constant: PEArrays."

Here is the Library Project file:

package 
{
    public class PEArrays
    {
        public var x:Array;  
        public var y:Array;
        public var o:Array;
    }
}

I have included import PEArrays; or, import PEArrays.*; and both result in the same error.

Also, I tried exiting and re-entering FlashBuilder, didn't help.

Cleaning the ActionScript Project had no effect on this error. I also right-clicked on the project folder and selected Refresh, but it didn't help.

I verified that the needed classes are correctly selected by going to Project>Properties>Flex Library Build Path and reviewing the Classes tab. I'm just a single developer so there's no version control system in place.

After troubleshooting a bit, I now find that the ActionScript Project folder's bin directory is empty. When I run the .as file in the ActionScript Project's src folder, I get an error that the ASname.html file cannot be found (where ASname is the ActionScript Project name and also the .as file name, e.g. ASname.as, in the src folder, which is run). This ASname.html file is not found in the html-template folder. What process generates this needed .html file? Can I manually trigger it somehow?

[other ActionScript Projects I have that depend on this Library Project run fine, although the PEArrays class in question is not used]

Here are some similar postings.

FlashBuilder workspace update issues Flash Builder keeps losing my imported classes...arghh

3
The class file is in the Library Project's src folder, under (default package), same as all the other files the ActionScript Project is using successfully.ggkmath
From what I can tell from Google, that checkbox is for Mobile applications. When running as "Web Application", which I'm doing, there doesn't appear to be launch settings for one to select this checkbox.ggkmath

3 Answers

3
votes

The problem is that your new Class didn't get compiled in. One of two things has happened.

  1. Your Class isn't checked in Project>Properties>Flex Library Build Path
  2. .flexLibProperties isn't writable (this can happen under some version control systems)

Check out http://www.developria.com/2010/12/tips-for-working-with-library.html for more information.

2
votes

Frankly, I never trust FlashBuilder "Build Automatically": it slows down performance of the application (because nearly every change causes a re-build.) Disable "Build Automatically", and memorize the keyboard command to Build.

When you use "Clean..", use "Clean Projects Selected Below" and highlight the specific projects. There've been buggy issues with "Clean all projects".

Last, if you have to, manually clean out your bin folder, and re-build your project.

2
votes

OK, I don't know what caused the problem, but I found one solution:

  1. export all the projects (each to a separate file)
  2. create a new directory structure on the hard drive
  3. use Flash Builder 4.5 to import these files into the new directory structure.

When I first tried this things failed the same way. Then I realized that I needed to update the Library Project's path to the new hard drive directories. After doing that, the errors went away. Thus,

4. in each ActionScript (or Flex) Project, open the Properties tab, click on ActionScript Build Path, remove the old Build path for the Library Project, and add SWC folder for the new path.

Seems like Flash Builder gets stuck in a bad state every now and again.