Workaround When Using Degrafa Within a Flex Library Project

I needed to build my own version of the excellent Axiis Data Visualization Component Library. However, I ran into a little problem. It wouldn’t compile. Now, as I trusted its authors, and had actually been using a pre-compiled swc, I wouldn’t accept that the problem was in the code. I spent a long and frustrating time with Google before I uncovered the solution — which I’ll document for you here.

But first, the problem:

When using DegrafaLibrary.swc within a “Flex Library Project” rather than a regular “Flex Project,” as the Axiis components do,  the following code would not compile:

<degrafa:GeometryGroup
 xmlns:mx=”http://www.adobe.com/2006/mxml”
 xmlns:degrafa=”http://www.degrafa.com/2007″
 xmlns:geometry=”com.degrafa.geometry.*”>

.

I kept getting a “Could not resolve <degrafa:GeometryGroup> to a component implementation.” error.

Apparently a variant of this bug: https://bugs.adobe.com/jira/browse/SDK-21156 — “Library Project namespaces should be appended by default” exists in a 3.4.1 sdk and the Eclipse plugin of Flex Builder 3 (Mac OS X) environment.

Explicitly including the Degrafa library in a project specific flex-config.xml file fixed the problem. I followed the process outlined on this Flex Examples Post.

Here is the contents of the config.xml file, which I placed in the src folder of the project. (Note that I had to traverse up a level to reference the DegrafaLibrary.swc file. If I had placed the config.xml file in the project root, I wouldn’t have needed to. Next time.)

<?xml version="1.0"?>

<flex-config>
    <compiler>      
       <include-libraries>
          <library>../libs/DegrafaLibrary.swc</library>
       </include-libraries>        
    </compiler>         
</flex-config>

 

.

And here’s how to add it to the project build:

Add project specific flex-config.xml overrides to Library Project

Add project specific flex-config.xml overrides to Library Project

The compiler arguments line reads:

-load-config+=/Users/pauliprice/Documents/workspace/axiis_lib/src/config.xml

Leave a comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.