Flashで可変するテキストフィールドを作るサンプルが


紹介されていたのでメモひらめき電球


使えるかもニコニコ


可変するテキストフィールドとフキダシのサンプル|_level0.CUPPY


以下引用です。


test_txt.autoSize = "left"; function setText( str) {
 test_txt.multiline= test_txt.wordWrap = true;
 test_txt._width = 300;//改行する場合の幅固定値
 test_txt.text = str;
 test_txt.multiline= test_txt.wordWrap = ( test_txt.maxscroll >1);//スクロールしてなかったら1行にする

}


テキストの末尾に「...」を付けるサンプルも紹介されていたのでメモひらめき電球


test_txt._width = 100; test_txt.text = "あああああああああああああああああああ";

while( test_txt.maxhscroll > 0 ) {

test_txt.text = test_txt.text.slice( 0, test_txt.text.length -1 );

}

// …ぶんを1字削って…と連結

test_txt.text = test_txt.text.slice( 0, test_txt.text.length -1 )+ "…";