1 Reply Latest reply on Mar 29, 2007 3:46 AM by Lukewig

    Autoscroll on mousewithin

    wgb14 Level 1
      Hi all,

      I wonder if you can help me with this. I have a text cast member with 5 phrases. Now because of space constrains only the 4 phrases are visible in my text member on the stage. I would like to allow my text member to autoscroll down once my user passes the cursor over the 4 phrase and scroll up again once he passes the cursor over the 5th phrase. This is what i have so far

      global linetext,gBottomLine

      on mousewithin (me)

      pointClicked = _mouse.mouseLoc
      thisSprite = sprite(me.spriteNum)
      currentMember = thisSprite.member
      lineNum = thisSprite.pointToLine(pointClicked)
      lineText = currentMember.line[lineNum]

      if lineNum="3" then
      scrollByLine member("test"), 1


      if lineNum="4" then
      scrollByLine member("test"), 1
      end if
      end if


      The problem in the above code is that the text trembles once I try to pass the cursor over phrase 4. This tremble is not hapening if i will replace the mousewithin with mouseenter. Is there any way to accomplish what i want?

      Many thanks
        • 1. Re: Autoscroll on mousewithin
          Lukewig Level 1

          I'm not sure what the problem you're experiencing is (though its probably to do with the cursor being between lines, so when you scrollby line it wants to scroll back each time) -- but another way to approach the 'autoscroll' is to (a) work out where you want to scroll the text to, and then (b) each enterframe event, modify the current scrolltop of the text member until it reaches the desired amount. Something like this (a behaviour on a sprite with a Text member):