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

news ticker + actionscript 2.0

Estas en el tema de news ticker + actionscript 2.0 en el foro de Flash y Actionscript en Foros del Web. Hola amigos, Tengo un problema con lo siguiente, ya que tome el codigo de prestado y veo que el sistema de orientacion de las noticias ...
  #1 (permalink)  
Antiguo 19/05/2008, 22:12
 
Fecha de Ingreso: julio-2007
Mensajes: 15
Antigüedad: 16 años, 9 meses
Puntos: 0
Exclamación news ticker + actionscript 2.0

Hola amigos,

Tengo un problema con lo siguiente, ya que tome el codigo de prestado y veo que el sistema de orientacion de las noticias va de arriba para abajo y a mi me gustaria que vaya de abajo para arriba como normalmente se ve en todos lados. Probe varias veces cambiar variables y nada. Aca les paso el codigo:

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; attachMovie("linea","linea_abajo",5000); linea_abajo._x = 0; linea_abajo._y = 400; noticias.load("noticias.xml"); /*-------------------------------------------------------------------------------*/ /*--------------------- FUNCION PARA CARGAR LA HOJA CSS --------------------*/ /*-------------------------------------------------------------------------------*/ 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,168,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"); } /*-------------------------------------------------------------------------------*/ /*--------------------- FUNCION PARA MONTAR LAS NOTICIAS -------------------*/ /*-------------------------------------------------------------------------------*/ function montarNoticias(){ par = true; for (i=0; i<long; i++){ _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]; if (par == true){ _root["caja"+i].colorcaja.setRGB(0xFFFFFF); _root["caja"+i].micolor = "0xFFFFFF"; 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,168,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].direc_url = urls[i]; _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; siguiente_y = 0; y_arriba = 0; for (i=long; i>0; i--){ if (_root["caja"+i]._y > 400){ siguiente_y = siguiente_y - _root["caja"+i]._height + 1; _root["caja"+i]._y = siguiente_y; } } moverNoticias(); } /*-------------------------------------------------------------------------------*/ /*--------------------- FUNCION PARA MOVER LAS NOTICIAS --------------------*/ /*-------------------------------------------------------------------------------*/ function moverNoticias(){ if (primera_vez == undefined){ _root.onEnterFrame = function(){ for (i=0; i<long; i++){ if (_root["caja"+i]._y > 400){ 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; } } primera_vez = false; } el_fondo.onEnterFrame = function(){ for (i=0; i<long; i++){ _root["caja"+i].onPress = function(){ getURL (this.direc_url, "_blank"); } _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; } } } }
  #2 (permalink)  
Antiguo 19/09/2008, 11:56
 
Fecha de Ingreso: agosto-2008
Mensajes: 6
Antigüedad: 15 años, 7 meses
Puntos: 0
Respuesta: news ticker + actionscript 2.0

proba con este man :)

Código:
function moverNoticias(){
   //Si es la primera vez que entra forzamos el movimiento
   if (primera_vez == undefined){
      
      _root.onEnterFrame = function(){
         for (i=0; i<long; i++){
            
            if (_root["caja"+i]._y < ( _root["caja"+i]._height * (-1) )){
               y_abajo = -10;

               //Calculamos donde hay que posicionar el clip que llega arriba
               for (j=0; j<long; j++){
                  
                  //Todos los clips que esten por debajo de 0
                  if (_root["caja"+j]._y > (-10)){
                     //Cogemos la posicion y que haya mas abajo
                     y_actual = _root["caja"+j]._y;
                     if (y_actual > y_abajo){
                        y_abajo = y_actual;
                        altura_abajo = _root["caja"+j]._height;
                     }
                  }
               }
               //Lo posicionamos abajo siendo esta posicion:
               //"y del clip actual" = "posicion del clip de mas abajo" + "alto del clip de mas abajo"
               _root["caja"+i]._y = y_abajo + altura_abajo - 1;

            }
            _root["caja"+i]._y -= 1;
         }
      }
      primera_vez = false;
   }
   /*-------------------------------------------------------------------------------*/
   
   
   //Si nos salimos de encima de las cajas se mueven
   el_fondo.onEnterFrame = function(){
      for (i=0; i<long; i++){
         //Si clicamos en la caja, vamos a la direccion "x"
         _root["caja"+i].onPress = function(){
            getURL (this.direc_url);
         }
         //Si nos ponemos encima de la caja, eliminamos el evento y se para
         _root["caja"+i].onRollOver = function(){
            //Iluminar
            this.colorcaja.setRGB(0xCDFBFE);
            delete _root.onEnterFrame;
         }
         //Si nos salimos de las cajas, se empieza a mover otra vez
         _root["caja"+i].onRollOut = function(){
            //Pintamos la caja con el color anterior
            this.colorcaja.setRGB(this.micolor);
            
            //Creamos el evento y se empiezan a mover las cajas
            _root.onEnterFrame = function(){
               for (i=0; i<long; i++){
                  
                  if (_root["caja"+i]._y < ( _root["caja"+i]._height * (-1) )){
                     y_abajo = -10;
      
                     //Calculamos donde hay que posicionar el clip que llega arriba
                     for (j=0; j<long; j++){
                        
                        //Todos los clips que esten por debajo de 0
                        if (_root["caja"+j]._y > (-10)){
                           //Cogemos la posicion y que haya mas abajo
                           y_actual = _root["caja"+j]._y;
                           if (y_actual > y_abajo){
                              y_abajo = y_actual;
                              altura_abajo = _root["caja"+j]._height;
                           }
                        }
                     }
                     //Lo posicionamos abajo siendo esta posicion:
                     //"y del clip actual" = "posicion del clip de mas abajo" + "alto del clip de mas abajo"
                     _root["caja"+i]._y = y_abajo + altura_abajo - 1;
      
                  }
                  _root["caja"+i]._y -= 1;
               }
            }
         }
      }
   }
   //Si nos ponemos encima destruimos el evento
   el_fondo.onRollOver = function(){
      delete _root.onEnterFrame;
   }
}
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 13:12.