Error message

Error: Type was not found or was not a compile-time constant: YourNativeExtension

Cause

You would usually get this error message at compile-time, when your code references something in a library that the compiler doesn’t know where to find. In the case of using a native extension, this means that your project’s SWF file was built without the native extension (ANE).

Fix

Make sure the .ane file of the native extension is included in your project – see the examples below for ways to do it.

Examples

1. On the command line

Add the path to your native extension with the -external-library-path option when you run MXMLC to compile your project:

mxmlc +configname=YourProjectName 
      -output path/to/YourAppName.swf ProjectMainFile.mxml 
      -source-path+=path/to/src 
      -external-library-path+=path/to/your/native/extension

2. In Flash Builder

Select Project > Properties > Flex Build Path > Native Extensions > Add ANE… and add the native extension’s .ane file to your project:

Select Project > Properties > Flex Build Packaging to add an ANE to your project

Opt In Image
Making your own extension?

Fill in your details below and get a free sample of the Easy Native Extensions eBook.

  • step-by-step guide to making your iOS extension in under an hour
  • tutorials
  • infographics
  • example code

About the Author

Radoslava is co-founder of DiaDraw. Prefers to communicate with images. Verbal communication always caused trouble with her parents. Started speaking Basic early on, followed by four years of Delphi, six years of C++, four years of ActionScript, lately converses in Objective-C. Her mum and dad hope she'll start speaking human at some point.