PDA

Просмотр полной версии : сделать переменную глобальной


Mylene
21.12.2003, 06:02
Подскажите, как в данном коде сделать переменную "input" - глобальной, чтобы ее было видно не только при перелистывании картинок?


square._alpha = 0;
whichPic = 1;
trace("ВЫВОД input = "+input); // input - эту переменную надо сделать глобальной!!!!
next.onPress = function() {
if (whichPic<3 && !fadeIn && !fadeOut) {
fadeOut = true;
whichPic++;
input = whichPic;
}trace("input(in next)="+input);

};
back.onPress = function() {
if (whichPic>1 && !fadeIn && !fadeOut) {
fadeOut = true;
whichPic--;
input = whichPic;
}trace("input(in back)="+input);
};
_root.onEnterFrame = function(){
// when a new Photo is selected, fade out, load new image, and fade in
if (square._alpha>10 && fadeOut) {
square._alpha -= 10;
}
if (square._alpha<10) {
loadMovie("../pic1/Coord_"+whichPic+".swf", "square");
fadeOut = false;
fadeIn = true;
}
if (square._alpha<100 && fadeIn && !fadeOut) {
square._alpha += 10;
} else {
fadeIn = false;
}
};