This post is helpful to generate action script to call adobe native extension files. Here we are using FDT IDE used to create Action script for ANE.
1. Download FDT from http://fdt.powerflasher.com/docs/Installing_and_Running_FDT#Standalone_Installation here.
2. Download Flex sdk from here http://www.adobe.com/devnet/flex/flex-sdk-download.html and set sdk path in FDT ide during installation.
3. Create Flex project now : File - New - New FDT project.
4. Create Action Script .as file in package named DemoExtensoinFdt.as
5. Use following codes to call native method that we created in this tutorial here http://findnerd.com/account/#url=/list/view/How-to-generate-native-jar-to-build-ANE-/19291/.
6.
public class DemoExtensoinFdt extends EventDispatcher {
public function DemoExtensoinFdt() {
}
//
// Static Variables
//
/** Extension Context */
// An ExtensionContextobject serves as the bridge between Actionscript and native code.
private static var extContext:ExtensionContext=null;
//
// Public Methods
//
/**
* Display a simple Android Dialog box.
* @param msg the message you wish to display.
*/
// The next line of showDialogMessage(msg:String) method is more of the same:
// it invokes the ffiShowDialogMessage method,
// which we'll be implementing on the Java side to actually display the message.
public static function showDialogMessage(msg:String):void
{
initContext();
extContext.call("demo",msg);
}
//
// Implementation
//
/** Init Context */
private static function initContext():void
{
if(!extContext)
{
// The "com.aneexample.AndroidDialog"
// here is the unique ID of the extension itself;
// although it happens to be similar to the class name of our Actionscript interface.
// The second parameter is the contextType.For this simple application,
// there's a single context type needed, so it's fine to pass an empty string.;
extContext=ExtensionContext.createExtensionContext("com.demo.extension.DemoExtensoinFdt","");
}
}
}
0 Comment(s)