How do I implement multiple mobile store APIs in the same Flex codebase?
===

Q/A style since I already know an answer, but I figured other people might be interested as well. Cleaner implementations and suggestions are more than welcome as well, obviously.

Adobe Flex allows easy cross-platform development for mobile applications, but there is always some functionality that differs between platforms that must be accounted for.

Flex manages this via native extensions, but a native extension for, say, iOS will break your program if loaded into an Android application. 

In particular, each platform has its own in-app purchase API. How can one cleanly implement multiple store APIs, since this code inclusion decision needs to be made at compile time and not runtime (where something like Parsley or Swiz would be useful)?