Note that there are some explanatory texts on larger screens.

plurals
  1. POAutomatic Scroll of Images through an XML
    text
    copied!<p>I have the following scrip below, where I call some images through an XML, and create a gallery that every 3 seconds it moves to left, passing the pictures automatically. But my images are of different sizes in width, the height is the same.</p> <pre> var dados:XML = new XML(); dados.ignoreWhite = true; dados.load("xml/" + _root.xmlport); dados.onLoad = function():Void { qtd = this.childNodes[0].childNodes.length; _root.qualqtd = this.childNodes[0].childNodes.length; for (j = 0; j @= qtd; j++) { mcPanels.item_mc.duplicateMovieClip("item_mc" + j,mcPanels.getNextHighestDepth()); mcPanels["item_mc" + j].imagem = this.childNodes[0].childNodes[j].childNodes[0].attributes.imagem; mcPanels["item_mc" + j].tamanho = this.childNodes[0].childNodes[j].childNodes[1].attributes.tamanhofoto; mcPanels["item_mc" + j].foto.loadMovie(mcPanels["item_mc" + j].imagem); mcPanels["item_mc" + j]._x = j * mcPanels["item_mc" + j].tamanho; mcPanels["item_mc" + j]._y = 0; } }; var i:Number = 0; var easing:Number = 0.2; var clipNum:Number = _root.qualqtd; var myInterval = setInterval(moveIt, 3000); var dir:Number = 1; function moveIt() { if (dir == 1) { targX = Math.floor(mcPanels._x - 450); i++; if (i == clipNum) { dir = -dir; } } else if (dir == -1) { targX = Math.floor(mcPanels._x + 450); i--; if (i == 0) { dir = -dir; } } onEnterFrame = function () { var dx:Number = Math.floor(targX - mcPanels._x); mcPanels._x += dx * easing; if (Math.abs(dx) @ .5) { mcPanels._x = targX; delete onEnterFrame; } }; } </pre> <p>How can I make this script get the size of each image and move according to its width? My XML looks like:</p> <pre><code> menu item fotoevento imagem='portfolio/15anos/15anos_01.jpg'/ tamanhofoto tamanhofoto='100'/ /item item fotoevento imagem='portfolio/15anos/15anos_02.jpg'/ tamanhofoto tamanhofoto='50'/ /item item fotoevento imagem='portfolio/15anos/15anos_03.jpg'/ tamanhofoto tamanhofoto='100'/ /item /menu </code></pre> <p>Has a value of 450 which is the value that I put to him move, I know it is there that should change, but do not know how ....</p> <p>Can someone help me?</p> <p><strong>on script where is @ its &lt;</strong> </p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload