I have a button that works in the simulator. But when I put it into the device it does not work. I am using xcode 4.5 and build 925. When I check out console log it shows the transaction working with all my print statements. Then I check the sandbox and there is a 1 in my file that should change the button to scene 2. But it seems like its always on scene 1. Can someone just glance at my button code real quick to see if I am missing something. Thank you.
local footballBtn = movieclip.newAnim({"buy.png","gobtn.png"}, 80, 36)
footballBtn.x = 265; footballBtn.y = 121
screenGroup:insert( footballBtn )
local onBuyfootballTouch = function( event )
if event.phase == "ended" and footballUnlocked ~= tonumber(loadedfootballUnlocked) then
audio.play( tapSound )
storyboard.gotoScene( "loader", "fade", 300 )
local buyfootball = function ( product )
print ("Congrats! Purchasing " ..product)
-- Purchase the item
if store.canMakePurchases then
print("at store.can make purchases")
store.purchase( {validProducts[1]} )
else
native.showAlert("Store purchases are not available, please try again later", { "OK" } )
end
end
-- Enter your product ID here
buyfootball("com.domain.app.football")
elseif event.phase == "ended" and footballUnlocked == tonumber(loadedfootballUnlocked) then
audio.play( tapSound )
print("Go Button")
storyboard.gotoScene( "football", "fade", 300 )
end
end
footballBtn:addEventListener( "touch", onBuyfootballTouch )
if footballUnlocked == tonumber(loadedfootballUnlocked) then
footballBtn:stopAtFrame(2)
print("Go Button")
end
I have been trying to figure this out for 2 days. Very frustrating but I think a extra set of eyes may help. Thanks again [import]uid: 34105 topic_id: 31567 reply_id: 331567[/import]