# Help with using variables/instances

**URL:** <https://forum.kirupa.com/t/help-with-using-variables-instances/245919>\
**Category:** Uncategorized\
**Created:** [December 5, 2007, 2:54pm UTC](https://forum.kirupa.com/t/help-with-using-variables-instances/245919 "2007-12-05T14:54:34Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jib](https://avatars.discourse-cdn.com/v4/letter/j/cab0a1/32.png) [@jib](https://forum.kirupa.com/u/jib)\
**Post date:** [December 5, 2007, 2:54pm UTC](https://forum.kirupa.com/t/help-with-using-variables-instances/245919/1 "2007-12-05T14:54:34Z")

</div>

i was wondering if there was a way to make this code work:

var button = mcMovie1;

on (rollOver) {  
button.gotoAndPlay(“two”);  
}

on (rollOut) {  
button.gotoAndPlay(“one”);  
}

where “button” would be recognized as “mcMovie1”, a movie instance. this way i can just copy and paste the same code over and over and not have to replace 5-10 movie instance names(whatevermovieclip.gotoAndPlay…) for all of them; instead replace one line: “var button = whatervermovieclip”
