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.
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
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();
:pac:
[/COLOR][/COLOR]