[Behavior] scrolling (for text/sprite font plugin)

Post your completed addons to share with the community

Post » Sat May 26, 2012 3:55 am

Document , plugin and sample capx files are included
Last edited by rexrainbow on Sun Jan 17, 2016 1:56 am, edited 1 time in total.
B
97
S
22
G
178
Posts: 4,121
Reputation: 104,049

Post » Tue Jun 05, 2012 8:39 am

When I open up the scrollbar sample, it also looks like I need Touch Wrap plugin, Drag & Drop2 behavior, as well as the Boundary behavior.

But this is awesome anyway, I think I can use this for my game.
B
16
S
4
G
1
Posts: 47
Reputation: 2,542

Post » Tue Jun 05, 2012 9:24 am

@Python

Yes, to open my sample capx, you need
Touch Wrap plugin
Drag & Drop2 behavior
Boundary behavior

and
scrolling behavior

You might build your own scroll-bar without my plugins.rexrainbow2013-03-26 23:59:50
B
97
S
22
G
178
Posts: 4,121
Reputation: 104,049

Post » Tue Jul 31, 2012 1:07 am

Update

Add action:next page.
For example, if text could display 4 lines, the "one page" is 4 line in this situation.

Here is a sample that combining scrolling with typing in text object.
Capxrexrainbow2012-07-31 03:55:04
B
97
S
22
G
178
Posts: 4,121
Reputation: 104,049

Post » Mon Aug 13, 2012 8:34 pm

How do you set what shows up on each new line and page? What are the commands? Awesome plugin, thanks.
B
49
S
19
G
9
Posts: 431
Reputation: 10,001

Post » Mon Aug 13, 2012 11:14 pm

@Draspur

The content of each line or each page is calculated internal by this behavior. You might see the source code of this behavior.
line 120: get total lines of content
[code]inst.draw(ctx);[/code]
line 122: get visible lines count of this textbox
[code]this.visible_lines = Math.floor(inst.height/inst.pxHeight);[/code]
line 91: fuction of setting visible content
[code]behinstProto._get_visible_lines = function (start_line_index) {...}[/code]rexrainbow2012-08-13 23:26:25
B
97
S
22
G
178
Posts: 4,121
Reputation: 104,049

Post » Tue Aug 14, 2012 1:49 am

Oh thanks, so then how would I choose what goes on which lines? Does this only work with numbers? I'm very new to C2 Sorry and Thanks!Draspur2012-08-14 01:52:31
B
49
S
19
G
9
Posts: 431
Reputation: 10,001

Post » Tue Aug 14, 2012 3:48 am

@Draspur

Line number or percentage. See sample capx at first post.rexrainbow2012-08-14 03:49:09
B
97
S
22
G
178
Posts: 4,121
Reputation: 104,049

Post » Tue Aug 14, 2012 8:20 pm

I have, but I just see "str(loopindex("i")) & newline",

I tried the newline function but it gave me errors. If I wanted to have the first line say hi and the next say hello, what would I put into it's text? "Hi" & newline "Hello" doesn't work. That's what I'm asking. Sorry for having difficulty.
B
49
S
19
G
9
Posts: 431
Reputation: 10,001

Post » Wed Aug 15, 2012 4:20 am

@Draspur

Try to use "action: Set content" to assign text directly.rexrainbow2012-08-15 04:20:56
B
97
S
22
G
178
Posts: 4,121
Reputation: 104,049

Next

Return to Completed Addons

Who is online

Users browsing this forum: No registered users and 2 guests