Created
March 29, 2014 16:07
-
-
Save arturoleon/9857257 to your computer and use it in GitHub Desktop.
Ejemplo de módulos en Titanium Clásico
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function(){ | |
var Secundaria = require('secundaria'); | |
var ventana = Ti.UI.createWindow({ | |
backgroundColor: "white" | |
}); | |
var boton = Ti.UI.createButton({ | |
title: "Hola!" | |
}); | |
ventana.add(boton); | |
ventana.open(); | |
boton.addEventListener('click',function(e){ | |
Secundaria("Esta es la ventana secundaria").open(); | |
}); | |
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Secundaria(texto){ | |
var ventana = Ti.UI.createWindow({ | |
backgroundColor:"white" | |
}); | |
var etiqueta = Ti.UI.createLabel({ | |
text: texto | |
}); | |
var botonCerrar = Ti.UI.createButton({ | |
color:"red", | |
bottom:20, | |
title: "Cerrar ventana" | |
}); | |
ventana.add(etiqueta); | |
ventana.add(botonCerrar); | |
botonCerrar.addEventListener('click',function(){ | |
ventana.close(); | |
}); | |
return ventana; | |
} | |
module.exports = Secundaria; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment