IAP Demo & Multi Tabs

Please forgive me as I'm fairly new to Corona & Lua.

I have downloaded the InAppPurchaseDemo app and also have the Tab menu demo. In my app I would like to display the purchase buttons on the second tab. I have encountered two problems that I'm unsure of the best solution.

What I have found is the ui.lua in the IAP demo app doesn't use display groups so the iap buttons appear on all tabs. I haven't tried it yet but I believe that I will be able to modify the ui.lua code to either pass in or return a displayGroup and add the buttons/text to that. It does seem a bit strange to me that the ui.lua code doesn't use display groups by default or option.

The other issue I'm unsure of how to resolve is that the store.init needs to be run immediately, but the tab code only sets the screen up when the button is clicked.

I'm thinking out loud here but if you have a better solution please let me know.

1. Make the change to the ui.lua code to use display groups
2. Do the store.init and call back in the main.lua
3. Take the display group and set it on a public variable on screen2
4. Change screen2 to use that display group and not destroy it when it exits

Any advice or assistance is greatly appreciated.

Scott.

Ok I've made some progress so I will share here.

I made the two variables global
_G.validProducts, _G.invalidProducts = {}, {}

The functions I left in main.lua
o) loadProductsCallback
o) tranactionCallback
o) setupMyStore
o) all the store.init & timer.performWithDelay

In screen2
o) I have listOfProducts & unpackValidProducts
o) changed the references to the global variables
o) made the new() display group accessible from the unpack function

Hope this helps someone.

s.

views:1430 update:2011/10/10 21:27:38
corona forums © 2003-2011