A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: [RESOLVED] Horizontal slider ?

  1. #1
    Junior Member
    Join Date
    Dec 2008
    Posts
    12

    resolved [RESOLVED] Horizontal slider ?

    Hi,

    is it possible to create a horizontal image slider which browses through photos?

    Similar to this:

    http://imageflow.finnrudolph.de/

    However, I want to make the transitions much smoother and eventually add audio which changes to suit each image.

    That being said I'll focus on the actually image slide for now, could someone point me in the right direction? I've been searching for a few hours but there really doesn't seem to be that much online about it, unless I'm just searching for the wrong things.

    Thanks!

  2. #2
    Junior Member
    Join Date
    Dec 2008
    Posts
    12
    Okay, so after trial and error all day, I've gotten this far:

    //Add EventListener to xAxis Slider
    //Listen to the CHANGE of value of xAxis Slider
    slider.addEventListener(Event.CHANGE, xDirection);

    function xDirection(evt:Event):void {
    gallery.x = evt.target.value;
    moveTxt.text = "The value of Slider is: " + evt.target.value;
    }


    There is a movie clip named "gallery" and a slider component named "slider".

    It works, however, the gallery moves to the right. I want to have it so that when I move the slider to the right, the gallery moves left.

    I'm guessing there's a simple fix of moving it along the x axis in minus numbers somehow?

    Any help?

  3. #3
    Will moderate for beer
    Join Date
    Apr 2007
    Location
    Austin, TX
    Posts
    6,801
    You'll need to subtract the current slider value from the max value to invert the sense.

  4. #4
    Junior Member
    Join Date
    Dec 2008
    Posts
    12
    Quote Originally Posted by 5TonsOfFlax View Post
    You'll need to subtract the current slider value from the max value to invert the sense.
    I sort of understand what you mean but it's not responding.

    Actionscript Code:
    slider.addEventListener(Event.CHANGE, xDirection);

    slider.value=168;
     
    function xDirection(evt:Event):void {
    gallery.x = evt.target.value;
    sizetxt.text = "The value of xAxis Slider is: " + (slider.maximum-evt.target.value);
    }

    Now the bar works in reverse; so it displays '0' on the far right, rather than the far left, so it has inversed.

    However, it still goes the same way?

  5. #5
    Will moderate for beer
    Join Date
    Apr 2007
    Location
    Austin, TX
    Posts
    6,801
    That's because you only changed your text, not the line that sets gallery.x.

  6. #6
    Junior Member
    Join Date
    Dec 2008
    Posts
    12
    Quote Originally Posted by 5TonsOfFlax View Post
    That's because you only changed your text, not the line that sets gallery.x.
    Ok, thanks a lot, that's a goood step forward.

    The only thing now is that the gallery only moves to the far left of the page. Is there a way to work with negative numbers with the slider.

    For example, when the slider is at '0', the gallery is on the left edge of the stage. I want it to go beyond this so that it goes off the left side of the stage. This would probably mean that the value would have to be around '-2000'.

    I have tried playing with this but I can't seem to make it work.

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