Created
October 30, 2014 01:36
-
-
Save addieljuarez/ae14872f99a2b8505ed5 to your computer and use it in GitHub Desktop.
ejemplo FireEvent and EventListener
This file contains hidden or 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
| $.index.open(); | |
| $.botonNuevaVentana.addEventListener('click', function(e){ | |
| var ventana2 = Alloy.createController('ventana2').getView(); | |
| ventana2.open(); | |
| }); | |
| Titanium.App.addEventListener('cambioDeTexto', function(e){ | |
| // alert(e); | |
| $.labelTexto.text = e.valor; | |
| }); |
This file contains hidden or 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
| '.container':{ | |
| backgroundColor:'pink', | |
| layout:'vertical' | |
| } | |
| '#botonNuevaVentana':{ | |
| top:50, | |
| height:40, | |
| width:150, | |
| title:'nueva ventana', | |
| borderColor:'#000', | |
| } | |
| '#labelTexto':{ | |
| top:30, | |
| color:'#000', | |
| text:'texto de la primera ventana', | |
| } |
This file contains hidden or 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
| <Alloy> | |
| <Window class="container"> | |
| <Button id="botonNuevaVentana"></Button> | |
| <Label id="labelTexto"></Label> | |
| </Window> | |
| </Alloy> |
This file contains hidden or 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
| var args = arguments[0] || {}; | |
| $.buttonLanzador.addEventListener('click', function(e){ | |
| Titanium.App.fireEvent('cambioDeTexto',{'valor' : $.inputSegundaVentana.value}); | |
| }); | |
This file contains hidden or 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
| ".container" : { | |
| backgroundColor:'blue', | |
| opacity:0.4, | |
| } | |
| '#buttonLanzador':{ | |
| bottom:50, | |
| height:50, | |
| width:150, | |
| title:'botton Lanzador', | |
| borderColor:'#000', | |
| } | |
| '#inputSegundaVentana':{ | |
| bottom:120, | |
| height:40, | |
| width:200, | |
| hintText:'inserta un texto', | |
| borderColor:'#000', | |
| } |
This file contains hidden or 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
| <Alloy> | |
| <Window class="container"> | |
| <TextField id="inputSegundaVentana"></TextField> | |
| <Button id="buttonLanzador"></Button> | |
| </Window> | |
| </Alloy> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment