In Flash Builder 4, when a project uses RSLs as external resources, there could be a chance that you get a runtime error “Could not find compiled resource bundle …” error.  I have not nailed down the exact cause except found a workaround by randomly stumbling upon this Adobe Forum post.  To sum up the solution to this problem, here are the steps to cure those poor errors:

  1. When you see the error message, note down the name of the resource bundle.  For example, ‘SharedResources’
  2. Go to your Flex SDK directory, and look for a file that is the same name as the resource bundle, the file should carry an extension “.properties”, you should see a lot of them as each language Flex SDK supports should have one.  In this example, I would be looking for SharedResources.properties
  3. Locate one of file in the language you are familiar with, and open it in a text editor
  4. The comment lines in the file should start with #, read through the comments, and you should be able to locate some class names (they are usually in Pascal casing).  In this example, I notice NumberFormatter.
  5. In your main application code, declare a variable that is with the type you found in Step 4, for example: var nf:NumberFormatter

By doing the above, the main application would pick up the resource bundle associated with the classes utilized in the RSLs.

Hopefully you will find this post before you start tearing up your hair like I just did the past couple hours.  Cheers.

Advertisements