tags:

views:

16

answers:

1

Hi, I have implemented some utility classes in Flex that I want to use in multiple AIR projects. I have created a swc which contain these classes. I am working on a Linux machine and do not have FlashBuilder. So I am using the compc and mxmlc command line SDK tools. My problem is that I have not been able to find a way to specify the swc when building the standalone project. A tutorial suggested the following command: mxmlc -load-config /opt/flex/4.1.0/frameworks/air-config.xml -library-path=/path/to/utility.swc hello.mxml. However, using that gives me the error hello.mxml: Error: Unable to locate specified base class 'mx.core.WindowedApplication' for component class 'hello'. Everything works fine if I move all code from the swc to a single monolithic pro ject. Can anyone help me out here? The code for the standalone project is:

<?xml version="1.0" encoding="utf-8"?>
<mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" windowComplete="completeHandler();">
<mx:Script>
<![CDATA[
import com.example.Ext;
private function completeHandler():void
{
    var e: Ext = new Ext();
    e.hi();
}
]]>
</mx:Script>
<mx:Label text="Hello World" />
</mx:WindowedApplication>

The type Ext is contained in utility.swc.

UPDATE: I fixed the previous error. The commandline should have been mxmlc -load-config /opt/flex/4.1.0/frameworks/air-config.xml -library-path+=/path/to/utility.swc hello.mxml. This appends my swc to the existing library path instead of replacing it. However, I have a new problem. Now the error is hello.mxml(10): Error: Type was not found or was not a compile-time constant: Ext. I am pasting the code for utility.swc as well:

package com.example {
    public class Ext {
        public function Ext {
            // do something
        }   
        public function foo( ): void {
            return;
        }   
    }   
}
+1  A: 

Use -library-path+=/path/to/my.swc. If you use = instead of +=, the compiler will discard all the platform libraries already in the path.

Andrew Aylett