Scrollbar tutorial: html appears in external file

hiya!

i’ve used your great “external file with scrollbar UI component” tutorial. text appears and scrolls. thanks alot!

but i want to use the allowed html in the external file: bold, a href, font, etc.

i’m horrified to see that even with the html option selected, when you attach the scrollbar UI to the textfield, the html reverts to code! no bold text but the html code displays! yikes!

any workarounds?

tia,

f

Have something to the effect of…

_root.yourTextBox.<B>html</B> = true;
_root.yourTextBox.<B>htmlText</B> = “<I>HELP</I>”

The htmlText part is required for flash to know that the text being showed should be converted.

yes!

this is the key! thanks muchly! the final code now reads:

//instantiating the load & naming the external file

loadText = new loadVars();
loadText.load(“mytext.txt”);

//creating the loadVarsText function

loadText.onLoad = function() {
box.htmlText = this.textbox;
};

final question: how can i keep my text from jamming right up against the textfield border on the left? there doesn’t seem to be any equivalent of padding or margin. . .do i just have to put spaces before the text on every line?

thanks again,

f

I am not testing this but is something along the lines of…


myformat = new TextFormat();
	myformat.leftMargin = 10;
	myformat.rightMargin = 10;
_root.myTextBox.setTextFormat(myformat);

can you show me how it was done? i was confused

newbie

hiya!

well, thanks for the pointer! my textfield’s instance name is "box; variable name “textbox.” after your hints i found in the actionscript manual the methods & attributes you were kind enough to offer.

so the alignment portion of the code is now:

//instantiate the format

myformat = new TextFormat();

//set margins for textfield

myformat.leftMargin = 10;
myformat.rightMargin = 25;

//apply format to textfield instance

_root.box.setTextFormat(myformat);

however, while this does work when the text content is a variable inside the flash movie, it doesn’t seem to work when you are loading an external html file. what dumb thing am i missing?

is there a different method or attribute for the html? should i just put this alignment in the external file, as i can with the html tags? the actionscript manual doesn’t offer an example of the correct usage of the alignment tags as supported html, although it does say they are supported. . .

any examples?

thanks again,

f

:frowning: is it possible to inclue pictures (gifs/jpgs) int the txt external file ?

Unfortunately no it isn’t:(

it all works now! here’s the best practice, i think:

//create the load

var loadText = new loadVars();

//create and define the function & formatting

loadText.onLoad = function() {
var myformat = new TextFormat();
myformat.leftMargin = 20;
myformat.rightMargin = 10;
_root.box.htmltext = this.textbox;
_root.box.setTextFormat(myformat);
};

//give the name of the external html file

loadText.load(“mytext.txt”);

thanks for all your help!