Comunidad de diseño web y desarrollo en internet online

Sentido del noticiero XML + flash

Citar            
MensajeEscrito el 03 Sep 2007 09:56 am
Hola

Alguien saber que ha y que modificar den el noticiero XML para que el scroll lo haga hacia arriba y no hacia abajo

un saludo y gracias

Por anteOjO

1 de clabLevel



 

msie7
Citar            
MensajeEscrito el 05 Sep 2007 06:27 am
Pues eso que este es el codigo por si alguien le hace falta:

Código :

/*-------------------------------------------------------------------------------*/
/*---------------------   FUNCION PARA MONTAR LAS NOTICIAS    -------------------*/
/*-------------------------------------------------------------------------------*/
function montarNoticias(){
   par = true;
   for (i=0; i<long; i++){
      //Ponemos la caja
      _root.attachMovie ("caja_info","caja"+i,i*10);
      //Creamos el color
      _root["caja"+i].colorcaja = new Color(_root["caja"+i].fondo.fondocolor);
      //Le damos una altura igual a 16 por el numero de lineas que tenga
      _root["caja"+i].fondo._height = 16 * notis_puerto[i];
      
      //Pintamos la caja
      //if (par == true){
         //_root["caja"+i].colorcaja.setRGB(0xFFFFFF);
      //   _root["caja"+i].micolor = "0xEEEEEE";
      //   par = false;
      //}
      //else{
         _root["caja"+i].colorcaja.setRGB(0xFFFFFF);
         _root["caja"+i].micolor = "0xFFFFFF";
         par = true;
      //}
      
      //Si no existe altura, le damos 0 y asi se posiciona la primera caja
      //en y=0
      alturaTotal=0
      if (altura == undefined){
         altura = 0;
      }
      //Si existe, le damos una altura igual, a:
      //"altura acumulada" = "altura acumulada" + "altura anterior clip"
      else{
         altura = altura + _root["caja"+(i-1)].fondo._height + 1;//;
      }
      if(i==long-1) {
         alturaTotal = altura + _root["caja"+i].fondo._height;
      }
      //Posicionamos la caja
      _root["caja"+i]._x = 0;
      _root["caja"+i]._y = altura;
      
      //Creamos la caja de texto y ponemos sus propiedades
      _root["caja"+i].createTextField("texto_txt",i*37,2,1,270,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];
      
      //Atacheamos al texto la hoja CSS
      _root["caja"+i].texto_txt.styleSheet = estailo;
      
      //Ponemos el titulo
      _root["caja"+i].texto_txt.htmlText = "<p class='tit'>"+titulo[i];

      //Ponemos los textos de las noticias
      _root["caja"+i].texto_txt.htmlText += "<br><span class='txt'>"+noticias.firstChild.childNodes[i].firstChild+"</span></p>";
   }

   //Mostramos la pestañita
   //attachMovie("pestana","pestanita",2000);
   //pestanita._x = 0;
   //pestanita._y = 0;
   
   siguiente_y = 0;
   y_arriba = 0;
   
   //Posicionamos todos los clips por debajo de 330 sobre 0
   //Empezamos por el ultimo y vamos subiendo
   for (i=0; i<long; i++){
      if (_root["caja"+i]._y < 0){
         siguiente_y = siguiente_y + _root["caja"+i]._height + 1;//+ _root["caja"+i]._height
         _root["caja"+i]._y = siguiente_y;
      }
   }
   //stop();
   //Una vez esta todo montado movemos las noticias
   moverNoticias();
}

