Ver Mensaje Individual
  #21 (permalink)  
Antiguo 23/03/2009, 14:18
Avatar de Kronos_Corp
Kronos_Corp
 
Fecha de Ingreso: marzo-2009
Mensajes: 61
Antigüedad: 15 años, 1 mes
Puntos: 1
Respuesta: CheckBox: Busco ejemplo claro de como usarlo con Flash AS3

Ok compa...mira...modifique el codigo al siguiente...admas inserte 3 cuadros de texto dinamicos con variables texto1, text2 y texto 3

Código ActionScript:
Ver original
  1. var cb1:MyCheckBox = new MyCheckBox(5, 10);
  2. cb1.label = "Opción 1";
  3. addChild(cb1);
  4.  
  5. var cb2:MyCheckBox = new MyCheckBox(8, 4);
  6. cb2.label = "Opción 2";
  7. addChild(cb2);
  8. cb2.y = 50;
  9.  
  10. var cb3:MyCheckBox = new MyCheckBox(16, 20);
  11. cb2.label = "Opción 3";
  12. addChild(cb3);
  13. cb3.y = 100;
  14.  
  15. cb1.addEventListener(Event.CHANGE, onChange);
  16. cb2.addEventListener(Event.CHANGE, onChange);
  17. cb3.addEventListener(Event.CHANGE, onChange);
  18.  
  19. function onChange(evt:MouseEvent):void {
  20.     if(evt.target.name == "cb1") {
  21.         texto1.text = evt.target.value;
  22.         //Otras instrucciones
  23.     } else if(evt.target.name == "cb2") {
  24.         texto2.text = evt.target.value;
  25.         //Otras instrucciones
  26.     } else if(evt.target.name == "cb3") {
  27.         texto3.text = evt.target.value;
  28.         //Otras instrucciones
  29.     }
  30. }


Ademas tengo guardado el archivo MyCheckBox.as que me diste al principio....al momento de seleccionar un checkbox me da elsiguiente error

Código ActionScript:
Ver original
  1. TypeError: Error #1034: Error de conversión forzada: no se puede convertir flash.events::Event@3ef0bc9 en flash.events.MouseEvent.
  2.     at flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchEventFunction()
  3.     at flash.events::EventDispatcher/dispatchEvent()
  4.     at fl.controls::LabelButton/fl.controls:LabelButton::toggleSelected()


Espero y me dirigas en esto gracias

Última edición por Kronos_Corp; 23/03/2009 a las 21:42