Created
April 16, 2015 06:55
-
-
Save marchbold/520b8afb44cb01199341 to your computer and use it in GitHub Desktop.
Retrieving the product list
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private var _products : Array; | |
private var _productIds : Array = [ "com.distriqt.testProduct1", "com.distriqt.testProduct2" ]; | |
InAppBilling.init( APPLICATION_KEY ); | |
if (InAppBilling.isSupported) | |
{ | |
trace( "InAppBilling.service.version = " + InAppBilling.service.version ); | |
InAppBilling.service.addEventListener( InAppBillingEvent.SETUP_SUCCESS, setup_successHandler ); | |
InAppBilling.service.addEventListener( InAppBillingEvent.SETUP_FAILURE, setup_failureHandler ); | |
InAppBilling.service.addEventListener( InAppBillingEvent.PRODUCTS_LOADED, products_loadedHandler ); | |
InAppBilling.service.addEventListener( InAppBillingEvent.PRODUCTS_FAILED, products_failedHandler ); | |
InAppBilling.service.addEventListener( InAppBillingEvent.INVALID_PRODUCT, product_invalidHandler ); | |
InAppBilling.service.setup( GOOGLE_PLAY_INAPP_BILLING_KEY ); | |
} | |
... | |
private function setup_successHandler( event:InAppBillingEvent ):void | |
{ | |
InAppBilling.service.getProducts( _productIds ); | |
} | |
private function products_loadedHandler( event:InAppBillingEvent ):void | |
{ | |
// event.data will be an Array of Product instances for each product successfully loaded | |
for each (var product:Product in event.data) | |
{ | |
trace( product.toString() ); | |
} | |
_products = event.data; | |
} | |
// com.distriqt.InAppBilling |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment