Hello,
Yet another question from me.
I’m trying to create a locking mechanism that keeps students from skipping ahead.
The idea is that the student enters a code, which is given by a teacher. After the code is entered, the student presses a button. Then a function compares the code to a value, say 1234. This what I have tried:
buttonHome = widget.newButton{ defaultFile="code\_but.png", onRelease = returnCode } buttonHome.x = display.contentWidth/2+400 buttonHome.y = 455 defaultField = native.newTextField( 150, 150, 180, 30 )
This is the function I created:
local function returnCode() if ( defaultField == "1234" ) then storyboard.gotoScene( "1a", "crossFade", 1000 ) return true end
When I enter the code, and press the button, nothing changes. When I edit the function and compare “1234” to “1234”, the scene does change.
Any ideas?
Thanks,
Rik