Saltar al contenido
Underc0de /foro

Programacion para iOS y Android - Lista

Iniciado por FrostBite, Noviembre 30, 2011, 07:22:47 PM

Tema anterior - Siguiente tema

0 Miembros y 1 Visitante están viendo este tema.

Avatar de FrostBite
Noviembre 30, 2011, 07:22:47 PM Ultima modificación: Abril 18, 2013, 12:37:00 PM por Expermicid

un codigo extremadamente sencillo para agregar a una lista el texto ke ingresemos en el campo de texto y eliminar de la lista.

Programacion para iOS y Android - Lista

Código: text
<?xml version="1.0" encoding="utf-8"?>
<s:View xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark" title="Pruebaaa">
<fx:Declarations>
<s:ArrayCollection id="dataP"/>
</fx:Declarations>

<fx:Script>
<![CDATA[
private function agregarItem():void
{
dataP.addItem(campo.text);
campo.text = "";
stage.focus = campo;
}

private function eliminarItem():void
{
dataP.removeItemAt(lista.selectedIndex);
}

]]>
</fx:Script>

<s:Button id="agregar" left="10" right="10" top="59" label="Agregar" click="agregarItem();" enabled="{campo.text.length > 0}"/>
<s:List id="lista" dataProvider="{dataP}" left="11" right="9" top="110" bottom="57"></s:List>
<s:Button id="eliminar" left="10" right="10" bottom="10" label="Eliminar" click="eliminarItem();" enabled="{lista.selectedIndex != -1}"/>
<s:TextInput id="campo" left="10" right="10" top="10" prompt="Texto a agregar..."/>
</s:View>
WhatsApp Telegram

¿Te quedó una duda sobre Otros lenguajes?

Preguntala y te responde la comunidad (y el asistente Underc0de IA si nadie llega antes). Es gratis y tarda un minuto.

Ya tengo cuenta
Guardamos tu pregunta en este navegador: después de entrar la publicás con un clic.
Grupo de WhatsApp