Scroll buttons

Hey guys,

How do I create a button that scrolls the screen to the right (example: in settings, you tap “wi-fi” and it scrolls to the right (opening a new scene). And when you hit “back”, it scrolls back to the same height it was before)

Thanks!

Gustavo [import]uid: 95495 topic_id: 26314 reply_id: 326314[/import]

Hi Gustavo,

I’m having trouble understanding your question - you want a button that scrolls to the right but then another button that does something to do with height?

Could you perhaps try to clarify for me, please?

Peach :slight_smile: [import]uid: 52491 topic_id: 26314 reply_id: 106698[/import]

Hi Peach,

It probably sounded wrong. I actually have trouble understanding how those buttons from lists (such as Settings) work. I mean, is all the content of Settings in one scene, and the user just go around the scene by clicking the buttons, or one button (wifi for instance) calls another scene?
[import]uid: 95495 topic_id: 26314 reply_id: 106709[/import]

You mean something like this?

  
transition.to(myScene,{x=-1536, time=500})  

Joakim [import]uid: 81188 topic_id: 26314 reply_id: 106732[/import]

So it is all in a really big scene?

Can you post an example with one button? Like, the whole thing…

Thank you, sorry for the trouble!! [import]uid: 95495 topic_id: 26314 reply_id: 106773[/import]

This is just a rough sample written directly and not tested…

[code]

local btn = nil;
local scrollScene = nil;

scrollScene = function( event )
if event.phase==“ended” then
transition.to(myScene,{x=-1536, time=500})
end
end

btn = display.newImage(“images/button.png”, 100,100);
btn:addEventListener(“touch”, scrollScene);

[/code] [import]uid: 81188 topic_id: 26314 reply_id: 106775[/import]

Hmmm, I just misunderstood your question…so my sample code is maybe not the correct.

Are u using storyboard, listview or groups?

Joakim [import]uid: 81188 topic_id: 26314 reply_id: 106776[/import]

I’m sorry, I don’t know what those are for!

Should I be using one of them? ( I mean, for everything or for this specific task only)

Yes, I am not being very clear on what I want…I need to create an app that is a list, divided into categories.

[import]uid: 95495 topic_id: 26314 reply_id: 106779[/import]

You should maybe look at the director class. You can download it here on the site and run the samples provided, to see if it can be useful. [import]uid: 81188 topic_id: 26314 reply_id: 106786[/import]

Oh, that’s what you meant. Yes, I use director class.

Do you know any scene transition effects? For instance, I call another scene with director, but I don’t know how to slide to another scene, it just changes. [import]uid: 95495 topic_id: 26314 reply_id: 106800[/import]

For other Director questions please ask in the Director subforum - but here is a list for you :slight_smile:

[lua]director:changeScene(“scene”, “moveFromRight”)
director:changeScene(“scene”, “overFromRight”)
director:changeScene(“scene”, “moveFromLeft”)
director:changeScene(“scene”, “overFromLeft”)
director:changeScene(“scene”, “overFromTop”)
director:changeScene(“scene”, “overFromBottom”)
director:changeScene(“scene”, “fade”)
director:changeScene(“scene”, “flip”)
director:changeScene(“scene”, “downFlip”)[/lua]

Hope that helps!

Peach [import]uid: 52491 topic_id: 26314 reply_id: 106852[/import]