good day gents,
first off I wanna apologize for my english (if wasn’t good enough :bucktooth:)
I’m new here and need help with AS2
I’m creating a website and got a conflict between functions
I got 6 buttons but only 3 of them displaying at the same time, when I press on next button “Right” the button at center “about” should moves to left, and the right one “statement” should moves to the middle and a new button should appear at right side.
the problem is when the middle button moves toward left side it moves back to the middle…
I believe that the problem comes from “goBack” function, it conflicts with “Next” function.
I think I should stop “goBack” function when “Next” starting, but I couldn’t do that
any ideas??
many thanks in advance…
@ _root
stop();
c = 800;
l = 350;
r = 1250;
speed = 1.5;
changeSpeed = 1.2;
scaleSpeed = 2;
//next function
var previousPosition:Number = about._x;
var prevScale:Number = about._xscale;
function Next(){
onEnterFrame = function(){
if(about._xscale > 75){
about._x = l - (l - about._x) / changeSpeed;
if (about._xscale > 75){
about._xscale -= scaleSpeed;
}else{
about._xscale = 75;
}
if (about._x == previousPosition){
about._x = l;
}
if (about._xscale == prevScale){
about._xscale = 75;
delete this.onEnterFrame;
}
previousPosition = about._x;
prevScale = about._xscale;
if (about._yscale > 75){
about._yscale -= scaleSpeed;
}else{
about._yscale = 75;
}
if (about._yscale == prevScale){
about._yscale = prevScale;
}
prevScale = about._xscale;
statement._x = c - (c - statement._x) / changeSpeed;
if (statement._x == previousPosition){
statement._x = c;
delete this.onEnterFrame;
}
previousPosition = statement._x;
statement._xscale = 100;
statement._yscale = 100;
}
}
}
@ about
i = 700;
c = 800;
k = 900;
speed = 1.5;
var previousPosition:Number = this._x;
function moveLeft(){
this.onEnterFrame = function(){
if(this._x > i){
this._x = i - (i - this._x) / speed;
if (this._x == previousPosition){
this._x = i;
delete this.onEnterFrame;
}
previousPosition = this._x;
}else{
this._x == i;
}
}
}
function moveRight(){
this.onEnterFrame = function(){
if(this._x < k){
this._x = k - (k - this._x) / speed;
if (this._x == previousPosition){
this._x = k;
delete this.onEnterFrame;
}
previousPosition = this._x;
}else{
this._x == k;
}
}
}
function goBack(){
this.onEnterFrame = function(){
if(this._x < c){
this._x = c - (c - this._x) / speed;
if (this._x == previousPosition){
this._x = c;
delete this.onEnterFrame;
}
previousPosition = this._x;
}
else if(this._x > c){
this._x = c - (c - this._x) / speed;
if (this._x == previousPosition){
this._x = c;
delete this.onEnterFrame;
}
previousPosition = this._x;
}else{
this._x == 800;
}
}
}