Hello. I wanted help on a simple issue -- converting some ActionScript 2 into AS3. The script is for a sliding panel. I think I need to add my Event Listeners, but I'm not sure how to do it.
On the stage there are three buttons: b1, b2 and closeb. The panel that slides is called bigSlide, and inside it contains separate parts called slide1 and slide2.
Thanks in advance!
stop();
var currentPosition:Number = bigSlide.slide1.x;
var startFlag:Boolean = false;
menuSlide = function (input:MovieClip) {
if (startFlag == false) {
startFlag = true;
var finalDestination:Number = input.x;
var distanceMoved:Number = 0;
var distanceToMove:Number = Math.abs(finalDestination-currentPosition);
var finalSpeed:Number = .3;
var currentSpeed:Number = 0;
var dir:Number = 1;
if (currentPosition<=finalDestination) {
dir = -1;
} else if (currentPosition>finalDestination) {
dir = 1;
}
this.onEnterFrame = function() {
currentSpeed = Math.round((distanceToMove-distanceMoved+1)*finalSpeed);
distanceMoved += currentSpeed;
bigSlide.x += dir*currentSpeed;
if (Math.abs(distanceMoved-distanceToMove)<=1) {
bigSlide.x = maskMovie.x-currentPosition+dir*distanceToMove;
currentPosition = input.x;
startFlag = false;
delete this.onEnterFrame;
}
};
}
};
b1.onRelease = function() {
menuSlide(bigSlide.slide1);
};
bigSlide.slide1.more.onRelease = function() {
menuSlide(bigSlide.slide2);
};
b2.onRelease = function() {
menuSlide(bigSlide.slide2);
};
closeb.onRelease = function() {
root.myLoader.contentPath = null;
}