Sie sind nicht angemeldet.

  • »Alexey Tkachenko« ist der Autor dieses Themas

Beiträge: 770

Wohnort: Russian Federation

Beruf: Interpreting, Building virtual tours

  • Nachricht senden

1

Montag, 19. Oktober 2015, 14:58

apply maxwidth to textfield layer

Hi)

Recently I wanted to make a VT title using textfield. The task was to make a background for it and make the text re-adjust if there's too much text in it.

E.g. here: http://vt.most-inform.com/bugs/text/

The upper text has autowidth=true and with too much text goes beyond the screen. But I would like the text always look like the second one - some padding and background and the text divides into two lines if its width reaches some value. Of course I can use width ="80%", but in this case the background is too much wide, it looks worse (like the third text).

I tried using maxwidth. but to no success.

I wonder maybe there's some trick ;-)
Regards,

Alexey

Sergey74

Fortgeschrittener

Beiträge: 193

Wohnort: Russia, Chelyabinsk

Beruf: professional noob

  • Nachricht senden

2

Montag, 19. Oktober 2015, 20:11

Если я правильно понял английский, то можно попробовать написать экшен, если ширина area больше (например) 400px, то задаём ширину слоя с текстом (например) 200px, если ширина area меньше 400px, то задаём ширину слоя с текстом выражением ширина area минус отступ слоя слева и справа, т.е. минус два отступа.
translation difficulties *huh*

3

Dienstag, 20. Oktober 2015, 01:11

What about having outer container layer with calculated width and textfield fitting 100% in it?

Quellcode

1
2
3
<layer name="layer_out" keep="true" type="container" align="top" width="calc:stagewidth - 20" height="100%" maskchildren="true" visible="true">
 <layer name="long_text2" keep="true" url="%SWFPATH%/plugins/textfield.swf" x="0" y="300" enabled="false" align="lefttop" width="100%" padding="10 15" background="true" backgroundcolor="0x1b3f5e" backgroundalpha="0.9" border="false" html="data:long_text" css.no-mobile="text-align:left; font-family:Arial; font-size:25px; color:#ffffff;" css.mobile="text-align:left; font-family:Arial; font-size:30px;  color:#ffffff;"/>
</layer>

  • »Alexey Tkachenko« ist der Autor dieses Themas

Beiträge: 770

Wohnort: Russian Federation

Beruf: Interpreting, Building virtual tours

  • Nachricht senden

4

Dienstag, 20. Oktober 2015, 09:13

Hi) Thanks for replies! ;-) Спасибо))

Maybe I was not clear enough in my explanation: the text layer is the VT title which takes scene name, so text length can be long or short. My idea was to keep the background (looks better) and if the text is too long - then make it drop into two lines.

I adjusted my link a bit (clear cache before looking):

http://vt.most-inform.com/bugs/text/


If you watch the link in Flash, then 'Lower' text is almost what I want to achieve. Just press 'Change lower text html' button and you will see what I wanted to achieve. The ''check_text_size' action works almost fine in Flash, but html5 fails for some reason.

I just thought maybe there's some easier combination of textfield settings to achieve this effect *smile*
Regards,

Alexey

5

Dienstag, 20. Oktober 2015, 12:44

I still can't say if I understood correctly, but than in your case I would propose to try with autowidth and using onautosized attribute check size compared to screenwidth and adapt accordingly.