# Image scroll

**URL:** https://forum.kirupa.com/t/image-scroll/7325
**Category:** Uncategorized
**Created:** [October 28, 2002, 2:42pm UTC](https://forum.kirupa.com/t/image-scroll/7325 "2002-10-28T14:42:05Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![Dude](https://avatars.discourse-cdn.com/v4/letter/d/f19dbf/32.png) [@Dude](https://forum.kirupa.com/u/Dude)
#### Post date: [October 28, 2002, 2:42pm UTC](https://forum.kirupa.com/t/image-scroll/7325/1 "2002-10-28T14:42:05Z")

</div>

Hi, I am currently making a flash animation in which i have about 15 picture thumbs spaced out along a line which you see about 4 at a time through a window, this i have done fine but what i need is to have 2 buttons which when you roll over them the line of thumbs scrolls across, then when you take the curser off the arrow the line \*\*stops at that place \*\* and you can click on the pictures to get them at full size. anyone help??? :rambo:

Dude.

---

<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: [October 28, 2002, 4:00pm UTC](https://forum.kirupa.com/t/image-scroll/7325/2 "2002-10-28T16:00:47Z")

</div>

code on buttons

```auto

on(rollOver){
      nFlag = true
}
on(rollOut){
      nFlag = false
}

```

code on movieclip

```auto

onClipEvent(load){
      nSpeed = 5
}
onClipEvent(enterFrame){
      if(_root.nFlag){
            this._x += nSpeed
      }
}

```

that should work. then just modify as necessary…

---

<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: [October 28, 2002, 5:13pm UTC](https://forum.kirupa.com/t/image-scroll/7325/3 "2002-10-28T17:13:19Z")

</div>

Cool that works perfectly, but i cant get the right button to work. the buttons are \< and \> and the scroll left scrolls left but the scroll right also scrolls left, any help?? :-\

---

<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: [October 28, 2002, 5:23pm UTC](https://forum.kirupa.com/t/image-scroll/7325/4 "2002-10-28T17:23:38Z")

</div>

Also is there a way to stop the movie clip scrolling when it gets to the end? :q:

---

<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: [October 28, 2002, 5:41pm UTC](https://forum.kirupa.com/t/image-scroll/7325/5 "2002-10-28T17:41:29Z")

</div>

instead of

this.\_x += nSpeed

put

this.\_x -= nSpeed

just subtract insted of add

and to make it stop when it gets to the end, You just want to modify the if statement… mess around with the value and the directoin of the greater-than/less-than sign to get your desired effect…

```auto

onClipEvent(load){
      nSpeed = 5
}
onClipEvent(enterFrame){
      if(_root.nFlag && **this._x > 400** ){
            this._x += nSpeed
      }
}

```

---

<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: [October 28, 2002, 5:52pm UTC](https://forum.kirupa.com/t/image-scroll/7325/6 "2002-10-28T17:52:31Z")

</div>

Ok i tried that but it just reverses the problem now it scrolls right with both buttons can i not go both ways?

---

<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: [October 28, 2002, 6:47pm UTC](https://forum.kirupa.com/t/image-scroll/7325/7 "2002-10-28T18:47:04Z")

</div>

Oh another thing is that i cant get the preloader to work properly, i have been using

if frame loaded (xx)  
gotoAndplay (2)  
}else{  
gotoAndPlay (1)  
}

but when i play the movie it just goes white untill the movie is loaded. any suggestions??

---

<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: [October 28, 2002, 7:53pm UTC](https://forum.kirupa.com/t/image-scroll/7325/8 "2002-10-28T19:53:04Z")

</div>

First…

Frame…

```auto
nSpeed = 5

```

> button

```auto
onClipEvent(enterFrame){
      if(_root.nFlag){
            this._x += _root.nSpeed
      }
      if(this._x >= x){
            this._x = x;
      }
}

```

\< button

```auto
onClipEvent(enterFrame){
      if(_root.nFlag){
            this._x -= _root.nSpeed
      }
      if(this._x <= x){
            this._x = x;
      }
}

```

Since it makes no sense to redifine the speed on each clip, I defined the speed on a frame and called that variable in the clip. Also…replace “x” with a number value.

And for the preloader…  
Make 2 frames…

Frame 1

```auto
if (_framesloaded >= _totalframes){
gotoAndPlay(3);
} else {
gotoAndPlay(2);
}

```

Frame 2

```auto
gotoAndPlay(1);

```

I think I covered everything.

PS: I know the tutorial at [www.kirupa.com](http://www.kirupa.com) says to do it the way you did it, but I have e-mailed him earlier today reporting this error. Ironically someone else had this problem earlier then I scoped the tutorial and found that he was only using one frame, and the preloader won’t work like that.

---

<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: [October 28, 2002, 10:56pm UTC](https://forum.kirupa.com/t/image-scroll/7325/9 "2002-10-28T22:56:04Z")

</div>

Ok im having some problems with that, when i add the preloading frames it wont play properly, before you can run the swf file it come up with the error message

“A script in this movie is causing Flash Player to run slowley, If it continues to run your computer may become unresponsive. Do you want to abort this script?  
YES NO”

if you choose no flash player will close and if you press YES it plays the animation but ignores all of the scripts in the entire movie.

also with the scripts for the buttons it says the script contains errors even though i put 5 in substitute of the X also when you say ‘frame 1’ do you mean frame 1 of the whole movie or frame one of the movie clip or the button or what??

Dude

---

<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: [October 29, 2002, 2:13am UTC](https://forum.kirupa.com/t/image-scroll/7325/10 "2002-10-29T02:13:25Z")

</div>

Hmm, I did mean on the main timeline (the whole movie) then try this…

Frame 1

```auto
if (_framesloaded >= _totalframes) {
gotoAndPlay(3);
}

```

Frame 2

```auto
gotoAndPlay(1);

```

There is really no need for the gotoAndPlay(2) in the else, it will go there anyway.

---

<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: [October 29, 2002, 11:45am UTC](https://forum.kirupa.com/t/image-scroll/7325/11 "2002-10-29T11:45:55Z")

</div>

Cool i think the preloader is working now, but i still cant get the picture strip to function properly, i have put the codes you said on the buttons but you said

Frame…

code:--------------------------------------------------------------------------------nSpeed = 5--------------------------------------------------------------------------------

what frame are you taking about???

Dude

---

<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: [October 29, 2002, 5:33pm UTC](https://forum.kirupa.com/t/image-scroll/7325/12 "2002-10-29T17:33:42Z")

</div>

When I said Frame…, I meant any frame on the timeline. Usually the same frame your buttons are on.

---

<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: [October 29, 2002, 6:15pm UTC](https://forum.kirupa.com/t/image-scroll/7325/13 "2002-10-29T18:15:14Z")

</div>

I really cant get it to work, if i send the file to you can you add the script??

Dude.

---

<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: [October 29, 2002, 6:16pm UTC](https://forum.kirupa.com/t/image-scroll/7325/14 "2002-10-29T18:16:11Z")

</div>

I will see what I can do… I don’t see why it won’t work.

You can post the .fla as an attachment and I will download it.

---

<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: [October 29, 2002, 6:48pm UTC](https://forum.kirupa.com/t/image-scroll/7325/15 "2002-10-29T18:48:58Z")

</div>

I’d rather not place the .fla file on the web can i email it to you?:hat:

---

<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: [October 29, 2002, 6:53pm UTC](https://forum.kirupa.com/t/image-scroll/7325/16 "2002-10-29T18:53:13Z")

</div>

Sure, you can e-mail it to me…

For spam purposes I am not putting my e-mail address in e-mail address form (spider bots come and steal it and spam the hell outta your mailbox)

lost at lostinbeta dot com

---

<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: [October 29, 2002, 7:15pm UTC](https://forum.kirupa.com/t/image-scroll/7325/17 "2002-10-29T19:15:06Z")

</div>

PM your email to me.

---

<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: [October 29, 2002, 7:15pm UTC](https://forum.kirupa.com/t/image-scroll/7325/18 "2002-10-29T19:15:26Z")

</div>

PM Sent.

---

<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: [October 29, 2002, 7:25pm UTC](https://forum.kirupa.com/t/image-scroll/7325/19 "2002-10-29T19:25:53Z")

</div>

email sent…

---

<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: [October 29, 2002, 7:28pm UTC](https://forum.kirupa.com/t/image-scroll/7325/20 "2002-10-29T19:28:38Z")

</div>

You sent the .swf.

To edit it, I need the .fla file.

[Next page](https://forum.kirupa.com/t/image-scroll/7325.md?page=2)
