# Xml Button\_mc how to "stay active"?

**URL:** https://forum.kirupa.com/t/xml-button-mc-how-to-stay-active/244905
**Category:** Uncategorized
**Created:** [November 23, 2007, 10:57am UTC](https://forum.kirupa.com/t/xml-button-mc-how-to-stay-active/244905 "2007-11-23T10:57:06Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![arn](https://avatars.discourse-cdn.com/v4/letter/a/ebca7d/32.png) [@arn](https://forum.kirupa.com/u/arn)
#### Post date: [November 23, 2007, 10:57am UTC](https://forum.kirupa.com/t/xml-button-mc-how-to-stay-active/244905/1 "2007-11-23T10:57:06Z")

</div>

Hi Kirupians…!🙂

I hope some can help me out / or give me an actionscript example on how to ad a “stay active” aka “pressed state” of a dynamic gerenerated xml butten,

I’ve got my xml menu up and running evereything is working fine, I only need this feature to make my menu complete…

here is mij actionscript concerning the “button” functions:

```
ActionScript Code:
[FONT=Courier New][LEFT]_root.treemenu["button"+vz+"_" + i].onRollOver = function(){
        showhide(this,"show");
        this.gotoAndPlay("on");        
        this.background.gotoAndPlay("on");                    
    }        
    
    _root.treemenu["button"+vz+"_" + i].onRollOut = function(){
        showhide(this,"hide");
        this.gotoAndPlay("off");                    
        this.background.gotoAndPlay("off");                            
    }                
    
    _root.treemenu["button"+vz+"_" + i].onRelease = function(){

        treeloadmovie(this.swf);
    }
    
    if(diepte &gt; 0){
            _root.treemenu["button"+vz+"_" + i]._visible = false;
    }
    
    _root.treemenu["button"+vz+"_" + i]._x = xpos;
    _root.treemenu["button"+vz+"_" + i]._y = ypos;

```

// xpos += _root.treemenu[“button”+vz+"_" + i].label.\_width;

```
    if(item.childNodes.length &gt; 0){
            var thisparent = Array();
            for(var j=0;j&lt;parent.length;j++){
                thisparent.push(parent[j]);            
            }                
            thisparent.push(i);
            createMenu(item,mc.menu["button_"+i],diepte+1,thisparent);
    }
    

    
}

```

}

[/LEFT]  
[/FONT]

If my code is not clear enough, a stic example is also fine…

Many thanks

best

Arn
