# Mc buttons need code to navigate with them

**URL:** <https://forum.kirupa.com/t/mc-buttons-need-code-to-navigate-with-them/262736>\
**Category:** Uncategorized\
**Created:** [June 9, 2008, 3:17pm UTC](https://forum.kirupa.com/t/mc-buttons-need-code-to-navigate-with-them/262736 "2008-06-09T15:17:28Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![mrdoodle](https://avatars.discourse-cdn.com/v4/letter/m/ecd19e/32.png) [@mrdoodle](https://forum.kirupa.com/u/mrdoodle)\
**Post date:** [June 9, 2008, 3:17pm UTC](https://forum.kirupa.com/t/mc-buttons-need-code-to-navigate-with-them/262736/1 "2008-06-09T15:17:28Z")

</div>

Hi,

I have three movie clips that I am using as buttons.

Their instances in the movie are Espanol\_btn, Francais\_btn and Deutsch\_btn.

I have added script to control the rollover and press/release states of the buttons, and now need to get the script to recognise which of the three buttons was pressed, store that result in the variable called [COLOR=Blue]lang [COLOR=Black](The posibilities are Espanol, Francais or Deutsch), and depending on what the variable [COLOR=Blue]land [/COLOR]is, do different things. The script is below.

```auto

import mx.transitions.Tween;
import mx.transitions.easing.*;
var lang:String;
var year:Number =0;
var unit:Number =0;
var section:Number =0;

//===============================LOGO ANIMATES ONSTAGE=========================================
// move top logo into position
var yPosT:Tween = new Tween(logoTop, "_y", Elastic.easeInOut, -38.5, -0.3, 1.5, true);

//=====================LANGUAGE BUTTONS - ROLLOVER ANIMATION FUNCTIONS=========================================
// function to grow lang_btns on rollover
function grow(){
    if(this._xscale < 110){
       this._xscale += 5
       this._yscale += 5
       } else {
           this.onEnterFrame = null;
       }
}
// function to grow lang_btns continuously on rollover
function growOverTime() {
    this.onEnterFrame = grow;
}
// function to shrink lang_btns on rollout
function shrink() {
    if(this._xscale > 100){
       this._xscale -= 5
       this._yscale -= 5
       } else {
           this.onEnterFrame = null;
       }
}
// function to shrink lang_btns incrementally on rollout
function shrinkOverTime() {
    this.onEnterFrame = shrink;
}

//=====================LANGUAGE BUTTONS - RELEASE OUTSIDE FUNCTION=========================================
// function to release lang_btns & call shrink() function on onReleaseOutside 
function unpressOutside() {
    if(this._xscale > 100){
       this._xscale -= 2.5
       this._yscale -= 2.5
        this._x = this._x -5;
        this._y = this._y -5;
       } else {
           this.onEnterFrame = null;
       }
}

//=====================LANGUAGE BUTTONS - PRESS/RELEASE FUNCTIONS=========================================
// function to press lang_btns onPress
function depress() {
       this._x = this._x +5;
    this._y = this._y +5;
}    
// function to release lang_btns onRelease
function unpress() {
       this._x = this._x -5;
    this._y = this._y -5;
    // run 'navigate' function
    navigate();
}

//=====================LANGUAGE BUTTONS - NAVIGATION SCRIPT========================================
// function to navigate to next level of buttons
function navigate() {
   if (lang == "Espanol") {
       _root.gotoAndStop(3);
  }
   if (lang == "Francais") {
       _root.gotoAndStop(4);
  }
   if (lang == "Deutsch") {
       _root.gotoAndStop(5);
  }
}
    
//=====================YEAR BUTTONS - FUNCTION CALLS TO OPERATE BUTTONS=========================================
// Make functions play on rollover/rollout/press/release of Unit buttons
_root.Espanol_btn.onRollOver = growOverTime;
_root.Espanol_btn.onRollOut = shrinkOverTime;
_root.Espanol_btn.onPress = depress;
_root.Espanol_btn.onRelease (lang = "Espanol");
_root.Espanol_btn.onRelease = unpress;
_root.Espanol_btn.onReleaseOutside = unpressOutside;

_root.Francais_btn.onRollOver = growOverTime;
_root.Francais_btn.onRollOut = shrinkOverTime;    
_root.Francais_btn.onPress = depress;
_root.Francais_btn.onRelease = unpress;        
_root.Francais_btn.onReleaseOutside = unpressOutside;

_root.Deutsch_btn.onRollOver = growOverTime;
_root.Deutsch_btn.onRollOut = shrinkOverTime;
_root.Deutsch_btn.onPress = depress;
_root.Deutsch_btn.onRelease = unpress;    
_root.Deutsch_btn.onReleaseOutside = unpressOutside;

stop();

```

Here is the link to the movie to give you an idea if what I’m trying to achieve  
[/COLOR][/COLOR]  
[http://www.mrdoodle.com/languagenut/](http://www.mrdoodle.com/languagenut/)  
[COLOR=Blue][COLOR=Black]  
Hopefully to some code wizard out there it will be decipherable as to what’s going on and how I can get this to work.

I thank you in advance for any help given.

Peace :party:  
[/COLOR][/COLOR]
