Image scroll

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.

code on buttons


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

code on movieclip


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

that should work. then just modify as necessary…

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?? :-\

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

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…


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

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

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??

First…

Frame…

nSpeed = 5

button

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

< button

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

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

Frame 2

gotoAndPlay(1);

I think I covered everything.

PS: I know the tutorial at 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.

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

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

Frame 1

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

Frame 2

gotoAndPlay(1);

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

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

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

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

Dude.

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.

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

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

PM your email to me.

PM Sent.

email sent…

You sent the .swf.

To edit it, I need the .fla file.