Loading formatted external text into flash?

Hello all,

I want to load formatted text into a text field in flash, i mean by formatted text is that if it was written in MS word the text will still have the proper line spacing and font and bullets for example.

the main question is can i load a text into flash from a source other than NOTEPAD file a varibale that contains a string in flash.

Thank you

:pope:

salam!

there is a way to insert text from a variable… you will need to use a dynamic text field though…

as for the formatting, see below

this is compliments of the flash mx help file:

Preserving rich text formatting

Flash lets you preserve rich text formatting in input and dynamic text fields. If you select the Render text as HTML formatting option in the Property inspector or set the html property of the TextField object to true, Flash preserves basic text formatting (such as font, style, color, and size) and hyperlinks in the text field by automatically applying the corresponding HTML tags when you export the SWF file. You must use ActionScript to apply HTML tags to text fields, either as part of the value of a text field variable, or as the value of the htmlText property of the TextField object.

The following HTML tags are supported in text fields: < A >, < B >, < F O N T C O L O R >, < F O N T F A C E >, < F O N T S I Z E >, < I >, < P >, and < U >.

The following HTML attributes are supported in text fields: LEFTMARGIN, RIGHTMARGIN, ALIGN, INDENT, and LEADING.

To use the text field variable to preserve rich text formatting:

1
Select a text field on the Stage.

2
Assign the text field a variable name in the Property inspector.

3
Do one of the following:

Select the Render Text as HTML button in the Property inspector.

In the Actions panel, set the html property of the TextField object to true.

4
Set the text field variable to a value that includes HTML tags.

For example, the following code assigns a value to a text field with the variable name txt. The text renders in bold if you check the Render text as HTML box in the Property inspector, or if the html property is set to true:

txt = " < B > C h r i s < B > " ;

In the following example, the variable name of the text field is also txt. Because the value of the html property of the TextField object is set to true, you can use the variable name to render the text field in bold without selecting the Render Text as HTML button in the Property inspector:

instName.html = true;
txt = "< B > C h r i s < / B > " ;

To use the text field instance name to preserve rich text formatting:

1
Do one of the following:

Use the Text tool to drag a text field on the Stage. Assign the text field an instance name in the Property inspector.

Use ActionScript to create a text field dynamically with the createTextField method. Assign the text field an instance name as a parameter of the createTextField method.

2
Do one of the following:

Select the Render text as HTML button in the Property inspector.

In the Actions panel, set the html property of the TextField object to true, as in the following:

instanceName.html = true;

3
In the Actions panel, set the htmlText property to a value that includes HTML tags.

For example, if you have a dynamic text field on the Stage with the instance name instName, the following code renders the text in bold:

instName.htmlText = "< B > C h r i s < / B > " ;

thanks for the reply

helped a lot

pleasure… :slight_smile:

look and you shall find… ask and you shall receive :stuck_out_tongue: