Integration with the TextFormat Object


The MulticolumnTextField component can be integrated with existing Text Objects in your flash file. The following example demonstrates how.

  1. Create two layers on your timeline
  2. Name the bottom layer 'component' and place an instance of your MulticolumnTextField component on the stage in this layer, giving it the instance name 'myInstance'
  3. Name the top layer 'script' and, selecting the keyframe on the timeline, enter the following script into the ActionScript panel:


//create a new TextFormat Object
myTextFormat = new TextFormat();
//set the font of the new TextFormat Object to "verdana"
myTextFormat.font = "verdana";
//assign content to the Multicolumn Text Field component
myInstance.mtftext = "Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Integer...;"
//apply the TextFormat to your Multicolumn Text Field Instance
myInstance.mtftextformat = myTextFormat;


Note:
The content specified in this example would not be sufficient to cause the creation of more than one column, it has been reduced in size for the purposes of demonstration.

Note:
The TextFormat object does not allow a user to be selective regarding style aspects of the text (this is a characteristic of the TextFormat object unrelated to the component). If you do not specify a property of the TextFormat object flash uses the default, consequently in the example above despite the size property not being specifically declared flash will set the size of the text to 12 which is the system default.

If you do not specify a TextFormat object to be applied to the Multicolumn Text Field component the component creates one for you and applies it to your columns. The component bases this TextFormat object on the entries in the custom user interface, and if none are specified, it uses default values. The default settings for the TextFormat object and the MulticolumnTextField component are as follows:
 

Property name TextFormat object default value Multicolumn Text Field default value
align "left" "left"
blockIndent 0 0
bold false false
bullet false false
color 0 000000
font "Times" "Times"
indent 0 0
italic 0 0
leading 0 2
leftMargin 0 0
rightMargin 0 0
size 12 12
target "" no default
underline false false
url "" no default