Skip to content

Using Native Extensions

Mark Knol edited this page Jan 17, 2018 · 6 revisions

1. Place the .ane and the .swc in the libs/ folder.
2. You have to explicitly add the SWC to your IDE project for code-completion. FlashDevelop users; right-click on SWC > Add to Library.
3. If you need to add extra data in the manifest xml, you can put that in the flambe.yaml file.

# Android-specific configuration

android:
  # https://developer.android.com/guide/topics/manifest/manifest-intro.html
  AndroidManifest.xml: |
    <manifest android:installLocation="auto">
      <uses-permission android:name="android.permission.INTERNET"/>
      <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    </manifest>

4. Write the code, and use conditional compilation tags (air,android,ios) to prevent conflicts on the HTML/Flash version.

This example demonstrates how to use adds from RevMob. You can download the RevMob Native Extension here.

#if air
 import com.revmob.airextension.RevMob;
#end

public function addAds()
{
 #if air
   var revmob:RevMob = new RevMob("XXXXXX");
   revmob.showBanner(0, (System.stage.height - 60), System.stage.width, 60);
 #end
}

Check out the extensions demo https://github.com/aduros/flambe-demos/tree/master/extensions

Tip: Find great native extensions over here: http://www.as3gamegears.com/category/air-native-extension/

Clone this wiki locally