Skip to content

Instantly share code, notes, and snippets.

@arturoleon
Created February 21, 2014 01:27
Show Gist options
  • Save arturoleon/9127094 to your computer and use it in GitHub Desktop.
Save arturoleon/9127094 to your computer and use it in GitHub Desktop.
Alloy ejercicio Clase 1
// The contents of this file will be executed before any of
// your view controllers are ever executed, including the index.
// You have access to all functionality on the `Alloy` namespace.
//
// This is a great place to do any initialization for your app
// or create any global variables/functions that you'd like to
// make available throughout your app. You can easily make things
// accessible globally by attaching them to the `Alloy.Globals`
// object. For example:
//
// Alloy.Globals.someGlobalFunction = function(){};
Alloy.Globals.alerta = function(msg){
alert(msg);
};
function clickImage(e) {
Titanium.UI.createAlertDialog({title:'Image View', message:'You clicked me!'}).show();
var secudaria = Alloy.createController('secundaria').getView();
secudaria.open();
}
$.index.open();
"Window": {
backgroundColor:"white"
},
"#l":{
bottom:20,
width: Ti.UI.SIZE,
height: Ti.UI.SIZE,
color:'#999'
},
"#imageView":{
image:"/images/apple_logo.jpg",
width:24,
height:24,
top:100
}
<Alloy>
<Window>
<ImageView id="imageView" onClick="clickImage"/>
<Label id="l">Click Image of Apple Logo</Label>
</Window>
</Alloy>
function cerrarVentana(){
Alloy.Globals.alerta("Mensaje!");
$.secundaria.close();
}
"Window": {
backgroundColor:"white"
},
"#l":{
bottom:20,
width: Ti.UI.SIZE,
height: Ti.UI.SIZE,
color:'#000'
}
<Alloy>
<Window>
<Label id="l" onClick="cerrarVentana">Cerrar ventana secundaria</Label>
</Window>
</Alloy>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment