# Vars and \_root Objects

**URL:** https://forum.kirupa.com/t/vars-and--root-objects/195640
**Category:** flash
**Created:** [August 2, 2006, 2:49am UTC](https://forum.kirupa.com/t/vars-and--root-objects/195640 "2006-08-02T02:49:04Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![brndn](https://avatars.discourse-cdn.com/v4/letter/b/dec6dc/32.png) [@brndn](https://forum.kirupa.com/u/brndn)
#### Post date: [August 2, 2006, 2:49am UTC](https://forum.kirupa.com/t/vars-and--root-objects/195640/1 "2006-08-02T02:49:04Z")

</div>

Does any one know why an if on press == true would not work?  
Basically inside [COLOR=Red][“row”+i] [COLOR=Black](which is a movie clip) there are three x[/COLOR] but(1,2,3)  
[COLOR=Black]and one instance of [COLOR=Red]ticker [COLOR=Black]if but1 is pressed then ticker will move to.

The reason why it is set up this was is because [/COLOR][/COLOR][/COLOR][/COLOR][COLOR=Red][“row”+i] [COLOR=Black]is a movie clip that occurs 19 times.

[/COLOR][/COLOR]:td:

```auto

var question:Number = 19;
for (var i = 1; i<=question; i++) {
_root["row"+i].onPress = function() {

if(but1.onPress == true){
trace("button 1 is pressed");
this.ticker._x = 50;

}else if(but2.onPress == true){
trace("button 2 is pressed");
this.ticker._x = 100;

}else if(but3.onPress == true){
trace("button 2 is pressed");
this.ticker._x = 150;
    };
}
}

```
