Comunidad de diseño web y desarrollo en internet online

Problema al cargar un swf en el objeto window

Citar            
MensajeEscrito el 30 Sep 2005 02:52 am
Hola
el problema es el siguiente, tengo un swf que arma un news, el tema es que lo quiero cargar en un ventana modal dentro de otra flash, si bien lo esta cargando, no lo ejecuta en forma completa, es decir la animacion del swf no se reproduce ni se cargar completamente el swf que se arma desde un xml, alguien me puede dar una idea de que es lo que puede estar ocurriendo. los codigo son los siguientes...

Pd
si pruebo el swf de noticias [noticias.swf] solo funciona y se carga completamente y bien.



Llorando
codigo que crea la ventana
----------------------------------------------------------------------------------------------

Código :

on (release) {
   creawindow();
}

----------------------------------------------------------------------------------------------

ventana modal
----------------------------------------------------------------------------------------------

Código :

import mx.managers.PopUpManager
import mx.containers.Window

function creawindow()
{
var ventana = PopUpManager.createPopUp(_root, Window, true, {contentPath:"noticias.swf"}, true);
alCrear = Object();
alCrear.complete = function(evento){
   ventana.setSize(370, 300);
   ventana.closeButton = true;
   ventana.title = "noticias..";
}

alCerrar = Object();
alCerrar.click = function(evento){
   evento.target.deletePopUp();
}

alClicarFuera = Object();
alClicarFuera.mouseDownOutside = function(){
   trace("Cierra la ventana antes");
}

ventana.addEventListener("click", alCerrar);
ventana.addEventListener("complete", alCrear);
ventana.addEventListener("mouseDownOutside", alClicarFuera);
}

----------------------------------------------------------------------------------------------


noticias.swf
----------------------------------------------------------------------------------------------

Código :

stop();
noticias = new XML();
noticias.ignoreWhite = true;
noticias.onLoad = function (){
   totalxml = noticias.getBytesTotal();
   cargadoxml = noticias.getBytesLoaded();
   porcentajexml = Math.round((cargadoxml/totalxml)*100);
   if (porcentajexml >= 100) {
      removeMovieClip(cargando);
      notis_puerto = new Array();
      titulo = new Array();
      urls = new Array();
      long = noticias.firstChild.childNodes.length;
      cargarCSS();
   }
}
attachMovie("carga_xml","cargando",2);
cargando._x = 45;
cargando._y = 94;
anchogral = 515;
attachMovie("linea","linea_abajo",5000);
linea_abajo._x = 0;
linea_abajo._y = 440;
linea_abajo._width = anchogral;
noticias.load("noticias.xml");

