Question

I have a pure Action Script 3 project which I am compiling with the Flex 4 SDK. I have a standard Makefile which automatically invokes compc, mxmlc, and asdoc as appropriate. The project is compiling cleanly with no errors or warnings on my Mac OS X 10.4+ computer; however, when sharing it with a coworker developing on Windows XP (with Cygwin installed), he gets a very large list of "incompatible signature" errors. Why is he getting those errors? The signatures don't appear to be incompatible.

NOTE: The signatures in question are "original" and "export", used like this:

public interface AbstractX
{
    function original() : Object;
    function export() : Object
}
public class ImportX implements AbstractX
{
    public ImportX(obj : Object) {
        _loadedobj = obj;
        _exportobj = obj.export();
    }

    public static function wrap(obj : Object) : AbstractX {
        var result : AbstractX = null;
        if ( obj != null ){
            if ( obj is AbstractX ){
                result = obj as AbstractX;
            }else if ( obj.original() is AbstractX ){
                result = obj.original() as AbstractX;
            }else{
                result = new ImportX(obj);
            }
        }
        return result;
    }

    public function original() : Object {
        return _loadedobj;
    }

    public function export() : Object {
        return _exportobj;
    }

    private var _loadedobj : Object = null;
    private var _exportobj : Object = null;
}
public class X implements AbstractX
{
   public function X() : void {
      //...
   }

   public function original() : Object {
       return this;
   }

   public function export() : Object {
       if ( ! _export ){
           _export = new ExportX(this);
       }
       return _export;
   }

   private var _export : Object = null;
}

NOTE: The code above is part of my solution to How do I make an Action Script 3 class, used in two SWF files, resolve to the same class when one SWF dynamically loads the other?

Was it helpful?

Solution

Are you sure it also compiles on Mac OS X? If you recently changed your build scripts but you are using the "incremental" compiler option, it might be building successfully on your Mac simply because of the cached build. Try removing any *.cache files and rebuild on your Mac to see if you get the same errors.

One way that you can get strange "incompatible signature" errors is if you place your output directory in the library path; for example, if you are outputting a *.swc file into $(MAINFOLDER)/lib and you also have $(MAINFOLDER)/lib listed in your library path. I suspect the reason for this is that, initially, the interfaces in your code will be used, but halfway through the build, the (incompatible) compiled interfaces will be used.

OTHER TIPS

i don't see any problem ... sigs are completely compatible ... compiles fine on my machine, with gumbo for WinXP ... except it should be public function ImportX ... and ExportX is unknown ... what happens, if he tries to compile that manually? not that i would think that errors come from cygwin or the makefile, but who nows ... you might wanna use ANT though, since this is cross platform ... read more here (page 4 is where it get's interesting in fact) ...

i think the problem is elsewhere ... or maybe post his compile output here ...

edit: ok, then you should most definitely post his compiler output, because i don't understand how that can't compile ...

one note though: i read your note now, on what you are intending to do ... i think it won't work, in fact ... you will get the same problem, because you want to share an interface across 2 swfs ... implementing an interface actually does not simply mean you implement the methods, but it means, that the traits object knows it implements its interface ... so you will get the same errors ...

greetz

back2dos

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top