Comunidad de diseño web y desarrollo en internet online

Error en mi galeria

Citar            
MensajeEscrito el 29 May 2008 12:53 pm
Hola gente,
les comento tengo una galeria, que no me respeta el orden de las imagenes que pongo en el XML. Aqui les dejo el codigo:

Código :

function init()
{
    System.useCodepage = true;
    main_xml = new XML();
    main_xml.ignoreWhite = true;
    mainInfo = [];
    main_xml.onLoad = function ()
    {
        totalNum = this.childNodes.length - 1;
        for (var _loc4 = 0; _loc4 < totalNum; ++_loc4)
        {
            mainInfo[_loc4] = new Object();
            var _loc3 = this.childNodes[_loc4].childNodes;
            for (var _loc7 in _loc3)
            {
                var _loc5 = _loc3[_loc7].childNodes.length;
                mainInfo[_loc4][_loc3[_loc7].nodeName] = _loc3[_loc7].attributes.value;
            } // end of for...in
        } // end of for
        var _loc6 = this.childNodes[totalNum].attributes;
        for (var _loc8 in _loc6)
        {
            _root[_loc8] = Number(_loc6[_loc8]);
        } // end of for...in
        nextFrame ();
    };
    main_xml.load("novedades.xml");
} // End of the function
function loadThumb(mc, no)
{
    mc.screen.loadMovie(mainInfo[no].thumbURL);
    mc.txtSubName = mainInfo[no].subName;
} // End of the function
function loadImage(no)
{
    mainImg.txtName = mainInfo[no].name;
    mainImg.txtContent = "";
    openNum = no;
    str = mainInfo[no].content;
    i = -1;
    mainImg.screen.loadMovie(mainInfo[no].imageURL);
    mainImg.onEnterFrame = function ()
    {
        if (++i < str.length)
        {
            this.txtContent = this.txtContent + str.charAt(i);
        } // end if
        if (i == str.length)
        {
            delete this.onEnterFrame;
        } // end if
    };
} // End of the function
function moveNext()
{
    for (var _loc2 = 0; _loc2 < len; ++_loc2)
    {
        var _loc1 = thumbBlock["thumbImg" + _loc2];
        if (_loc1.targetY == -spaceY)
        {
            _loc1._y = _loc1.targetY = spaceY * showNum;
            _loc1.no = setNumber(_loc1.no, totalNum);
            loadThumb(_loc1, _loc1.no);
            continue;
        } // end if
        _loc1.targetY = _loc1.targetY - spaceY;
    } // end of for
} // End of the function
function movePrev()
{
    for (var _loc2 = 0; _loc2 < len; ++_loc2)
    {
        var _loc1 = thumbBlock["thumbImg" + _loc2];
        if (_loc1.targetY == spaceY * showNum)
        {
            _loc1._y = _loc1.targetY = -spaceY;
            _loc1.no = setNumber(_loc1.no, totalNum);
            loadThumb(_loc1, _loc1.no);
            continue;
        } // end if
        _loc1.targetY = _loc1.targetY + spaceY;
    } // end of for
} // End of the function
function setNumber(num, total)
{
    if (isNext == true)
    {
        if (num == total - 1)
        {
            num = 0;
        }
        else
        {
            ++num;
        } // end else if
    }
    else if (num == 0)
    {
        num = total - 1;
    }
    else
    {
        --num;
    } // end else if
    return (num);
} // End of the function
this.stop();
init();


y la pueden ver en www.merchandisingweb.com.ar/test en la seccion novedades.

GRacias por su tiempo!

Por pelao

18 de clabLevel



 

msie
Citar            
MensajeEscrito el 29 May 2008 03:10 pm
Si te lo pone al revés, pon las cosas al revés en el XML, tiene una estructura de datos mainInfo[] (que no se refleja en el código que posteaste) que me hace sospechar que el XML es complejito y largo

Jorge

Por solisarg

BOFH

13669 de clabLevel

4 tutoriales
5 articulos

Genero:Masculino   Bastard Operators From Hell Premio_Secretos

Argentina

firefox
Citar            
MensajeEscrito el 29 May 2008 03:16 pm
En realidad no es que me los pone al reves, no matiene un orden logico, es como si fuera un random...el xml tiene esta estructura:

Código :

<product>
   <name value="Insert title text" />
   <subName value="Insert title text for thumb image" />
              <content value="Insert description"/
   <content value="thumb image path" />
   <imageURL value="Insert large image path" />
</product>
If no properties leave ("") blank as <title value="" />    <<<<blank on "" /
To add more images add code block <product></product>
 //////////////////////////////////////////////////////////////////////////////////////////See bottom portion <option />
<option
showNum="3"////////Number of images show on scroller(MovieClip)
xThumb="400"//////Scroller X cordinates
yThumb="70"//////Scroller X cordinates
ySpaceThumb="10"//////Space between thumb images
thumbXsize="187"//////Thumb image widths
thumbYsize="83"//////Thumb image heights
maskMargin="2"//////Mask margin
loadSpeed="8"//////Speed
/>


gracias

Por pelao

18 de clabLevel



 

msie
Citar            
MensajeEscrito el 29 May 2008 03:28 pm
aunque creo que el error esta aqui:

Código :

isNext = true;
spaceY = thumbYsize + ySpaceThumb;
thumbBlock._x = 290;
thumbBlock._y = 200;
mask._x = 290 - maskMargin;
mask._y = 195 - maskMargin;
mask._width = thumbXsize + maskMargin * 2;
mask._height = spaceY * showNum + maskMargin * 2;
thumbBlock.setMask(mask);
k = i = 0;
len = showNum + 2;
openNum = 0;
while (k < len)
{
    var _mc = thumbBlock.thumbImg.duplicateMovieClip("thumbImg" + k, k);
    _mc.targetY = spaceY * k;
    _mc._y = -50 * k;
    _mc.no = i;
    loadThumb(_mc, _mc.no);
    if (k == showNum + 1)
    {
        _mc._y = _mc.targetY = -spaceY;
        _mc.no = i = totalNum - 1;
        loadThumb(_mc, _mc.no);
    } // end if
    if (i == totalNum - 1)
    {
        i = 0;
    }
    else
    {
        ++i;
    } // end else if
    _mc.onRollOver = function ()
    {
        timer.gotoAndStop(1);
    };
    _mc.onRollOut = function ()
    {
        timer.play();
    };
    _mc.onRelease = function ()
    {
        if (this.no != openNum)
        {
            loadImage(this.no);
        } // end if
    };
    _mc.onEnterFrame = function ()
    {
        this._y = this._y + 2.000000E-001 * (this.targetY - this._y);
    };
    ++k;
} // end while
nextBtn.onRelease = function ()
{
    isNext = true;
    moveNext();
    timer.gotoAndPlay(1);
};
prevBtn.onRelease = function ()
{
    isNext = false;
    movePrev();
    timer.gotoAndPlay(1);
};
thumbBlock.thumbImg._visible = false;
loadImage(openNum);

Por pelao

18 de clabLevel



 

msie

 

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