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 *wink*

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

    translation difficulties *huh*

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

    Code
    <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>
  • Hi) Thanks for replies! *wink* Спасибо))

    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*

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!