2 Replies Latest reply on Feb 6, 2007 10:04 AM by Hompe123

    Scroll button

    Hompe123 Level 1
      Hi,

      I´ve done two buttons. One up and one down and I´ve written the script underneath to the buttons linked to a text instance. What I´d like them to do is not to onPress just scroll one line up or down but a smooth motion. How do I do this and is it possible to control the acceleration of the motion. Fyi: the text field will be connected to a XML or a .txt file so that the user may update the textbox.

      J

      - - -

      The Script:

      upArrow.onPress = function() {
      scrollText.scroll -= 1;
      };
      downArrow.onPress = function() {
      scrollText.scroll += 1;
      };
        • 1. Re: Scroll button
          abeall Level 3
          Well the issue is that text scroll is line by line, so you can't really make it smooth. What you would do is put the TextField in a MovieClip or otherwise clip it(for instance using a mask or scrollRect) and then move the the Texfield/MovieClip container using the _y property. This will require a bit of extra code, and then you have to think about enforcing limits. For instance, using TextField.scroll you don't have to worry about scrolling past the limits, but if you are moving the object using _y there is no inherit boundary to hit, so you have to consider at what point should it stop scrolling, etc.
          • 2. Re: Scroll button
            Hompe123 Level 1
            Okey, probably the mask idea suits my needs the most. What kind of code do you meen I have to ad to the TextField/MovieClip container. How do I enforce limits? This is kind of were my limit are knowledge wise in Flash :-)

            Johan