# Can we apply setMask() with this?

**URL:** https://forum.kirupa.com/t/can-we-apply-setmask-with-this/213318
**Category:** Uncategorized
**Created:** [January 18, 2007, 5:38pm UTC](https://forum.kirupa.com/t/can-we-apply-setmask-with-this/213318 "2007-01-18T17:38:12Z")
**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: [January 18, 2007, 5:38pm UTC](https://forum.kirupa.com/t/can-we-apply-setmask-with-this/213318/1 "2007-01-18T17:38:12Z")

</div>

I’m trying to apply a mask while loading my xml file but I can’t make the mask working from right to left side.  
Does anyone know how to apply a mask?

Here’s my code:

var lexml = new XML();  
var chemin = “…/xml/”;  
var tab\_images = new Array();

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

// Permet de loader le fichier 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);
        item.nom_txt.text = company_name.id;
        item.nom_txt.autoSize = "center";    
        
        // Positionning space
        var cote_gauche = _root["item"+(i-1)].nom_txt._x;     
        var profondeur_mc = _root["item"+(i-1)].nom_txt._width;     
        //trace("Item "+left_space+ " Width " +mc_width);
        item.nom_txt._x = 0;
        item.nom_txt._x = cote_gauche + profondeur_mc + 20;
        item.nom_txt._y = 20;
        //trace(item);
        item.setMask(affecter_mask());
    }
} else {
    text_area.text = "Can NOT load the images request. Please make sure you have right path...";
}

```

}

function affecter\_mask() {  
var mask = \_root.attachMovie(“mask\_area\_mc”,“mask”, this.getNextHighestDepth());

```
mask.onEnterFrame = function() {
    this._x += 20;
};

```

}
