munklemoose
02-27-2007, 05:12 PM
Hi, i have a horizontal scroller (im sure you've guessed!) in flash 6, it works but i want to use it within flash 8. I keep getting NaN in the counter. I think its to do with declaring CounterNumber. Anyone know of a quick fix? heres the code:
WindowIN._alpha = 0;
function SlideMenu() {
this._x += (newX-this._x)/5;
}
// This next line calls the funtion named SlideMenu
WindowIN.Contents.onEnterFrame = SlideMenu;
newX = 0;
//The next line is where you indicate the total number of display area(s)
PageTotal = 4;
//This is where we set our counter to 1
//The counter later limits the count to a maximum of the number set in PageTotal
CounterDisplay = 1;
//The following function is assigned to the Forward button
Forward.Forward.onPress = function() {
CounterNumber++;
XNumber++;
// limit input field to a maximum as indicated above in PageTotal
if (CounterNumber>PageTotal-1) {
CounterNumber = 0;
XNumber = 0;
}
CounterDisplay = CounterNumber+1;
if (XNumber>4) {
XNumber = 0;
}
newX = -XNumber*48;
};
//This is a similar function for the Back button except in reverse
Back.Back.onPress = function() {
CounterNumber--;
XNumber--;
if (CounterNumber<0) {
CounterNumber = PageTotal-1;
XNumber = 3;
}
CounterDisplay = CounterNumber+1;
if (XNumber<0) {
XNumber = 4;
}
newX = -XNumber*48;
};
stop();
WindowIN._alpha = 0;
function SlideMenu() {
this._x += (newX-this._x)/5;
}
// This next line calls the funtion named SlideMenu
WindowIN.Contents.onEnterFrame = SlideMenu;
newX = 0;
//The next line is where you indicate the total number of display area(s)
PageTotal = 4;
//This is where we set our counter to 1
//The counter later limits the count to a maximum of the number set in PageTotal
CounterDisplay = 1;
//The following function is assigned to the Forward button
Forward.Forward.onPress = function() {
CounterNumber++;
XNumber++;
// limit input field to a maximum as indicated above in PageTotal
if (CounterNumber>PageTotal-1) {
CounterNumber = 0;
XNumber = 0;
}
CounterDisplay = CounterNumber+1;
if (XNumber>4) {
XNumber = 0;
}
newX = -XNumber*48;
};
//This is a similar function for the Back button except in reverse
Back.Back.onPress = function() {
CounterNumber--;
XNumber--;
if (CounterNumber<0) {
CounterNumber = PageTotal-1;
XNumber = 3;
}
CounterDisplay = CounterNumber+1;
if (XNumber<0) {
XNumber = 4;
}
newX = -XNumber*48;
};
stop();