Comunidad de diseño web y desarrollo en internet online

componente alert

Citar            
MensajeEscrito el 21 Sep 2005 07:36 pm
coloque primero el componente en la aplicacion pero aun asi me sigue saliendo este error de hecho lo tengo declarado ...pero me sigue marcando este error es el codigo que utilizo

import mx.controls.Alert;
Failed to create a new alert, probably because there is no Alert in the Library

codigo que tengo ahorita .....haber si me pudieran ayudar

BtnEnviarListener = new Object();
BtnEnviarListener.click = function ()
{
Alert.show("¿Te gusta este tutorial tan chulo?", "Encuesta CristaLab.com", Alert.YES | Alert.NO, this, alClicar, "prueba", Alert.OK);
}
BtnEnviar.addEventListener("click",BtnEnviarListener);

alClicar = new Object();
alClicar = function (evento){
if (evento.detail == Alert.YES){
trace("Has pulsado Si");
}
else if (evento.detail == Alert.NO){
trace("Has pulsado No");
}
}

Alert.yesLabel = "Sí";
Alert.noLabel = "No";
Alert.buttonWidth = 75;

Por srangel

40 de clabLevel



 

msie
Citar            
MensajeEscrito el 21 Sep 2005 11:10 pm
Primero que todo aclarar una cosa que no se si sabes, ese codigo solo funciona si el boton es el que está en los componentes.

Segundo, eso es un problema con el componente Alert, no se exactamente a que se debe pero no funciona si es llamado desde una función.

Esta es la unica solución (muy artesanal por cierto) que he encontrado a ese problema:

Código :

import mx.controls.Alert;
_root.onEnterFrame = function() {
   if (alerta) {
      Alert.show("¿Te gusta este tutorial tan chulo?", "Encuesta CristaLab.com", Alert.YES | Alert.NO, this, alClicar, "prueba", Alert.OK); 
      alerta = false;
   }
};
BtnEnviarListener = new Object();
BtnEnviarListener.click = function(evt) {
   alerta = true;
};
BtnEnviar.addEventListener("click", BtnEnviarListener);
alClicar = function (evento) {
   if (evento.detail == Alert.YES) {
      trace("Has pulsado Si");
   } else if (evento.detail == Alert.NO) {
      trace("Has pulsado No");
   }
};
Alert.yesLabel = "Sí";
Alert.noLabel = "No";
Alert.buttonWidth = 75;


A mi me funciona.

Por Xyrer

628 de clabLevel

1 tutorial

Genero:Masculino  

Android App Development

firefox

 

Cristalab BabyBlue v4 + V4 © 2011 Cristalab
Powered by ClabEngines v4, HTML5, love and ponies.