Foros del Web » Creando para Internet » Flash y Actionscript »

Problema con DisplayObject

Estas en el tema de Problema con DisplayObject en el foro de Flash y Actionscript en Foros del Web. Hola. Gracias por leer esto. Soy novato en AS3 y me estoy enfrentando a mi primera aplicación de escritorio en Flash CS5 + AS3. Mi ...
  #1 (permalink)  
Antiguo 08/08/2012, 16:38
 
Fecha de Ingreso: abril-2010
Mensajes: 17
Antigüedad: 14 años
Puntos: 0
Pregunta Problema con DisplayObject

Hola.
Gracias por leer esto.

Soy novato en AS3 y me estoy enfrentando a mi primera aplicación de escritorio en Flash CS5 + AS3.

Mi problema es que estoy usando la clase AlertManager de yahoo Astra Library (http://developer.yahoo.com/flash/astra-flash/classreference/) y los dialogos con esta clase me funcionan perfecto y lucen espectaculares por lo que no quisiera prescindir de ellos. Como el proyecto lo estoy compilando con MDM Zinc 4.0 tengo la opción de usar la extensión mdm_dialogs pero honestamente me parecen horribles estéticamente hablando.

El único inconveniente que he tenido con esta clase es que cuando quiero emitir una alerta dentro de la función del código a continuación, me genera el siguiente error:

TypeError: Error #1034: Error de conversión forzada: no se puede convertir global@6b970d1 en flash.display.DisplayObject.
at MethodInfo-5557()
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at flash.net::URLLoader/onComplete()

Código Javascript:
Ver original
  1. stop();
  2. //0-importar clases
  3. import mdm.*;
  4. import flash.events.MouseEvent;
  5. import flash.text.TextFormat;
  6. import stbroglobal;
  7. import es.yporqueno.crypto.*;
  8. import fl.controls.TextInput;
  9. import flash.events.Event;
  10. import flash.events.KeyboardEvent;
  11. import com.yahoo.astra.fl.managers.AlertManager;
  12. import flash.display.DisplayObject;
  13. //0-fin
  14. //1-definiendo función pública de acceso automático
  15. stbroglobal.login_system = function(type:String, event:Event=null):void
  16. {
  17.     if(mdm.Application.path!=null)
  18.     {
  19. ///a-cargar datos de usuario
  20.         var ruta:String = mdm.Application.path+"userdata.txt";
  21.         var cache_exists:Boolean = mdm.FileSystem.fileExists(ruta);
  22.             if(cache_exists)
  23.             {
  24.                 var aut_data_collect:String = mdm.FileSystem.loadFile(ruta);
  25. ///a-fin
  26. ///b-enviar datos al servidor para autenticar
  27.                 if(aut_data_collect.length>12)
  28.                 {
  29.                     stbroglobal.show_loading();
  30.                     var request:URLRequest = new URLRequest(stbroglobal.serverpath+"/php/auto_login3.php");
  31.                     var loader:URLLoader = new URLLoader();
  32.                     var loaderVars:URLVariables = new URLVariables();
  33.                     loaderVars.data_transfer = aut_data_collect;
  34.                     request.data = loaderVars;
  35.                     request.method = URLRequestMethod.POST;
  36.                     loader.addEventListener(Event.COMPLETE, handleComplete);
  37.                     loader.addEventListener(IOErrorEvent.IO_ERROR, onIOError);
  38.                     loader.load(request);
  39.                     function handleComplete(event:Event)
  40.                     {
  41.                         var loader_response:URLLoader = URLLoader(event.target);
  42.                         var server_response:String = loader_response.data;
  43.                         if(server_response.indexOf("OK")>=0)
  44.                         {
  45.                             var txt_output:String = server_response;
  46.                             var array_coll_output:Array = txt_output.split("|");
  47.                             stbroglobal.current_user = array_coll_output[1];
  48.                             stbroglobal.current_list = array_coll_output[2];
  49.                             stbroglobal.serverpath = array_coll_output[3];
  50.                             stbroglobal.current_version = array_coll_output[4];
  51.                             gotoAndPlay("player");
  52.                             stbroglobal.hide_loading();
  53.                         }
  54.                         else
  55.                         {
  56.                             AlertManager.createAlert(this, "Ocurrió un problema al tratar de contactar el servidor\rde autenticación.\rPor favor reintente mas tarde o \rcontacte a "+stbroglobal.support_msj+" para mas información.", "Error crítico No. "+stbroglobal.error1002+"!", ["OK"], stbroglobal.exit_app, null, true);
  57.                         }
  58.                     }
  59.                     function onIOError(event:IOErrorEvent):void
  60.                     {
  61.                         //msj cuando falla el loadvars
  62.                     }
  63.                 }
  64.                 else
  65.                 {
  66.                     //msj cuando falla la autenticación MD5
  67.                 }
  68.             }
  69.             else
  70.             {
  71.                 //que hacer si el archivo está incorrecto
  72.             }
  73.     }
  74.     else
  75.     {
  76.         //que hacer si la ruta no existe
  77.     }
  78. }
  79. //1-fin
  80. //2-ejecutando autologin
  81. stbroglobal.login_system("auto");
  82. //2-fin

al parecer todo radica en la propiedad container
Código Javascript:
Ver original
  1. AlertManager.createAlert(this,
la cual es un DisplayObject. El argumento this en esta función le indica a la clase cual es el DisplayObject que está creando el cuadro de alerta y es aquí donde mi ignorancia me está dando problemas pues si uso un alertmanager en la linea de tiempo funciona bien usando this (cual es el DisplayObject en este caso?) pero si lo uso en la función handleComplete de mi código, me da ese error.

Alguién sabe porqué sucede esto?

Gracias.
  #2 (permalink)  
Antiguo 09/08/2012, 17:02
 
Fecha de Ingreso: abril-2010
Mensajes: 17
Antigüedad: 14 años
Puntos: 0
Respuesta: Problema con DisplayObject

Solucionado.
El error estaba en la declaración de las funciones las cuales estaban dentro de un if. Gracias a la gente de http://cristalab.com por su ayuda.

Etiquetas: as3
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 12:44.