# Sliding window tutorial problem

**URL:** <https://forum.kirupa.com/t/sliding-window-tutorial-problem/61913>\
**Category:** Uncategorized\
**Created:** [August 23, 2004, 10:20am UTC](https://forum.kirupa.com/t/sliding-window-tutorial-problem/61913 "2004-08-23T10:20:36Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![red\_ear\_slider](https://avatars.discourse-cdn.com/v4/letter/r/d6d6ee/32.png) [@red\_ear\_slider](https://forum.kirupa.com/u/red_ear_slider)\
**Post date:** [August 23, 2004, 10:20am UTC](https://forum.kirupa.com/t/sliding-window-tutorial-problem/61913/1 "2004-08-23T10:20:36Z")

</div>

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](http://www.kirupa.com/developer/flash5/slidingmenu.htm)

thank you very much

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 24, 2004, 8:35am UTC](https://forum.kirupa.com/t/sliding-window-tutorial-problem/61913/2 "2004-08-24T08:35:15Z")

</div>

What part gives you problems understanding?

scotty:love:

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 26, 2004, 10:56am UTC](https://forum.kirupa.com/t/sliding-window-tutorial-problem/61913/3 "2004-08-26T10:56:58Z")

</div>

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!

> [@scotty](#):
>
> What part gives you problems understanding?
> 
> scotty:love:

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 26, 2004, 2:33pm UTC](https://forum.kirupa.com/t/sliding-window-tutorial-problem/61913/4 "2004-08-26T14:33:47Z")

</div>

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(-:

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 27, 2004, 8:53am UTC](https://forum.kirupa.com/t/sliding-window-tutorial-problem/61913/5 "2004-08-27T08:53:31Z")

</div>

Hi Scotty,

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

> [@scotty](#):
>
> 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(-:

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 27, 2004, 9:01am UTC](https://forum.kirupa.com/t/sliding-window-tutorial-problem/61913/6 "2004-08-27T09:01:02Z")

</div>

> [@red\_ear\_slider](#):
>
> …but I am becoming even more confused! :puzzled:

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

scotty(-:

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 27, 2004, 4:27pm UTC](https://forum.kirupa.com/t/sliding-window-tutorial-problem/61913/7 "2004-08-27T16:27:43Z")

</div>

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.

> [@scotty](#):
>
> Let see if we can clear some things up:)  
> What parts you don’t understand?
> 
> scotty(-:
