A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: how to auto fit external text variable

Threaded View

  1. #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.

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