local keyboard = KeyBoard.new("en_GB")
	keyboard:Create()
 
	local label1 = TextField.new(nil,"Username : ")
	label1:setPosition(40, 45)
	label1:setTextColor(0xFF1300)
	stage:addChild(label1)
 
	local label2 = TextField.new(nil,"Password")
	label2:setPosition(40, 100)
	label2:setTextColor(0xFF1300)
	stage:addChild(label2)
 
	local inputbox = InputBox.new(150,20,150,40)
	inputbox:setText("")
	inputbox:SetKeyBoard(keyboard)
	inputbox:setBoxColors(0xefefef,0xff2222,0,1)
	inputbox:setActiveBoxColors(0xff5555,0xff2222,0,1)
	stage:addChild(inputbox)
 
	local inputbox2 = InputBox.new(150,80,150,40)
	inputbox2:setText("")
	inputbox2:SetKeyBoard(keyboard)
	inputbox2:setBoxColors(0xefefef,0xff2222,0,1)
	inputbox2:setActiveBoxColors(0xff5555,0xff2222,0,1)
	stage:addChild(inputbox2)
 
 
	stage:addChild(keyboard)
 
local a = TextField.new(nil,"Loading")
 
local upp = Bitmap.new(Texture.new("button.png"))
local down = Bitmap.new(Texture.new("application lifecycle.png"))
 
-- create the button
local button = Button.new(upp, down)
button:setPosition(200, 120)
stage:addChild(button)
nameTaken = ""
local click = 0
button:addEventListener("click", 
	function() 
		if inputbox:getText() == "test" then
			inputbox:setText("done")
		else
			nameTaken = inputbox:getText()
			passwordTaken = inputbox2:getText()
			print (nameTaken)
			print (passwordTaken)
 
			print (nameTaken .. "---")
 
			local loader = UrlLoader.new("<a href="http://localhost/checklogin.php?myusername="" rel="nofollow">http://localhost/checklogin.php?myusername="</a>; .. nameTaken .. "&mypassword=" .. passwordTaken)
 
			local function onComplete(event)
 
				local myString=event.data      -- We got the string here.
 
				local length = string.len(myString)
				local i = 1
 
				local echoString = ""
				while (i < length+1) do
 
					echoString = echoString .. string.sub(myString,i,i)
					i = i+1;
				end
 
				a:setText(echoString)
				a:setPosition(10, 185)
				a:setTextColor(0x007B25)
				stage:addChild(a)
 
				print (echoString)
 
				loader:removeEventListener(Event.COMPLETE, onComplete)
			end
 
			local function onError()
				print("error")
			end
 
			local function onProgress(event)
				print("progress: " .. event.bytesLoaded .. " of " .. event.bytesTotal)
			end
			loader:addEventListener(Event.COMPLETE, onComplete)
			loader:addEventListener(Event.ERROR, onError)
			loader:addEventListener(Event.PROGRESS, onProgress)
		end	
 
	end) --end of function which exist in button:addEventListener
Comments
A good scene manager class is useful here - have a look at the game template example to see what I mean.
Simples
#MakeABetterGame! "Never give up, Never NEVER give up!" - Winston Churchill
After logging successfully , for example , i want user.lua page to open on the simulator.
for what reason should i use "Scenemanager class " . What can i do with it? I looked at "Scenemanager class" but i can't find what it can do for me
Likes: loves_oi
When your app starts the login "page" is active, then when you get a response from the server you can decide to change to the home "page" by sending a message to the scene / page manager.
Likes: loves_oi
#MakeABetterGame! "Never give up, Never NEVER give up!" - Winston Churchill
you can check out GameTemplate
http://appcodingeasy.com/Gideros-Mobile/Gideros-Mobile-Game-Template
To see an example how SceneManager is used
#MakeABetterGame! "Never give up, Never NEVER give up!" - Winston Churchill
I have no idea about all these files . It so complex for beginners
This circumstance discourages me so much.I can't do anything. Please help
Likes: techdojo, loves_oi
http://appcodingeasy.com/Gideros-Mobile/Manage-Scenes-in-Gideros-Mobile
Likes: loves_oi
For today, i only want to redirect it to a scene page when it is admin .But it doesn't work.
this is main.lua:
scenemanager.lua:264: attempt to index field '?' (a nil value)
stack traceback:
scenemanager.lua:264: in function 'changeScene'
main.lua:92: in function
Thanks in advance
scenemanager.lua:277: attempt to index field '?' (a nil value)
stack traceback:
scenemanager.lua:277: in function 'changeScene'
main.lua:94: in function
The lines 277-279 are:
well this error looks quite similar. Which transition do you use, maybe this transition requires to have 2 scenes (from and to)?
scenemanager.lua:325: attempt to perform arithmetic on field 'duration' (a nil value)
stack traceback:
scenemanager.lua:325: in function
the line is:
325 local t = (self.duration == 0) and 1 or (self.time / self.duration)
reason is (self.time / self.duration)
because t is null.
t is null because duration is null.In function changeScene , duration is 1 at first call , but then it becomes Null.Why??
This is changeScene function:
Likes: loves_oi
Website: http://www.castlegateinteractive.com
https://play.google.com/store/apps/developer?id=Castlegate+Interactive