A Flash Developer Resource Site

Page 2 of 2 FirstFirst 12
Results 21 to 37 of 37

Thread: horizontal scrolling picture gallery...... need help

  1. #21
    Senior Member pellepiano's Avatar
    Join Date
    Feb 2000
    Location
    Stockholm, Sweden
    Posts
    15,151
    Yes it calculates the distance to the object for each frame and moves towards the object in smaller and smaller steps, making a easing effect.

    You can also have it like....

    onClipEvent(enterFrame){
    speed=7;
    this._x+=(_root.xpos-this._x)/speed;
    }


    The xpos variable determines the position where the movieclip will go. For a initial position set the xpos to the proper value in the first frame of the movie.

    -Pelle Piano
    // Image Gallery
    www.studiobild.com
    // Photo Blog
    http://talesofthepixel.blogspot.com

  2. #22
    Senior Member
    Join Date
    Aug 2001
    Posts
    209
    Hi, I was trying the easing thing and I got to move properly and everything, but I don't undersatdn how you masked the boxes. Can yuo explain to how you did the masking, i ahve a box like yours and have it set to mask, with the picture boxes in layer below set to masked, but it doesn't mask. i ahven't used masking before.

    Secondly, for the scrolling bar one, I get the pics to sroll with the two buttons, but is there a way to get it to stop? So someone doesn't kepp the thing moving it and take anhour to get back. I want the pics in the movieclip to scroll but to stop after the last pics and then the person has to go back the other way to the beginning.

    Thanks for the help.

  3. #23
    Senior Member pellepiano's Avatar
    Join Date
    Feb 2000
    Location
    Stockholm, Sweden
    Posts
    15,151
    To stop the scrolling you have to set some boundaries. The best way is to ask, if the movievie clip has reached a certain position tell it to stop. For instance

    onClipEvent (enterFrame) {
    if (_root.left == 1 && this._x>-200) {
    this._x -= 5;
    }
    if (_root.right == 1 && this._x<200) {
    this._x += 5;
    }
    }

    -Pelle Piano
    // Image Gallery
    www.studiobild.com
    // Photo Blog
    http://talesofthepixel.blogspot.com

  4. #24
    Senior Member
    Join Date
    Aug 2001
    Posts
    209
    thanks, that worked, I just needed to adjust the numbers.

    I'm trying one more thing. I made the ease scroller, and I changed it to vertical, and changed all the x's to y's. Is there anything else for that. I also, just have two arrows with that to scroll the pictures as they ease in up and down and it doesn't work. Can you take a look at the .fla and tell me what I'm doing wrong
    Attached Files Attached Files

  5. #25
    Senior Member pellepiano's Avatar
    Join Date
    Feb 2000
    Location
    Stockholm, Sweden
    Posts
    15,151
    The variable for y destination is ypos
    But the easing scroll is made for having one button for every image, each setting a new value to ypos. Its not ment to continuosly scroll.

    -Pelle Piano
    // Image Gallery
    www.studiobild.com
    // Photo Blog
    http://talesofthepixel.blogspot.com

  6. #26
    Senior Member
    Join Date
    Aug 2001
    Posts
    209
    I don't want it to continuosly scroll I want it so if I click down it goes down one box, I click down agian and it goes down one more box and if I click up go up one box, if I click up agian go up another box and so on. Is this possible?

  7. #27
    Senior Member pellepiano's Avatar
    Join Date
    Feb 2000
    Location
    Stockholm, Sweden
    Posts
    15,151
    This should work

    on(release){
    width_of_box=250;
    ypos+=width_of_box;
    }

    and down scroll

    on(release){
    width_of_box=250;
    ypos-=width_of_box;
    }

    -Pelle Piano
    // Image Gallery
    www.studiobild.com
    // Photo Blog
    http://talesofthepixel.blogspot.com

  8. #28
    Huygens to Titan PCRIDE's Avatar
    Join Date
    May 2002
    Location
    PLUTO
    Posts
    1,335
    Is this what you are looking for


    you can adjust the easing and the speed and the elasticity
    All out of Honey Buffers, so i grabed a few Goose Heads

  9. #29
    Senior Member
    Join Date
    Aug 2001
    Posts
    209
    Originally posted by pellepiano
    This should work

    on(release){
    width_of_box=250;
    ypos+=width_of_box;
    }

    and down scroll

    on(release){
    width_of_box=250;
    ypos-=width_of_box;
    }
    thanks so much for the help, but I need to dig this up one more time. On that script how can I have it not be able to go down any furnther or up any furthere, because someone can keep clicking and it will take for every to come back up. i tried the same code for the continous scrolling bar, but that doesnt work.

    secondly, I tried usong the same code minus the easing part to make a regular clicking scroll, where I click and it moves down slightly like normal scroll bars but that didn't work, how would you do that?

    Thank you so much for the help.

  10. #30
    Senior Member pellepiano's Avatar
    Join Date
    Feb 2000
    Location
    Stockholm, Sweden
    Posts
    15,151
    Its been too long so I dont remember what code you are using ( this thread has to many variations).
    Show the code you are using on movieclip and buttons and tell how you want it to work. Or post the fla.

    -Pelle Piano
    // Image Gallery
    www.studiobild.com
    // Photo Blog
    http://talesofthepixel.blogspot.com

  11. #31
    Senior Member
    Join Date
    Aug 2001
    Posts
    209
    movieclip-
    Code:
    onClipEvent (enterFrame) {
        this._y += (_root.ypos-this._y)/7;
    }
    buttons-
    Code:
    on(release){
    width_of_box=250;
    ypos+=width_of_box;
    }
    
    and down scroll
    
    on(release){
    width_of_box=250;
    ypos-=width_of_box;
    }
    there are two things I'm tryinng to figure out

    I'm trying to make it so you cant go down any further or up.

    Also, I wanna make a scroller with no easing jsut like a regular scroller without a bar and just two buttons, where if i click down it goes slightly down and up it goes slightly up.

    thanks so much

  12. #32
    Senior Member pellepiano's Avatar
    Join Date
    Feb 2000
    Location
    Stockholm, Sweden
    Posts
    15,151
    This thread has already covered the non easing scroller. heres a copy of a previous post.

    You put this on the Movieclip......

    onClipEvent (enterFrame) {
    if (_root.left == 1) {
    this._x -= 5;
    }
    if (_root.right == 1) {
    this._x += 5;
    }
    }


    On Buttons

    // left scroll
    on(rollOver){
    left=1;
    }
    on(rollOut){
    left=0;
    }


    // right scroll
    on(rollOver){
    right=1;
    }
    on(rollOut){
    right=0;
    }

    To set boundaries of your current script. This should make the scroll stop after showing 3 images ( three clicks ). And you can only scroll down IF you have scrolled up ( I think). You have to play with it.



    on(release){
    width_of_box=250;
    if(box_click<3){
    ypos+=width_of_box;
    box_click++;
    }
    }

    and down scroll

    on(release){
    width_of_box=250;
    if(box_click !=0 ){
    ypos-=width_of_box;
    box_click++;
    }
    }

    -Pelle Piano
    // Image Gallery
    www.studiobild.com
    // Photo Blog
    http://talesofthepixel.blogspot.com

  13. #33
    Senior Member pellepiano's Avatar
    Join Date
    Feb 2000
    Location
    Stockholm, Sweden
    Posts
    15,151
    If you want your buttons to scroll a say 5 pixels and no more each time you clik a button you can just use a button like this.

    // Down button
    on(release){
    myScrollingClip._x+=5;
    }

    -Pelle Piano
    // Image Gallery
    www.studiobild.com
    // Photo Blog
    http://talesofthepixel.blogspot.com

  14. #34
    Senior Member
    Join Date
    Aug 2001
    Posts
    209
    that stop code is really weird, I was trying to get it work and i was changing the numbers and soemtimes I could go down but only fi i pressed up twice and if i pressed down i coulcn't go up but I could go how erv far iw anted down and if I clicked up once i couldnt og down. really weird


    Originally posted by pellepiano
    If you want your buttons to scroll a say 5 pixels and no more each time you clik a button you can just use a button like this.

    // Down button
    on(release){
    myScrollingClip._x+=5;
    }
    for this i was trying to figure out a stop code. sorry for all the questions, I'm trying to figure these out myself but nothing works. here's the code I've been trying, it's coudl yu gave earlier for the continous scroller, it doesnt work though.
    Code:
    onClipEvent (enterFrame) {
    if (_root.left == 1 && this._y>137) {
    this._y -= 5;
    }
    if (_root.right == 1 && this._y<200) {
    this._y += 5;
    }
    }

  15. #35
    Senior Member pellepiano's Avatar
    Join Date
    Feb 2000
    Location
    Stockholm, Sweden
    Posts
    15,151
    I saw a mistake, it should be i--;

    //down scroll

    on(release){
    width_of_box=250;
    if(box_click !=0 ){
    ypos-=width_of_box;
    box_click--;
    }
    }

    Im doing this on top of my head so there may be an occasional error.

    Maybe you are trying to many things at once, it can be quite confusing.
    The stop code you have will permit scrolling of a 63 pixels area. Note that the position is counted from the MIDDLE ( the cross ) of the movieclip. Not its top left.
    I usually position my graphics inside the movieclip so the top left is in the exact middle of the movieclip ( which is x 0 and y 0 of the movieclips canvas ).

    -Pelle Piano
    // Image Gallery
    www.studiobild.com
    // Photo Blog
    http://talesofthepixel.blogspot.com

  16. #36
    Senior Member
    Join Date
    Aug 2001
    Posts
    209
    ok for the first one (the easing stopping)i got it to work now, thanks.

    for the second regular scroller my code is right?? becuase it doesnt work for me. It's just keeps going, I tried all different numbers.

    maybe i am doing too many things at once.

  17. #37
    Junior Member
    Join Date
    Apr 2004
    Posts
    1
    When i test mt .fla it does a crazy scroll and ends up at a random starting point - all i want it to do is not to move until i click a button to change it x position.

    Any help would be much appreciated.
    Waz

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center