# Tween doesn't loop

**URL:** <https://forum.kirupa.com/t/tween-doesnt-loop/214806>\
**Category:** Uncategorized\
**Created:** [February 1, 2007, 4:54am UTC](https://forum.kirupa.com/t/tween-doesnt-loop/214806 "2007-02-01T04:54:28Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![qpixo](https://avatars.discourse-cdn.com/v4/letter/q/c4cdca/32.png) [@qpixo](https://forum.kirupa.com/u/qpixo)\
**Post date:** [February 1, 2007, 4:54am UTC](https://forum.kirupa.com/t/tween-doesnt-loop/214806/1 "2007-02-01T04:54:28Z")

</div>

I’m trying to use the tween effect applying in my code but I can’t make the loop working. It’s doesn’t loop back at all but only show me once the dissappear.  
Does anyone know how to make that work??

Here’s my code:

import mx.transitions.Tween;  
import mx.transitions.easing.\*;

var lexml = new XML();  
var chemin = “…/xml/”;

lexml.ignoreWhite = true;  
lexml.onLoad = loaderXML;  
lexml.load(chemin+“company.xml”);

function loaderXML(loaded) {  
var racine = this.firstChild;  
var nb\_elements = racine.childNodes.length;

```
if (loaded) {
    for(i=0;i&lt;nb_elements;i++) {
        
        var company_name = racine.childNodes*.attributes;
        var item = _root.attachMovie("company", "item"+i, i);
        var cote_gauche = _root["item"+(i-1)].nom_txt._x;     
        var profondeur_mc = _root["item"+(i-1)].nom_txt._width;     
        
        item.nom_txt.text = company_name.id;
        item.nom_txt.autoSize = "left";    
        
        // Positionning
        item.nom_txt._x = 0;
        item.nom_txt._x = cote_gauche + profondeur_mc + 20;
        item.nom_txt._y = 20;
    

        var xPosT:Tween = new Tween(item, "_x", None.easeOut, Stage.width, -360, 3, true);
        xPosT.onMotionFinished = function() {
            this.continueTo();
        };
    }
} else {
    text_area.text = "Can NOT load the images request. Please make sure you have right path...";
}

```

}