/*-------------------------------------------------------------------------------*/
/*---------------------   FUNCION PARA MOVER LAS NOTICIAS    --------------------*/
/*-------------------------------------------------------------------------------*/
function moverNoticias(){
   //Si es la primera vez forzamos el movimiento, si no empiezan paradas las cajas
   if (primera_vez == undefined){
      //Creamos el evento y se empiezan a mover las cajas
      _root.onEnterFrame = function(){
               for (i=0; i<long; i++){
                  //Si la caja llega a arriba del todo
                  if (_root["caja"+i]._y < 0 - _root["caja"+i]._height){
                     //Lo posicionamos abajo, siendo esta posicion:
                     //"y del clip actual" = "posicion del clip de mas abajo" - "altura del clip actual" + 1;
                     _root["caja"+i]._y = alturaTotal  - _root["caja"+i]._height + 1;
                  }
                  //Hacemos que vayan subiendo las cajas
                  _root["caja"+i]._y += -1;
               }
      }
      primera_vez = false;
   }
   /***************************************************************************/
   
   
   //"el_fondo" controla a cada fotograma si estamos o no encima de las noticias
   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, "_self");
         }
         //Si nos ponemos encima de la caja, eliminamos el evento y se para
         _root["caja"+i].onRollOver = function(){
            //Iluminar
            this.colorcaja.setRGB(0xF3F4F5);
            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++){
                  //Si la caja llega a arriba del todo
                  if (_root["caja"+i]._y < 0 - _root["caja"+i]._height){
                     //Lo posicionamos abajo, siendo esta posicion:
                     //"y del clip actual" = "posicion del clip de mas abajo" - "altura del clip actual" + 1;
                     _root["caja"+i]._y = alturaTotal  - _root["caja"+i]._height + 1;
                  }
                  //Hacemos que vayan subiendo las cajas
                  _root["caja"+i]._y += -1;
               }
            }
         }
      }
   }
}

Por anteOjO

1 de clabLevel



 

msie7
Citar            
MensajeEscrito el 06 Sep 2007 10:50 pm
dame un par de dias trabajare en ello, lo que se es que hay que substituir valores 1 por -1 sin embargo el inicio de carga es ta debajo, deja investico como hacer que la carga sea en el titular o arriba, pues de lo contrario solo saldra una vez y no volvera a salir :

Por pacojal

1 de clabLevel



 

msie
Citar            
MensajeEscrito el 18 Dic 2007 07:53 pm
HOLA AQU ILES DEJO EL CODIGO DEL NOTICIERO XML DESPUES DE RENEGAR UN POCO PUDE SACRLO Y QUE VAYA AL REVEZ. POR AHI LEI ALGUIEN Q DIJO Q NO SE PODIA, PERO PUES EN REALIDAD TODO SE PUEDE, SOLO HAY QUE SER UN POCO CABEZA DURA Y NO DEJARSE GANAR, JAJAJA

EL CODIGO:

stop();
System.useCodepage = true;
//Cargar XML de las noticias
noticias = new XML();
noticias.ignoreWhite = true;
noticias.onLoad = function (){

//Porcentajes y esas cosas
totalxml = noticias.getBytesTotal();
cargadoxml = noticias.getBytesLoaded();
porcentajexml = Math.round((cargadoxml/totalxml)*100);

//Si esta cargado del todo
if (porcentajexml >= 100) {
//Borramos el cargando
removeMovieClip(cargando);

//Shortcuts del XML
notis_puerto = new Array();
text_noticia = new Array();
titulo = new Array();
urls = new Array();

//Cogemos el numero de noticias
long = noticias.firstChild.firstChild.childNodes.length;
cargarCSS();
}
}

//Atacheamos y posicionamos el "cargando xml"
attachMovie("carga_xml","cargando",2);
cargando._x = 45;
cargando._y = 94;

//Atacheamos la linea de abajo del todo
attachMovie("linea","linea_abajo",5000);
linea_abajo._x = 0;
linea_abajo._y = 400;

//Atacheamos la caja de fondo

//Cargamos XML
noticias.load("http://www.lavoz.com.ar/Rss/Rss.asp?origen=1");


