Sliding window tutorial problem

Hi all,

I am quite new to actionscripting and have tried to follow this tutorial but I don’t really understand it. Can somebody be so kind as to give me a step-by-step walk through the tutorial? I can’t seems to be able to contact the author

The tutorial is
http://www.kirupa.com/developer/flash5/slidingmenu.htm

thank you very much

What part gives you problems understanding?

scotty:love:

Hi,

I dun understand this one on frame 1

onClipEvent (load) {
_root.xnew = _root.mask2._x+(4-1)*100/2;

How do they get 4-1 and wat’s 100/2 abt?

and this one

MovieClip.prototype.move2 = function() {
dest = _root.xnew;
pos = this._x;
vel = vel*0.7+(dest-pos)/7;
this._x += vel;

Is this just controlling the speed for movement?

and the script on the scroller buttons,

on (press) {
_root.xnew = _root.mask2._x+(4-1)*100/2;
}

the author says to replace ‘4’ by 2, 0, -2 for the subsequent 3 buttons…how did he get these nos?

If I were to change the size of the number boxes will any of these calculation be affected?

thanks a million for replying!

LOL, I know that feeling, have struggled with it as well.
I remade it a bit, hope you can understand this better, the AS is commented.
It’s made so, that if you want to change the width of the “sections”, you don’t have to change the AS (as long they’ve all the same width…)

scotty(-:

Hi Scotty,

thanks for spending the time to modify it. Pls pardon my stupidity, but I am becoming even more confused! :puzzled:

Let see if we can clear some things up:)
What parts you don’t understand?

scotty(-:

I dun understand this part

MovieClip.prototype.move2 = function(tar) {
this.onEnterFrame = function() {
this._x = tar-(tar-this._x)/1.2;
// if the difference between target and the menu position is smaller as 1
// set menu to target value and delete the onEnterFrame
if (Math.abs(tar-this._x)<1) {
this._x = tar;
delete this.onEnterFrame;
}
};
};

thanks for your patience.