I am making an X-Ray app from one of the books i am following and one of the assignments is to create a restart start button and i have no idea how. Any help would be great! Here is my code.
local proceedButton
display.setStatusBar(display.HiddenStatusBar)
local isXcodeSimulator = “Iphone Simulator” == system.getInfo (“model”)
if(isAndroid or isXcodeSimulator) then
local alert = native.showAlert ( “Information”, “Camera API not avaidable on Android or iOS Simulator.”, {“OK”})
end
local background = display.newRect ( 0, 0, display.contentWidth, display.contentHeight )
background:setFillColor ( .5, 0, 0)
local text = display.newText ( “Tap anywhere to launch Camera”, 0, 0, nil, 16 )
text:setFillColor ( 1, 1, 1)
text.x = 0.5 * display.contentWidth
text.y = 0.5 * display.contentHeight
local function processing( event )
proceedButton.alpha = 0
local scanbar = display.newImageRect (“scan.png”, 320, 50)
scanbar.x = display.contentWidth/2
scanbar.y = 0
transition.to (scanbar, {y=display.contentHeight, time= 2000})
local skeleton = display.newImageRect (“invertskele.png”, 302, 480)
skeleton.alpha = 0
skeleton.x = display.contentWidth/2
skeleton.y = display.contentHeight/2
transition.to (image, {alpha = 0, tiem = 4000})
transition.to (skeleton, {alpha=1, time=5000})
end
local function sessionComplete( event )
image = event.target
print ( “Camera”, ( image and “returned an image”) or “session was canceled”)
print( "sessionComplete: " … session.Complete)
print( "trget: " … tostring(image))
if image then
image.x = display.contentWidth/2
image.y = display.contentHeight/2
local w = image.width
local h = image.height
print ( "w, h = "…w … “,” … h )
proceedButton = display.newImage (“button.png”)
proceedButton.x = 160
proceedButton.y = 340
proceedButton:addEventListener ( “tap”, listener )
background:setFillColor (0,0,0)
background:removeSelf ()
text:removeSelf ()
end
end
local listener = function ( event )
media.show (media.Camera, sessionComplete)
return true
end
background:addEventListener ( “tap”, listener )