Dear Corona Developers,
I have few doubt’s in Native UI.
- In my application first page is login screen.When I open the my application 3 seconds splash screen will display after Login screen will appear.In login page two text Field’s are there username and password.
-Before opening login page Text Field Will appear on splash screen.
One more question
- when i click login button. I want to show one loading screen
at same page. Text Field is visible on loading screen.
My Doubt is how to hide Text Field on splash screen and loading Screen.
I am using Director Class 1.4
Corona Build 783
—Here My Code—
*****main.lua*****
display.setStatusBar(display.HiddenStatusBar)
director = require “director”
ui = require “ui”
local mainGroup = display.newGroup()
local main = function()
mainGroup:insert(director.directorView)
director:changeScene(“splashscreen”,“crossfade”)
return true
end
main()
******* splashscreen.lua ******
module(…,package.seeall)
local director = director
new = function (params)
local localGroup = display.newGroup()
local splashscreen
splashscreen = display.newImageRect(“assets/splash/splashscreen.jpg”,display.contentWidth,display.contentHeight)
splashscreen.x = display.contentWidth/2
splashscreen.y = display.contentHeight/2
localGroup:insert(splashscreen)
directorTimer = timer.performWithDelay(3000,function ()
director:changeScene(“loginpage”,“crossfade”) end,1)
return localGroup
end
function clean(event)
if directorTimer ~= nil then
timer.cancel(directorTimer)
directorTimer = nil
end
end
********loginPage.lua********
module(…,package.seeall)
new = function (params)
local localGroup = display.newGroup()
local _W = display.contentWidth
local _H = display.contentHeight
local loginBg
local get_Password = “”
local get_UserName = “”
local textField_Username
local textField_Password
loginBg = display.newImageRect(“assets/login/loginscreen.jpg”,display.contentWidth,display.contentHeight)
loginBg.x = display.contentWidth/2
loginBg.y = display.contentHeight/2
localGroup:insert(loginBg)
local function textField_Listener(event)
if event.phase == “began” then
if textField_Username.text == “Your email address” then
textField_Username.text = “”
end
elseif event.phase == “ended” then
if string.len(textField_Username.text) == 0 then
textField_Username.text = “Your email address”
end
get_UserName=tostring(textField_Username.text)
elseif event.phase == “submitted” then
native.setKeyboardFocus( nil )
end
end
local function passwordField_Listener(event)
if event.phase == “began” then
textField_Password.isSecure = true
textField_Password.text = “”
elseif event.phase == “ended” then
if string.len(textField_Password.text) == 0 then
textField_Password.isSecure = false
textField_Password.text = “Your password”
end
get_Password=tostring(textField_Password.text)
elseif event.phase == “submitted” then
native.setKeyboardFocus( nil )
end
end
textField_Username = native.newTextField( 40,230,250,30,textField_Listener )
textField_Username.align = “left”
textField_Username.text = “Your email address”
textField_Username.size = 16
textField_Username:setTextColor(139,139,131 )
localGroup:insert(textField_Username)
textField_Password = native.newTextField(40,280,250,30,passwordField_Listener )
textField_Password.align = “left”
textField_Password.text = “Your password”
textField_Password.size = 16
textField_Password:setTextColor( 139,139,131 )
localGroup:insert(textField_Password)
return localGroup
end
Thanks. [import]uid: 119468 topic_id: 25305 reply_id: 325305[/import]