A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: how to auto fit external text variable

  1. #1
    Senior Member
    Join Date
    May 2016
    Posts
    451

    how to auto fit external text variable

    hello all

    this is swishmax file





    the file loads external variable But as you can see in the picture, there is a problem,
    which is that the words are fragmented on the lines

    Is there a solution to this problem

    swishmax file : https://app.box.com/s/wstdd1u3hkqq795if6svjcoj0oevb07l


    thanks for help

  2. #2
    Client Software Programmer AS3.0's Avatar
    Join Date
    Apr 2011
    Posts
    1,404
    Hi,

    At the ContentScroller scripting section where you originally setup the area to load the "story.txt" you can store a new font size to adjust the fitment of the text:
    PHP Code:
    if (parameters.initOnLoad) {
    this.initScroll();
    this.SetSize(500,200)//Width, height.
    this._x=Stage.width/2-this._width/2//Center the component by x.
    this._y=Stage.height/2-this._height/2//Center the component by y.
    }
    }

    onSelfEvent (load) {
    var 
    text_size=13//Font size onload.
    var text_color=0xFF0000//Font color onload.
    loadVariables("story.txt");//Load story.txt

    If you want to modify the textFormat even more you can go to the textOnScroll() scripting section of the ContentScroller:
    PHP Code:
    var tf:TextFormat = new TextFormat();//Create textformat variable.
    tf.size _root.ContentScroller.text_size;//Set the size to the variable called text_size.
    tf.color =  _root.ContentScroller.text_color;//Set the color to the variable called color.
    this.setTextFormat(tf)//Apply the text format properties to the textArea.
    this._height=this._parent._height//Adjust the textfields height. 
    download v2 (swish)

    swish font progress:
    The font project is about 65% complete I was working on the glyph reader to perform the lineTo operations.
    Last edited by AS3.0; 02-04-2023 at 11:31 PM.

  3. #3
    Client Software Programmer AS3.0's Avatar
    Join Date
    Apr 2011
    Posts
    1,404
    Do you want each line split by the periods & 1 sentence per line?

  4. #4
    Senior Member
    Join Date
    May 2016
    Posts
    451
    yes

  5. #5
    Senior Member
    Join Date
    May 2016
    Posts
    451
    not working

  6. #6
    Senior Member
    Join Date
    May 2016
    Posts
    451

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center