/*-------------------------------------------------------------------------------*/
/*--------------------- FUNCION PARA CARGAR LA HOJA CSS --------------------*/
/*-------------------------------------------------------------------------------*/
function cargarCSS(){
//Creamos la hoja de estilo
estailo = new TextField.StyleSheet();

//Cuando este cargando...
estailo.onLoad = function(){

//Porcentajes y esas cosas
totalcss = estailo.getBytesTotal();
cargadocss = estailo.getBytesLoaded();
porcentajecss = Math.round((cargadocss/totalcss)*100);

//Si esta cargado del todo
if (porcentajecss >= 100) {
//Borramos el cargando
removeMovieClip(cargando2);

//Una vez esta cargada la CSS ya podemos saber cuantas lineas hay
//por cada caja de texto

//Creamos un clip y un campo de texto temporales
_root.createEmptyMovieClip("temp_mc", 7);

//Al campo de texto le ponemos el mismo tamaño de ancho que va a haber en
//el de verdad. Le ponemos alto 16, que es lo que mide una linea. Así
//podemos saber el número de líneas que tenemos.
temp_mc.createTextField ("notis_txt",8,-150,-20,210,16);

//Ponemos las propiedades a nuestro campo de texto nuevo
temp_mc.notis_txt.multiline = true;
temp_mc.notis_txt.wordWrap = true;
temp_mc.notis_txt.html = true;
cant=0;
for (i=13; i<long; i++){
//Cogemos los titulos de las noticias
titulo[cant] = noticias.firstChild.firstChild.childNodes[i].childNodes[0].firstChild.nodeValue;

//Cogemos las urls de las noticias
urls[cant] = noticias.firstChild.firstChild.childNodes[i].childNodes[1].firstChild.nodeValue;
text_noticia[cant]=noticias.firstChild.firstChild.childNodes[i].childNodes[4].firstChild.nodeValue;
//Cogemos el texto y lo ponemos en la caja de texto temporal
temp_mc.notis_txt.htmlText = "<p class='tit'>"+titulo[cant]+"</p><br><p class='txt'>"+text_noticia[cant]+"</p>";

//Cogemos el numero de lineas por texto
notis_puerto[cant] = temp_mc.notis_txt.maxscroll-1;
cant++;
}
//Eliminamos el clip temporal
removeMovieClip(_root["temp_mc"]);
//Montamos las noticias
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<cant; i++){
//Ponemos la caja
_root.attachMovie ("caja_info","caja"+i,i*10);
//Creamos el color
_root["caja"+i].colorcaja = new Color(_root["caja"+i].fondo.fondocolor);
//Le damos una altura igual a 16 por el numero de lineas que tenga
_root["caja"+i].fondo._height = 16 * notis_puerto[i];

//Pintamos la caja
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;
}

//Si no existe altura, le damos 0 y asi se posiciona la primera caja
//en y=0
if (altura == undefined){
altura = 0;
}
//Si existe, le damos una altura igual, a:
//"altura acumulada" = "altura acumulada" + "altura anterior clip"
else{
altura = altura + _root["caja"+(i-1)].fondo._height;
}

//Posicionamos la caja
_root["caja"+i]._x = 0;
_root["caja"+i]._y = altura;

//Creamos la caja de texto y ponemos sus propiedades
_root["caja"+i].createTextField("texto_txt",i*37,2,1,210,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];

//Atacheamos al texto la hoja CSS
_root["caja"+i].texto_txt.styleSheet = estailo;

//Ponemos el titulo
_root["caja"+i].texto_txt.htmlText = "<p class='tit'>"+titulo[i]+"</p><br>";

//Ponemos los textos de las noticias
_root["caja"+i].texto_txt.htmlText += "<p class='txt'>"+text_noticia[i]+"</p>";
}
//Mostramos la pestañita
attachMovie("pestana","pestanita",2000);
pestanita._x = 0;
pestanita._y = 0;

siguiente_y = 0;
y_arriba = 0;

//Posicionamos todos los clips por debajo de 330 sobre 0
//Empezamos por el ultimo y vamos subiendo
for (i=long; i>0; i--){
if (_root["caja"+i]._y < 0){
//siguiente_y = siguiente_y + _root["caja"+i]._height + 1;
//_root["caja"+i]._y = siguiente_y;
}
}

//Una vez esta todo montado movemos las noticias
moverNoticias();
}

