to switch between layers: you can do one of these:
1. Enabling and disabling visiblity of Objects:
-show the Objects you want using: [layer2.Visible=1]
-hide the objects you don't want using: [layer1.Visible=0]
2. Fliping the Object:
-use [flipObject(layer1,layer2,"")]
3. Fliping the widget
-add sides for the widget (rightClick the widget in treeView and select AddSides)
-add layer1 to FrontSide and layer2 to BackSide
-flip the widget using [widget.cmd("!Flip")]
===========
to input and check the text in editbox you can use this code:(replace comment section with your code for changing layers)
(don't forget to add [edit1OnKeyDown] in [OnKeyDown] of function tab for edit1)
Code:
pass="1234"
function edit1OnKeyDown(Sender,Key,KeyChar,Shift)
{
if(Key==13)
{
if(edit1.Text==pass)
{
showTrayBalloon("unlocked","5")
edit1.Visible=0
//use you code here to show layer2; here are some examples:
//ex: layer2.Visible=1;
//ex2: flipObject(layer1,layer2,"")
//ex3: widget.cmd("!Flip")
}
edit1.Text=""
}
}
===========
to limit the input to 4 character you can use this code:(don't forget to add [edit1OnChange] in [OnChange] of function tab for edit1)
Code:
function edit1OnChange(Sender)
{
if(edit1.Text.length>4)
{
edit1.Text=edit1.Text.slice(0,4)
}
}
=============
to enable only digit input: you can use [Filter Char>Integer] in the Attribute tab of Inspector