0

I'm creating an ANE that passes values to an existing application. I've written and tested the Android/Java and it works as expected.

I've coded the AS3 and I when I'm debugging I'm getting the situation where my ExtensionContext = null. I'm using Fb 4.7 Pro, Air 3.8, and the Google ADT build of Eclipse.

I'll share my code below:

ActionScript Library Project

extension.xml

<extension xmlns="http://ns.adobe.com/air/extension/3.8">
<id>com.applications.ps</id>
<versionNumber>1</versionNumber>
<platforms>
    <platform name="Android-ARM">
        <applicationDeployment>
            <nativeLibrary>ps.jar</nativeLibrary>
            <initializer>com.applications.ps.PExtension</initializer>
            <finalizer>com.applications.ps.PExtension</finalizer>
        </applicationDeployment>
    </platform>
</platforms>

PInterface.as

package
{
    import flash.events.EventDispatcher;
    import flash.external.ExtensionContext;

public class PInterface
{
    private var extContext:ExtensionContext;

    public function PInterface()
    {
        trace("in PExtension Constructor");
        if (!extContext) {
            trace("Creating extension context.");

                extContext = ExtensionContext.createExtensionContext("com.applications.ps",null);



            trace(" extContext: "+extContext);

            if (extContext){
                //extContext.call("initPrint");
                trace("created extension context.");}
            else{
                trace("Failed to create extension context.");
            }
        }
    }

    public function aneFunction(name:String):void {
            extContext.call("functionA",name);
    }

}
}

My result is continually extContext = null.

That only occurrs when the extensionID does not match or the Initializer doesnt work.

It all looks right to me...

My Android Application in Eclipse/ADT has a package name of com.applications.ps.

4

1 回答 1

0

确保您将 AS 库创建为Mobile Library.

于 2013-11-28T01:06:24.713 回答