/*-------------------------------------------------------------------------------*/
/*--------------------- FUNCION PARA MOVER LAS NOTICIAS --------------------*/
/*-------------------------------------------------------------------------------*/
function moverNoticias(){
//Si es la primera vez forzamos el movimiento, si no empiezan paradas las cajas
if (primera_vez == undefined){
//Creamos el evento y se empiezan a mover las cajas
_root.onEnterFrame = function(){

for (i=0; i<cant; i++){

if (_root["caja"+i]._y < -_root["caja"+i]._height){
y_arriba = -_root["caja"+i]._height;

for (j=0; j<cant; j++){

if (_root["caja"+j]._y >0){

y_actual = _root["caja"+j]._y;
if (y_actual > y_arriba){
y_arriba = y_actual+_root["caja"+j]._height-_root["caja"+i]._height;
}
}
}

_root["caja"+i]._y = y_arriba + _root["caja"+i]._height + 1;
}

_root["caja"+i]._y -= 1;
}
}
primera_vez = false;
}
/***************************************************************************/


//"el_fondo" controla a cada fotograma si estamos o no encima de las noticias
el_fondo.onEnterFrame = function(){
for (i=0; i<cant; i++){
//Si clicamos en la caja, vamos a la direccion "x"
_root["caja"+i].onPress = function(){
getURL (this.direc_url, "_blank");
}
//Si nos ponemos encima de la caja, eliminamos el evento y se para
_root["caja"+i].onRollOver = function(){
//Iluminar
this.colorcaja.setRGB(0xA4D8E3);
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<cant; i++){

if (_root["caja"+i]._y < -_root["caja"+i]._height){
y_arriba = -_root["caja"+i]._height;
for (j=0; j<cant; j++){

if (_root["caja"+j]._y > 0){
y_actual = _root["caja"+j]._y;
if (y_actual > y_arriba){
y_arriba = y_actual+_root["caja"+j]._height-_root["caja"+i]._height;
}
}
}

_root["caja"+i]._y = y_arriba + _root["caja"+i]._height + 1;
}
_root["caja"+i]._y -= 1;
}
}
}
}
}
}

Por adriango

1 de clabLevel



Genero:Masculino  

msie7
Citar            
MensajeEscrito el 30 Ene 2008 11:56 pm
Y si quiero que la dirección sea de derecha a izquierda para que una vez modificada la forma sirva como barra de información?

Por Cedric

6 de clabLevel



 

msie
Citar            
MensajeEscrito el 03 Feb 2008 05:55 pm
tendras que cambiar el eje en ves de _y por _x

Por rodrigo.art

56 de clabLevel



 

Argentina

firefox
Citar            
MensajeEscrito el 26 Feb 2008 04:10 pm
Alguien que pueda pegar el código en limpio. No funciona ninguno de los que aparecen. En ambos casos se ve mal el diseño y en uno, a pesar de que funciona, el flash detecta errores de sintaxis.
Gracias.
Fernando

Por GF78

1 de clabLevel



Genero:Masculino  

