Ver Mensaje Individual
  #3 (permalink)  
Antiguo 18/09/2010, 14:32
juandedios
 
Fecha de Ingreso: mayo-2003
Ubicación: Lima
Mensajes: 967
Antigüedad: 21 años
Puntos: 8
Respuesta: Problemas con botones

El swfReq está declarado arriba es un URLRequest, el mensaje de error me sale en el panel de salida. Te pongo todo el as3 a ver si por ahi detectas algo.
Código AS3:
Ver original
  1. import flash.display.Sprite;
  2. import flash.net.URLRequest;
  3. import flash.display.Loader;
  4. import flash.events.Event;
  5. import flash.events.MouseEvent;
  6. import flash.events.ProgressEvent;
  7. import flash.text.TextField;
  8. import flash.text.TextFormat;
  9.  
  10. stop();
  11.  
  12. var swfCon:Sprite = new Sprite();
  13. swfCon.x = swfCon.y = 0;
  14. addChild(swfCon);
  15.  
  16. var swfReq:URLRequest = new URLRequest();
  17. var swfLdr:Loader = new Loader();
  18.  
  19. swfLdr.contentLoaderInfo.addEventListener(Event.COMPLETE, fCompletar);
  20. swfLdr.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, fProgreso);
  21.  
  22. if (!swfCon.numChildren) {
  23.     swfReq.url = "home.swf";
  24.     swfLdr.load(swfReq);
  25.     swfCon.addChild(swfLdr);
  26. }
  27.  
  28. MovieClip(root).mcPelicula.mcMenu.mcNosotros.btnNosotros.addEventListener(MouseEvent.CLICK, fCargarContenido);
  29. MovieClip(root).mcPelicula.mcMenu.mcServicios.btnServicios.addEventListener(MouseEvent.CLICK, fCargarContenido);
  30. MovieClip(root).mcPelicula.mcMenu.mcContacto.btnContacto.addEventListener(MouseEvent.CLICK, fCargarContenido);
  31.  
  32. function fCargarContenido(e:MouseEvent):void {
  33.     trace(e.currentTarget.name);
  34.    
  35.     switch (e.currentTarget.name) {
  36.         case MovieClip(root).mcPelicula.mcMenu.mcNosotros.btnNosotros:
  37.             swfReq.url = "nosotros.swf";
  38.             break;
  39.         case MovieClip(root).mcPelicula.mcMenu.mcServicios.btnServicios:
  40.             swfReq.url = "servicios.swf";
  41.             break;
  42.         case MovieClip(root).mcPelicula.mcMenu.mcContacto.btnContacto:
  43.             swfReq.url = "contacto.swf";
  44.             break;                
  45.     }
  46.     swfLdr.load(swfReq);
  47. }
  48.  
  49. function fCompletar(e:Event):void {
  50.     if (swfCon.numChildren) {
  51.         swfCon.removeChildAt(0);
  52.     }
  53.     swfCon.addChild(e.target.content);
  54. }
  55.  
  56. function fProgreso(e:ProgressEvent):void {
  57.     var loadedBytes:Number = Math.ceil(e.bytesLoaded / 1024);
  58.     var totalBytes:Number = Math.ceil(e.bytesTotal / 1024);
  59.     var percent:int = (e.bytesTotal / e.bytesTotal) * 100;
  60.     var txtCargador:TextField = new TextField();
  61.     var txtFormato:TextFormat = new TextFormat("Trebuchet MS", 40, 0x000000);
  62.     txtCargador.autoSize = TextFieldAutoSize.CENTER;
  63.     txtCargador.text = percent + " %";
  64.     txtCargador.x = txtCargador.y = 400;
  65.     txtCargador.defaultTextFormat = txtFormato;
  66.    
  67.     swfCon.addChild(txtCargador);
  68. }
__________________
El aprendiz.