Quick Links: Download Gideros Studio | Gideros Documentation | Gideros Development Center | Gideros community chat | DONATE
Scroll A Text — Gideros Forum

Scroll A Text

talistalis Guru
edited July 2012 in General questions
Hi everyone,

I want to scroll a text with swiping finger on screen. (Like a listview in android)
I have done this one:
 
local yy
local str="some random text e random text e random text e random text e random text e random text e random text e random text e random texte random text e random text e random text e random texte random text e random text e random text e random texte random text e random text e random text e random texte random text e random text e random text e random texte random text e random text e random text e random texte random text e random text e random text e random texte random text e random text e random text e random texte random text e random text e random text e random texte random text e random text e random text e random texte random text e random text e random text e random texte random text e random text e random text e random texte random text e random text e random text e random texte random text e random text e random text e random texte random text e random text e random text e random texte random text e random text e random text e random texte random text e random text e random text e random texte random text e"
local text6 = TextWrap.new(str, 400, "left")
text6:setLineSpacing(5)
text6:setPosition(10,50)
text6:setTextColor(0x000000)
text6:setFont(font)
 
text6:addEventListener(Event.MOUSE_MOVE,function(event) 
text6:setPosition(50,event.y-yy)
end)
 
 
text6:addEventListener(Event.MOUSE_DOWN,function(event) yy=event.y
end)
Like this the text is scrolling in y direction like i wanted but on every retouch it is sliding to retouched y coordinate.
I want to imitate a listview(scrollview), like it should stay where it was:D
Any comments will be appreciated:D

Comments

  • You need to factor in the Y position of text6, otherwise you're changing it as if it was always starting at Y coordinate 0.
    text6:addEventListener(Event.MOUSE_MOVE,function(event) 
    text6:setPosition(50,event.y-yy+text6:getY())
    end)

    Likes: talis

    Dislikes: harytri

    +1 -1 (+1 / -1 )Share on Facebook
  • talistalis Guru
    edited July 2012
    I just want to say it is perfect. Thank you very much guys. I love this community;)
    @zvardin thanks for the comment you are right I added y coordinate plus boundaries and worked like a charm.

    But @atilim's version is far way better than my implementation. Anyway I am learning;)

    Thanks for showing @ar2rsawseen.

Sign In or Register to comment.