Hi
I have the following function in my flashcard app. Each time the user presses “next” to go to the next question, this is called. It checks to see if there are still cards to display or if we’re done. If we’re done, it calls the final display screen that shows the results. The weird thing is that the call to the function that updates the json file that records the score usually gets ignored and is almost always not called. Also I threw in a print statement and that generally never gets called either. Not sure what’s going on …
continueToNextCardOrQuit = function(event) if ( event.phase == "began" ) then display.getCurrentStage():setFocus(event.target) event.target:setFillColor(.87,0, 0,.3) elseif ( event.phase == "ended" ) then display.getCurrentStage():setFocus(nil) myData.displayAnswerCardGroup:removeSelf() myData.displayAnswerCardGroup = nil if ((myData.questionsAnswered + myData.questionsIgnored) \< #myData.questions) then -- there are still cards to display displayCard() else -- game is over updateScoreFile() -- this function isn't called here so I have to call it -- from a different function (where it works fine) print("this doesn't print") -- and this doesn't print either displayFinalScreen() -- but this function DOES get called. end end return true end -- end of continueToNextCardOrQuit()
thanks,
David