0
votes

I have an Adobe AIR ANE that builds and runs fine on iOS. I want to run this app in the AIR simulator, but with an actionscript version of the native ANE.

Reading the docs, it seems like a default profile would be perfect for this.

I added the default profile to the extension.xml file. I added a AS implementation of the native interface to every project in my workspace. I have made methods static/not static, etc. I have tried everything but I keep getting this error:

ArgumentError: Error #3500: The extension context does not have a method with the name

I am at a complete loss. Here are the relevant files:

extension.xml

<extension xmlns="http://ns.adobe.com/air/extension/3.1">
    <id>com.novel.analytics.ext.ApsalarNativeInterface</id>
    <versionNumber>0.0.0</versionNumber>
    <platforms>
        <platform name="iPhone-ARM">
            <applicationDeployment>
                <nativeLibrary>libApsalarNativeInterface.a</nativeLibrary>
                <initializer>ExtInitializer</initializer>
                <finalizer>ExtFinalizer</finalizer>
            </applicationDeployment>
        </platform>
        <platform name="default"> 
            <applicationDeployment/> 
        </platform>              
    </platforms>
</extension>

My AS implementation:

package com.novel.analytics.ext
{
    public class ApsalarNativeInterface
    {
        public function ApsalarNativeInterface()
        {
        }

        private static function initExtension():void    
        {
        }       

        public function initApsalar(apiKey:String, secret:String):void
        {
        }       
    }
}

my native interface:

package com.novel.analytics
{
    import flash.external.ExtensionContext;

    public class ApsalarInterface
    {
        private static const EXTENSION_ID : String = "com.novel.analytics.ext.ApsalarNativeInterface";
        private var context : ExtensionContext;

        public function ApsalarInterface()
        {
            this.context = ExtensionContext.createExtensionContext(EXTENSION_ID, null);
        }       

        public function initApsalar(apiKey:String, secret:String):void
        {
            context.call("initApsalar", apiKey, secret);
        }
    }
}

Here is my adt command line (library.swf is the lib that contains the two above files:

/Applications/Adobe\ Flash\ Builder\ 4.6/sdks/4.6.0/bin/adt -package -target ane ../../$PRODUCT_NAME.ane extension.xml -swc NativeInterface.swc -platform iPhone-ARM -C . library.swf -platform default -C . library.swf

Like I said, I am at a complete loss on this one.

1
The adobe docs are extremely vague on how this part works. At first I thought it worked this way also! - paleozogt

1 Answers

2
votes

Sorry for the much delayed response, but I think you'd benefit from checking out this wonderful tutorial: http://www.digitalprimates.net/author/nweber/2012/04/10/building-a-native-extension-part-3/

Based on your code snippets above, it looks like you're trying to define your pure-ActionScript implementation in a different package, with a different classname. Seems you actually want to use the same package+class+method names and just store it in a different library (so it's bundled as its own SWF). Then you tell ADT how to bundle things.