Page 1 of 1

How do I make scrollable content ?

PostPosted: Sun Sep 14, 2014 3:20 pm
by nemoidstudio
Hi there,

I have just started using construct 2, it looks very nice and we are considering using it for our new game. However one feature we need and I didn't find how to achieve is "scrollable content". What I mean by "scrollable content" is the same thing you can do in an HTML page on a DIV with the CSS property overflow set to scroll. For example .
I have found an attempt with construct described here: but it seems to only works with lines of text. What we need is to have any kind of content to be scrollable (sprites, buttons, etc.). It must also work on touch devices.

Any ideas on how we can implement this?
Thanks a lot.

Re: How do I make scrollable content ?

PostPosted: Sun Sep 14, 2014 3:24 pm
by nemoidstudio
Sorry the 2 links I had in my previous message were automatically removed.... :(
Search google for "css overflow scroll example" to see what i am trying to describe.
Search this forum for "[Behavior] scrolling (for text/sprite font plugin)" to see the example with text only.

Re: How do I make scrollable content ?

PostPosted: Fri Sep 19, 2014 9:56 am
by nemoidstudio
Hey,

So I tried to build such a widget myself.
I used a sprite with a DragDrop behavior attached set axes vertical only, pinned some other sprites on it to scroll with and added two sprites above and under with a blend mode set to source out to hide the scroll pan where you should not see it.
Better than words please look at the attached project to understand the trick I used.

There are still several problems :
- using the builtin DragDrop there is no momentum scrolling as you are used to see on touch devices
- scrolling doesn't end at the end of the pan
- having to add 2 sprites to hide content rather than 1 to make content visible is rather tedious. I dindn't find how to do the other way
- there is no scroll bar

I'd greatly appreciate comments on this and ideas on how to fix the above issues


Thanks a lot.

Re: How do I make scrollable content ?

PostPosted: Fri Sep 19, 2014 1:57 pm
by Wisdoms
@nemoidstudio

This is what i've got so far:

You're gonna need the Boundary behavior to open it.

Scrolling.capx



in your capx you could use the Boundary behavior to bound ScrollPan to a certian point where you can't scroll up or down.

Re: How do I make scrollable content ?

PostPosted: Fri Sep 19, 2014 2:28 pm
by nemoidstudio
@Wisdoms

Thanks for the Boundary behavior, one problem solved!