firefox
Citar            
MensajeEscrito el 19 May 2008 01:12 pm
[QUOTE=\"GF78\"]Alguien que pueda pegar el código en limpio. No funciona ninguno de los que aparecen. En ambos casos se ve mal el diseño y en uno, a pesar de que funciona, el flash detecta errores de sintaxis.
Gracias.
Fernando[/QUOTE]El código que coloco a continuación nos funcionó a la perfección en la empresa para manejar en orden inverso las noticias, espero lo aprovechen. En el fotograma que lo quieran activar solamente es cuestión de: montarNoticias();

//Cargar XML de las noticias
noticias = new XML();
noticias.ignoreWhite = true;
noticias.onLoad = function (){

//Porcentajes y esas cosas
totalxml = noticias.getBytesTotal();
cargadoxml = noticias.getBytesLoaded();
porcentajexml = Math.round((cargadoxml/totalxml)*100);

//Si esta cargado del todo
if (porcentajexml >= 100) {
//Borramos el cargando
removeMovieClip(cargando);

//Shortcuts del XML
notis_puerto = new Array();
titulo = new Array();
urls = new Array();

//Cogemos el numero de noticias
long = noticias.firstChild.childNodes.length;


cargarCSS();
}
}

//Atacheamos y posicionamos el \"cargando xml\"
attachMovie(\"carga_xml\",\"cargando\",2);
cargando._x = 45;
cargando._y = 94;

//Atacheamos la linea de abajo del todo
attachMovie(\"linea\",\"linea_abajo\",5000);
linea_abajo._x = 0;
linea_abajo._y = 329;

//Atacheamos la caja de fondo

//Cargamos XML
noticias.load(\"noticias.xml\");


/*-------------------------------------------------------------------------------*/
/*--------------------- FUNCION PARA CARGAR LA HOJA CSS --------------------*/
/*-------------------------------------------------------------------------------*/
function cargarCSS(){
//Creamos la hoja de estilo
estailo = new TextField.StyleSheet();

//Cuando este cargando...
estailo.onLoad = function(){

//Porcentajes y esas cosas
totalcss = estailo.getBytesTotal();
cargadocss = estailo.getBytesLoaded();
porcentajecss = Math.round((cargadocss/totalcss)*100);

//Si esta cargado del todo
if (porcentajecss >= 100) {
//Borramos el cargando
removeMovieClip(cargando2);

//Una vez esta cargada la CSS ya podemos saber cuantas lineas hay
//por cada caja de texto

//Creamos un clip y un campo de texto temporales
_root.createEmptyMovieClip(\"temp_mc\", 7);

//Al campo de texto le ponemos el mismo tamaño de ancho que va a haber en
//el de verdad. Le ponemos alto 16, que es lo que mide una linea. Así
//podemos saber el número de líneas que tenemos.
temp_mc.createTextField (\"notis_txt\",400,-260,1,490,16);

//_root[\"caja\"+i].createTextField(\"texto_txt\",i*37,-260,1,490,16 * notis_puerto[i]);

//Ponemos las propiedades a nuestro campo de texto nuevo
temp_mc.notis_txt.multiline = true;
temp_mc.notis_txt.wordWrap = true;
temp_mc.notis_txt.html = true;

for (i=0; i<long; i++){
//Cogemos los titulos de las noticias
titulo[i] = noticias.firstChild.childNodes[i].attributes.titulo;

//Cogemos las urls de las noticias
urls[i] = noticias.firstChild.childNodes[i].attributes.urls;

//Cogemos el texto y lo ponemos en la caja de texto temporal
temp_mc.notis_txt.htmlText = \"<p class=\'tit\'>\"+titulo[i]+\"</p><br><p class=\'txt\'>\"+noticias.firstChild.childNodes[i].firstChild+\"</p>\";

//Cogemos el numero de lineas por texto
notis_puerto[i] = temp_mc.notis_txt.maxscroll-1;
}
//Eliminamos el clip temporal
removeMovieClip(_root[\"temp_mc\"]);
//Montamos las noticias
//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++){
//Ponemos la caja
var m:MovieClip = _root.attachMovie (\"caja_info\",\"caja\"+i,i*10);
_global.vector[i] = m;
//Creamos el color
_root[\"caja\"+i].colorcaja = new Color(_root[\"caja\"+i].fondo.fondocolor);
//Le damos una altura igual a 16 por el numero de lineas que tenga
_root[\"caja\"+i].fondo._height = 16 * notis_puerto[i];

//Pintamos la caja
if (par == true){
_root[\"caja\"+i].colorcaja.setRGB(0xEEEEEE);
_root[\"caja\"+i].micolor = \"0xEEEEEE\";
par = false;
}
else{
_root[\"caja\"+i].colorcaja.setRGB(0x000000);
_root[\"caja\"+i].micolor = \"0x000000\";
par = true;
}
//Si no existe altura, le damos 0 y asi se posiciona la primera caja
//en y=0
if (altura == undefined){
altura = 0;
}
//Si existe, le damos una altura igual, a:
//\"altura acumulada\" = \"altura acumulada\" + \"altura anterior clip\"
else{
altura = altura + _root[\"caja\"+(i-1)].fondo._height;
}

if(altura > 0){
}
else{
altura = 0;
primera_vez = null;
}


//Posicionamos la caja
_root[\"caja\"+i]._x = 280;
_root[\"caja\"+i]._y = altura;


//Creamos la caja de texto y ponemos sus propiedades
_root[\"caja\"+i].createTextField(\"texto_txt\",i*37,60,1,450,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];

//Atacheamos al texto la hoja CSS
_root[\"caja\"+i].texto_txt.styleSheet = estailo;

//Ponemos el titulo
_root[\"caja\"+i].texto_txt.htmlText = \"<p class=\'tit\'>\"+titulo[i]+\"</p><br>\";

//Ponemos los textos de las noticias
_root[\"caja\"+i].texto_txt.htmlText += \"<p class=\'txt\'>\"+noticias.firstChild.childNodes[i].firstChild+\"</p>\";

//m.removeMovieClip();
}

//Mostramos la pestañita
attachMovie(\"pestana\",\"pestanita\",2000);
pestanita._x = 0;
pestanita._y = 0;

siguiente_y = 0;
y_arriba = 100;

//Posicionamos todos los clips por debajo de 330 sobre 0
//Empezamos por el ultimo y vamos subiendo
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;
}
}

//Montar la primera noticia en la parte final del formulario
for(i=0;i<long;i++){
if(i==0){
valorY = _root[\"caja\"+(i)]._height;
valorY = 330 ;
_root[\"caja\"+i]._y = valorY;
}
else{
_root[\"caja\"+i]._y = 5000; //Valor muy grande para que no se vean
}


}
//Una vez esta todo montado movemos las noticias
moverNoticias();
}

/*-------------------------------------------------------------------------------*/
/*--------------------- FUNCION PARA MOVER LAS NOTICIAS --------------------*/
/*-------------------------------------------------------------------------------*/
function moverNoticias(){
primeraVuelta = true;
indiceMayor = long - 1;
valorAux = 0;
//Si es la primera vez forzamos el movimiento, si no empiezan paradas las cajas
if (primera_vez == undefined){
//Creamos el evento y se empiezan a mover las cajas
_root.onEnterFrame = function(){
for (i=0; i<long; i++){

_root[\"caja\"+i]._y = _root[\"caja\"+i]._y - 1;

if(_root[\"caja\"+i]._y + _root[\"caja\"+i]._height < 0){
//Colocar al final, detras del ultimo que actua como final
//por ese con la yMayor llevamos la posicion del ultimo final
yMayor = _root[\"caja\"+(indiceMayor)]._y + _root[\"caja\"+i]._height + 1;
indiceMayor = i;
// _root[\"caja\"+0]._y = yMayor;
}
if(_root[\"caja\"+(long-1)]._y <=330 && _root[\"caja\"+(long-1)]._y > 0){
//El ultimo esta mostrandose, hay que mover al primero si no esta mostrandose
if(_root[\"caja\"+(0)]._y >=330 or _root[\"caja\"+(0)]._y < 0){
valorAux = _root[\"caja\"+(long-1)]._y + _root[\"caja\"+(long-1)]._height + 1;
if(valorAux <= 330){
_root[\"caja\"+(0)]._y = valorAux;
}
}
}
if(i > 0 && primeraVuelta){
alturaSiguiente = _root[\"caja\"+(i-1)]._y + _root[\"caja\"+(i-1)]._height + 1;
//La altura no debe asignarse si la y del (i+1) o sea del proximo a asignar
//es menor, ya que indica que se está visualizando
//el 5000 garantiza que no se esta visualizando

//Si no se esta mostrando
if(_root[\"caja\"+(i)]._y > 330 || _root[\"caja\"+(i)]._y < 0){
if(alturaSiguiente <= 330 ){
//Puedo salir
_root[\"caja\"+(i)]._y = alturaSiguiente ;
}
else{
_root[\"caja\"+(i)]._y = 5000; //Valor grande
}
}
}
}
//El ultimo lo hace sobre el primero siempre y cuando
}
primera_vez = false;
}
/***************************************************************************/


//\"el_fondo\" controla a cada fotograma si estamos o no encima de las noticias
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, \"_blank\");
_root.gotoAndPlay (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++){
_root[\"caja\"+i]._y = _root[\"caja\"+i]._y - 1;

if(_root[\"caja\"+i]._y + _root[\"caja\"+i]._height < 0){
//Colocar al final, detras del ultimo que actua como final
//por ese con la yMayor llevamos la posicion del ultimo final
yMayor = _root[\"caja\"+(indiceMayor)]._y + _root[\"caja\"+i]._height;
indiceMayor = i;
// _root[\"caja\"+0]._y = yMayor;
}
if(_root[\"caja\"+(long-1)]._y <=330 && _root[\"caja\"+(long-1)]._y > 0){
//El ultimo esta mostrandose, hay que mover al primero si no esta mostrandose
if(_root[\"caja\"+(0)]._y >=330 or _root[\"caja\"+(0)]._y < 0){
valorAux = _root[\"caja\"+(long-1)]._y + _root[\"caja\"+(long-1)]._height + 1;
if(valorAux <= 330){
_root[\"caja\"+(0)]._y = valorAux;
}
}
}
if(i > 0 && primeraVuelta){
alturaSiguiente = _root[\"caja\"+(i-1)]._y + _root[\"caja\"+(i-1)]._height + 1;
//La altura no debe asignarse si la y del (i+1) o sea del proximo a asignar
//es menor, ya que indica que se está visualizando
//el 5000 garantiza que no se esta visualizando

//Si no se esta mostrando
if(_root[\"caja\"+(i)]._y > 330 || _root[\"caja\"+(i)]._y < 0){
if(alturaSiguiente <= 330 ){
//Puedo salir
_root[\"caja\"+(i)]._y = alturaSiguiente ;
}
else{
_root[\"caja\"+(i)]._y = 5000; //Valor grande
}
}
}
}
}
}
}
}
}

/*-------------------------------------------------------------------------------*/
/*--------------------- FUNCION PARA REMOVER LAS NOTICIAS --------------------*/
/*-------------------------------------------------------------------------------*/

function removerNoticias(){
par = true;
for (i=0; i<long; i++){
//Ponemos la caja
var m:MovieClip = _root.attachMovie (\"caja_info\",\"caja\"+i,i*10);
_global.vector[i] = m;
//Creamos el color
_root[\"caja\"+i].colorcaja = new Color(_root[\"caja\"+i].fondo.fondocolor);
//Le damos una altura igual a 16 por el numero de lineas que tenga
_root[\"caja\"+i].fondo._height = 16 * notis_puerto[i];

//Pintamos la caja
if (par == true){
_root[\"caja\"+i].colorcaja.setRGB(0xEEEEEE);
_root[\"caja\"+i].micolor = \"0xEEEEEE\";
par = false;
}
else{
_root[\"caja\"+i].colorcaja.setRGB(0x000000);
_root[\"caja\"+i].micolor = \"0x000000\";
par = true;
}

//Si no existe altura, le damos 0 y asi se posiciona la primera caja
//en y=0
if (altura == undefined){
altura = 0;
}
//Si existe, le damos una altura igual, a:
//\"altura acumulada\" = \"altura acumulada\" + \"altura anterior clip\"
else{
altura = altura + _root[\"caja\"+(i-1)].fondo._height;
}

//Posicionamos la caja
_root[\"caja\"+i]._x = 280;
_root[\"caja\"+i]._y = altura;


//Creamos la caja de texto y ponemos sus propiedades
_root[\"caja\"+i].createTextField(\"texto_txt\",i*37,60,1,450,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];

//Atacheamos al texto la hoja CSS
_root[\"caja\"+i].texto_txt.styleSheet = estailo;

//Ponemos el titulo
_root[\"caja\"+i].texto_txt.htmlText = \"<p class=\'tit\'>\"+titulo[i]+\"</p><br>\";

//Ponemos los textos de las noticias
_root[\"caja\"+i].texto_txt.htmlText += \"<p class=\'txt\'>\"+noticias.firstChild.childNodes[i].firstChild+\"</p>\";

m.removeMovieClip();
}
}


:cool:

Por Carladind

0 de clabLevel



Genero:Femenino  

firefox
Citar            
MensajeEscrito el 21 May 2008 02:27 pm
Hola y saludos a todos

Estoy en el proceso de aprender ActionScript, sobre todo para trabajar con archivos externos (xml, php, css)... He intentado usar el codigo que publico Carladind, pero no he tenido exito, de hecho no tengo nada en pantalla.

Estoy usando un .xml de un rss, y modifique los nombres de las variables para que se cargara correctamente, hice un archivo .css para darle formato, pero aun no tengo nada.

Seria mucho pedir si publican los contenidos de esos archivos?, solo la estructura si quieren para guiarme y ver cual es mi error.

Muchas gracias de Antemano,

Saludos!

Mary De Nobrega

Por marydn

0 de clabLevel



Genero:Femenino  

firefox
Citar            
MensajeEscrito el 28 Jun 2008 04:15 pm
He intentado cambiar el sentido del noticiero, pero no hay manera. El codigo que está puesto no me funciona.

Puedes simplificar lo que se necesita cambiar del codigo original para obtener el sentido inverso.

Para modificar solo lo necesario.

Gracias.

Por oscarmarpez

0 de clabLevel



Genero:Masculino  

msie

 

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