# If/then question

**URL:** <https://forum.kirupa.com/t/if-then-question/204937>\
**Category:** Uncategorized\
**Created:** [October 24, 2006, 7:35pm UTC](https://forum.kirupa.com/t/if-then-question/204937 "2006-10-24T19:35:02Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![lenfest](https://avatars.discourse-cdn.com/v4/letter/l/e480ec/32.png) [@lenfest](https://forum.kirupa.com/u/lenfest)\
**Post date:** [October 24, 2006, 7:35pm UTC](https://forum.kirupa.com/t/if-then-question/204937/1 "2006-10-24T19:35:02Z")

</div>

I am trying limit the scroll length of a movie clip. I’m sure it’s a simple if/then statement, but I am lost. Does anyone know how to limit the length of the scroll depending on the width of the clip?

on(press, release, keyPress “\<left\>”)  
{  
thumbnails.\_x += 30;  
}

Any help would be greatly appreciated, thanks.

Adam

---

<div class="post-metadata">

**Author:** ![BlueEyedMonster](https://avatars.discourse-cdn.com/v4/letter/b/b3f665/32.png) [@BlueEyedMonster](https://forum.kirupa.com/u/BlueEyedMonster)\
**Post date:** [October 24, 2006, 7:41pm UTC](https://forum.kirupa.com/t/if-then-question/204937/2 "2006-10-24T19:41:32Z")

</div>

Can you provide more of the code? It’s hard to understand what sort of scroll you mean, and how it is to be dependent on width. Do you want the scroll width to be equal to the movie clip width? If so, you might not need if / else statement at all, you could just set something like

```auto
 thumbnails._width = Stage.width; 

```

Uploading the FLA would be helpful.

---

<div class="post-metadata">

**Author:** ![lenfest](https://avatars.discourse-cdn.com/v4/letter/l/e480ec/32.png) [@lenfest](https://forum.kirupa.com/u/lenfest)\
**Post date:** [October 24, 2006, 8:14pm UTC](https://forum.kirupa.com/t/if-then-question/204937/3 "2006-10-24T20:14:46Z")

</div>

I’ve attached the fla, what I’m trying to do is limit how far the mc will scroll based on the size of the mc so it won’t just keep scrolling to infinity, or at least of the page.

Thanks for the help.

Adam

---

<div class="post-metadata">

**Author:** ![BlueEyedMonster](https://avatars.discourse-cdn.com/v4/letter/b/b3f665/32.png) [@BlueEyedMonster](https://forum.kirupa.com/u/BlueEyedMonster)\
**Post date:** [October 24, 2006, 9:15pm UTC](https://forum.kirupa.com/t/if-then-question/204937/4 "2006-10-24T21:15:14Z")

</div>

I’ll write up what I did in a few min, but let me know if this is NOT what you meant…

Edit:

Okay, so, the first thing I did was convert the mask into a movieclip, and give it the instance name ‘mask’ so that I could use it in the code.

Then on the left button, I inserted this code

```auto

on(press, release, keyPress "<left>")
{
if (thumbnails._x < mask._x){

thumbnails._x = (thumbnails._x +10);
}
}

```

so what you’re saying here is that if the position of the thumbnails is further to the left than the position of the mask, move the thumbnails to the right.

For the right button:

```auto

on(press, release, keyPress "<right>")
{
if (thumbnails._x > (mask._width - thumbnails._width)){

thumbnails._x = (thumbnails._x -10);
}
}

```

Hope that helps and was what you were looking for. You had the buttons aligned differently than I do, so maybe I didn’t help at all.

---

<div class="post-metadata">

**Author:** ![lenfest](https://avatars.discourse-cdn.com/v4/letter/l/e480ec/32.png) [@lenfest](https://forum.kirupa.com/u/lenfest)\
**Post date:** [October 24, 2006, 9:47pm UTC](https://forum.kirupa.com/t/if-then-question/204937/5 "2006-10-24T21:47:12Z")

</div>

thank you BlueEyedMonster, it did help, a lot. It works perfect.