function cargarCSS(){
   estailo = new TextField.StyleSheet();
   estailo.onLoad = function(){
      totalcss = estailo.getBytesTotal();
      cargadocss = estailo.getBytesLoaded();
      porcentajecss = Math.round((cargadocss/totalcss)*100);
      if (porcentajecss >= 100) {
         removeMovieClip(cargando2);
         _root.createEmptyMovieClip("temp_mc", 7);
         temp_mc.createTextField ("notis_txt",8,-150,-20,250,16);
         temp_mc.notis_txt.multiline = true;
         temp_mc.notis_txt.wordWrap = true;
         temp_mc.notis_txt.html = true;
         for (i=0; i<long; i++){
            titulo[i] = noticias.firstChild.childNodes[i].attributes.titulo;
            urls[i] = noticias.firstChild.childNodes[i].attributes.urls;
            temp_mc.notis_txt.htmlText = "<p class='tit'>"+titulo[i]+"</p><br><p class='txt'>"+noticias.firstChild.childNodes[i].firstChild+"</p>";
            notis_puerto[i] = temp_mc.notis_txt.maxscroll-1;
         }
         removeMovieClip(_root["temp_mc"]);
         montarNoticias();
      }
   }
   attachMovie("carga_css","cargando2",3);
   cargando2._x = 45;
   cargando2._y = 94;
   estailo.load("noticias.css");
}
function montarNoticias(){
   par = true;
   for (i=0; i<long; i++){
      //Ponemos la caja
      _root.attachMovie ("caja_info","caja"+i,i*10);
      _root["caja"+i].colorcaja = new Color(_root["caja"+i].fondo.fondocolor);
      _root["caja"+i].fondo._height = 16 * notis_puerto[i];
      _root["caja"+i].fondo._width = anchogral;   //268;
      if (par == true){
         _root["caja"+i].colorcaja.setRGB(0xEEEEEE);
         _root["caja"+i].micolor = "0xEEEEEE";
         par = false;
      }
      else{
         _root["caja"+i].colorcaja.setRGB(0xFFFFFF);
         _root["caja"+i].micolor = "0xFFFFFF";
         par = true;
      }
      if (altura == undefined){
         altura = 0;
      }
      else{
         altura = altura + _root["caja"+(i-1)].fondo._height;
      }
      _root["caja"+i]._x = 0;
      _root["caja"+i]._y = altura;
      _root["caja"+i].createTextField("texto_txt",i*37,2,1,anchogral,16 * notis_puerto[i]);
      _root["caja"+i].texto_txt.html = true;
      _root["caja"+i].texto_txt.multiline = true;
      _root["caja"+i].texto_txt.wordWrap = true;
      _root["caja"+i].texto_txt.border = false;
      _root["caja"+i].texto_txt.selectable = false;
      _root["caja"+i].texto_txt.styleSheet = estailo;
      _root["caja"+i].texto_txt.htmlText = "<p class='tit'>"+titulo[i]+"</p><br>";
      _root["caja"+i].texto_txt.htmlText += "<p class='txt'>"+noticias.firstChild.childNodes[i].firstChild+"</p>";
   }
   attachMovie("pestana","pestanita",2000);
   pestanita._x = 0;
   pestanita._y = 0;
   pestanita._width = anchogral;   //268;
   siguiente_y = 0;
   y_arriba = 0;
   for (i=long; i>0; i--){
      if (_root["caja"+i]._y > 330){
         siguiente_y = siguiente_y - _root["caja"+i]._height + 1;
         _root["caja"+i]._y = siguiente_y;
      }
   }
   moverNoticias();
}
function moverNoticias(){
   if (primera_vez == undefined){
      _root.onEnterFrame = function(){
         for (i=0; i<long; i++){
            if (_root["caja"+i]._y > 330){
               y_arriba = 0;
               for (j=0; j<long; j++){
                  //Todos los clips que esten por encima de 0
                  if (_root["caja"+j]._y < 0){
                     //Cogemos la posicion y que haya mas arriba
                     y_actual = _root["caja"+j]._y;
                     if (y_actual < y_arriba){
                        y_arriba = y_actual;
                     }
                  }
               }
               _root["caja"+i]._y = y_arriba - _root["caja"+i]._height + 1;
            }
            _root["caja"+i]._y += 1;
         }
      }
      primera_vez = false;
   }
   el_fondo.onEnterFrame = function(){
      for (i=0; i<long; i++){
         _root["caja"+i].onRollOver = function(){
            this.colorcaja.setRGB(0xCDFBFE);
            delete _root.onEnterFrame;
         }
         _root["caja"+i].onRollOut = function(){
            this.colorcaja.setRGB(this.micolor);
            _root.onEnterFrame = function(){
               for (i=0; i<long; i++){
                  if (_root["caja"+i]._y > 330){
                     y_arriba = 0;
                     for (j=0; j<long; j++){
                        if (_root["caja"+j]._y < 0){
                           y_actual = _root["caja"+j]._y;
                           if (y_actual < y_arriba){
                              y_arriba = y_actual;
                           }
                        }
                     }
                     _root["caja"+i]._y = y_arriba - _root["caja"+i]._height + 1;
                  }
                  _root["caja"+i]._y += 1;
               }
            }
         }
      }
   }
}

---------------------------------------------------------------------------------------------- :cry: :cry:

Editado, se agregaron las etiquetas code. SWAT team

Por PointView

6 de clabLevel



Genero:Masculino  

firefox
Citar            
MensajeEscrito el 30 Sep 2005 11:19 am
Si funciona bien por separado, es posible que sea por tema rutas, así que pon en el swf que cargas, el en primer frame lo siguiente:

_lockroot= true;


porque cada vez que usas _root en noticias.swf cuando éste está cargado en el principal te estas refiriendo al principal.

De esta forma cuando uses _root en noticias.swf te estarás refiriendo a noticias.swf


:wink:

Por Sisco

BOFH

3700 de clabLevel

12 tutoriales
4 articulos

Genero:Masculino   Bastard Operators From Hell

Catalunya

firefox
Citar            
MensajeEscrito el 30 Sep 2005 01:04 pm
Hola

hola

_lockroot= true;


stop();
_root.onEnterFrame = function() {
loadTot = _root.getBytesTotal();
loadPer = _root.getBytesLoaded() / loadTot * 100;
if (loadPer >= 100) {
delete _root.onEnterFrame;
play();
}
};

Por PointView

6 de clabLevel



Genero:Masculino  

firefox
Citar            
MensajeEscrito el 30 Sep 2005 01:08 pm
Hola
estuve probando algunos parches use _lockroot= true;
y nada, le puse un preload a noticias.swf y tampoco nada, alguna otra idea?


creador de ventana.swf
------------------------------------------------------------------------------------
_lockroot= true;
------------------------------------------------------------------------------------

noticias.swf
------------------------------------------------------------------------------------
stop();
_root.onEnterFrame = function() {
loadTot = _root.getBytesTotal();
loadPer = _root.getBytesLoaded() / loadTot * 100;
if (loadPer >= 100) {
delete _root.onEnterFrame;
play();
}
};

ademas en la funcion de noticias.onLoad

le agregue esto

------------------------------------------------------------------------------------
noticias.onLoad = function (){

//Porcentajes y esas cosas
do {
totalxml = noticias.getBytesTotal();
cargadoxml = noticias.getBytesLoaded();
porcentajexml = Math.round((cargadoxml/totalxml)*100);
trace(porcentajexml);
} while (porcentajexml < 100);

......
......sigue
------------------------------------------------------------------------------------


:crap:

Por PointView

6 de clabLevel



Genero:Masculino  

firefox

 

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