local composer = require( "composer" ) local scene = composer.newScene() local widget = require ("widget") -- ----------------------------------------------------------------------------------- -- Code outside of the scene event functions below will only be executed ONCE unless -- the scene is removed entirely (not recycled) via "composer.removeScene()" -- ----------------------------------------------------------------------------------- -- ----------------------------------------------------------------------------------- -- Scene event functions -- ----------------------------------------------------------------------------------- -- create() function scene:create( event ) local sceneGroup = self.view -- Code here runs when the scene is first created but has not yet appeared on screen local bbalance = widget.newButton( { top = 80, left= 90, width = 150, heigth = 30, cornerRadius = 5, shape = "roundedRect", onEvent = handleButtonEvent , embose =true , strokeWidth = 4, onPress = bbalance, onRelease = hideImage, fillColor ={ default={1,0,0,1}, over={1,0.1,0.7,0.4} } , } ) sceneGroup:insert(bbalance) local function bbalance() keyDo4.isVisible = false return true end local function hideImage() keyDo4.isVisible = false return true end local account = native.newTextField(100,150,150,30) keyDo4.isVisible = false local mobile = widget.newButton( { top = 250, left= 90, width = 150, heigth = 40, cornerRadius = 5, shape = "roundedRect", onEvent = handleButtonEvent , embose =true , strokeWidth = 4, --onRelease = print, fillColor ={ default={1,0,0,1}, over={1,0.1,0.7,0.4} } , } ) sceneGroup:insert(mobile) end -- show() function scene:show( event ) local sceneGroup = self.view local phase = event.phase if ( phase == "will" ) then -- Code here runs when the scene is still off screen (but is about to come on screen) elseif ( phase == "did" ) then -- Code here runs when the scene is entirely on screen end end -- hide() function scene:hide( event ) local sceneGroup = self.view local phase = event.phase if ( phase == "will" ) then -- Code here runs when the scene is on screen (but is about to go off screen) elseif ( phase == "did" ) then -- Code here runs immediately after the scene goes entirely off screen end end -- destroy() function scene:destroy( event ) local sceneGroup = self.view -- Code here runs prior to the removal of scene's view end -- ----------------------------------------------------------------------------------- -- Scene event function listeners -- ----------------------------------------------------------------------------------- scene:addEventListener( "create", scene ) scene:addEventListener( "show", scene ) scene:addEventListener( "hide", scene ) scene:addEventListener( "destroy", scene ) -- ----------------------------------------------------------------------------------- return scene
what am trying to achieve is when i press the button a textbox should appear and when pressed again should disappear, i get an error that trying to index keyDo4(a nil value). and also how to make a scene appear halfway an overlay