blob: 75f937d1260bbe8d2d87270de84b366265861940 [file] [log] [blame]
<?xml version="1.0" encoding="UTF-8"?><apiPackage xmlns:ditaarch="http://dita.oasis-open.org/architecture/2005/" id="flash.text" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiPackage/apiPackage "><apiName class="- topic/title reference/title apiRef/apiName ">flash.text</apiName><apiDetail class="- topic/body reference/refbody apiRef/apiDetail "/><apiClassifier languages="" id="flash.text:TextExtent" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiClassifier/apiClassifier "><apiName class="- topic/title reference/title apiRef/apiName ">TextExtent</apiName><shortdesc class="- topic/shortdesc ">
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
The TextExtent class contains information about the extents of some
text in a text field.</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiPlatform description="" name="Flash" version="9" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata></prolog><apiClassifierDetail class="- topic/body reference/refbody apiRef/apiDetail apiClassifier/apiClassifierDetail "><apiClassifierDef class="- topic/section reference/section apiRef/apiDef apiClassifier/apiClassifierDef "><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiStatic class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiStatic "/><apiBaseClassifier class="- topic/xref reference/xref apiRef/apiRelation apiClassifier/apiBaseClassifier ">Object</apiBaseClassifier></apiClassifierDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
The TextExtent class contains information about the extents of some
text in a text field. Objects of this class are returned by the
<codeph class="+ topic/ph pr-d/codeph ">TextFormat.getTextExtent</codeph> method.
</apiDesc></apiClassifierDetail><apiConstructor id="flash.text:TextExtent:TextExtent" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiOperation/apiOperation apiOperation/apiConstructor"><apiName class="- topic/title reference/title apiRef/apiName ">TextExtent</apiName><shortdesc class="- topic/shortdesc "/><prolog class="- topic/prolog "/><apiConstructorDetail class="- topic/body reference/refbody apiRef/apiDetail apiOperation/apiOperationDetail apiOperation/apiConstructorDetail"><apiConstructorDef class="- topic/section reference/section apiRef/apiDef apiOperation/apiConstructorDef "><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiParam class="- topic/ph reference/ph apiRef/apiDefItem apiOperation/apiParam "><apiItemName class="- topic/keyword reference/keyword apiRef/apiItemName ">width</apiItemName><apiOperationClassifier class="- topic/xref reference/xref apiRef/apiRelation apiOperation/apiOperationClassifier ">Number</apiOperationClassifier></apiParam><apiParam class="- topic/ph reference/ph apiRef/apiDefItem apiOperation/apiParam "><apiItemName class="- topic/keyword reference/keyword apiRef/apiItemName ">height</apiItemName><apiOperationClassifier class="- topic/xref reference/xref apiRef/apiRelation apiOperation/apiOperationClassifier ">Number</apiOperationClassifier></apiParam><apiParam class="- topic/ph reference/ph apiRef/apiDefItem apiOperation/apiParam "><apiItemName class="- topic/keyword reference/keyword apiRef/apiItemName ">textFieldWidth</apiItemName><apiOperationClassifier class="- topic/xref reference/xref apiRef/apiRelation apiOperation/apiOperationClassifier ">Number</apiOperationClassifier></apiParam><apiParam class="- topic/ph reference/ph apiRef/apiDefItem apiOperation/apiParam "><apiItemName class="- topic/keyword reference/keyword apiRef/apiItemName ">textFieldHeight</apiItemName><apiOperationClassifier class="- topic/xref reference/xref apiRef/apiRelation apiOperation/apiOperationClassifier ">Number</apiOperationClassifier></apiParam><apiParam class="- topic/ph reference/ph apiRef/apiDefItem apiOperation/apiParam "><apiItemName class="- topic/keyword reference/keyword apiRef/apiItemName ">ascent</apiItemName><apiOperationClassifier class="- topic/xref reference/xref apiRef/apiRelation apiOperation/apiOperationClassifier ">Number</apiOperationClassifier></apiParam><apiParam class="- topic/ph reference/ph apiRef/apiDefItem apiOperation/apiParam "><apiItemName class="- topic/keyword reference/keyword apiRef/apiItemName ">descent</apiItemName><apiOperationClassifier class="- topic/xref reference/xref apiRef/apiRelation apiOperation/apiOperationClassifier ">Number</apiOperationClassifier></apiParam></apiConstructorDef></apiConstructorDetail></apiConstructor><apiValue id="flash.text:TextExtent:ascent" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiValue/apiValue "><apiName class="- topic/title reference/title apiRef/apiName ">ascent</apiName><shortdesc class="- topic/shortdesc "/><prolog class="- topic/prolog "/><apiValueDetail class="- topic/body reference/refbody apiRef/apiDetail apiValue/apiValueDetail "><apiValueDef class="- topic/section reference/section apiRef/apiDef apiValue/apiValueDef "><apiProperty class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiProperty "/><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiDynamic class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiDynamic "/><apiValueClassifier class="- topic/xref reference/xref apiRef/apiRelation apiValue/apiValueClassifier ">Number</apiValueClassifier></apiValueDef></apiValueDetail></apiValue><apiValue id="flash.text:TextExtent:descent" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiValue/apiValue "><apiName class="- topic/title reference/title apiRef/apiName ">descent</apiName><shortdesc class="- topic/shortdesc "/><prolog class="- topic/prolog "/><apiValueDetail class="- topic/body reference/refbody apiRef/apiDetail apiValue/apiValueDetail "><apiValueDef class="- topic/section reference/section apiRef/apiDef apiValue/apiValueDef "><apiProperty class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiProperty "/><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiDynamic class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiDynamic "/><apiValueClassifier class="- topic/xref reference/xref apiRef/apiRelation apiValue/apiValueClassifier ">Number</apiValueClassifier></apiValueDef></apiValueDetail></apiValue><apiValue id="flash.text:TextExtent:height" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiValue/apiValue "><apiName class="- topic/title reference/title apiRef/apiName ">height</apiName><shortdesc class="- topic/shortdesc "/><prolog class="- topic/prolog "/><apiValueDetail class="- topic/body reference/refbody apiRef/apiDetail apiValue/apiValueDetail "><apiValueDef class="- topic/section reference/section apiRef/apiDef apiValue/apiValueDef "><apiProperty class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiProperty "/><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiDynamic class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiDynamic "/><apiValueClassifier class="- topic/xref reference/xref apiRef/apiRelation apiValue/apiValueClassifier ">Number</apiValueClassifier></apiValueDef></apiValueDetail></apiValue><apiValue id="flash.text:TextExtent:textFieldHeight" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiValue/apiValue "><apiName class="- topic/title reference/title apiRef/apiName ">textFieldHeight</apiName><shortdesc class="- topic/shortdesc "/><prolog class="- topic/prolog "/><apiValueDetail class="- topic/body reference/refbody apiRef/apiDetail apiValue/apiValueDetail "><apiValueDef class="- topic/section reference/section apiRef/apiDef apiValue/apiValueDef "><apiProperty class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiProperty "/><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiDynamic class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiDynamic "/><apiValueClassifier class="- topic/xref reference/xref apiRef/apiRelation apiValue/apiValueClassifier ">Number</apiValueClassifier></apiValueDef></apiValueDetail></apiValue><apiValue id="flash.text:TextExtent:textFieldWidth" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiValue/apiValue "><apiName class="- topic/title reference/title apiRef/apiName ">textFieldWidth</apiName><shortdesc class="- topic/shortdesc "/><prolog class="- topic/prolog "/><apiValueDetail class="- topic/body reference/refbody apiRef/apiDetail apiValue/apiValueDetail "><apiValueDef class="- topic/section reference/section apiRef/apiDef apiValue/apiValueDef "><apiProperty class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiProperty "/><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiDynamic class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiDynamic "/><apiValueClassifier class="- topic/xref reference/xref apiRef/apiRelation apiValue/apiValueClassifier ">Number</apiValueClassifier></apiValueDef></apiValueDetail></apiValue><apiValue id="flash.text:TextExtent:width" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiValue/apiValue "><apiName class="- topic/title reference/title apiRef/apiName ">width</apiName><shortdesc class="- topic/shortdesc "/><prolog class="- topic/prolog "/><apiValueDetail class="- topic/body reference/refbody apiRef/apiDetail apiValue/apiValueDetail "><apiValueDef class="- topic/section reference/section apiRef/apiDef apiValue/apiValueDef "><apiProperty class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiProperty "/><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiDynamic class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiDynamic "/><apiValueClassifier class="- topic/xref reference/xref apiRef/apiRelation apiValue/apiValueClassifier ">Number</apiValueClassifier></apiValueDef></apiValueDetail></apiValue></apiClassifier><apiClassifier languages="" id="flash.text:CSMSettings" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiClassifier/apiClassifier "><apiName class="- topic/title reference/title apiRef/apiName ">CSMSettings</apiName><shortdesc class="- topic/shortdesc ">
The CSMSettings class contains properties for use with the
TextRenderer.setAdvancedAntiAliasingTable() method
to provide continuous stroke modulation (CSM).</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage name="ActionScript" version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="Flash" version="9" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata><asCustoms class="+ topic/metadata adobe-api-d/asCustoms "><internal>Not functioning correctly. Bug report 193833
</internal></asCustoms></prolog><apiClassifierDetail class="- topic/body reference/refbody apiRef/apiDetail apiClassifier/apiClassifierDetail "><apiClassifierDef class="- topic/section reference/section apiRef/apiDef apiClassifier/apiClassifierDef "><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiStatic class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiStatic "/><apiFinal class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiFinal "/><apiBaseClassifier class="- topic/xref reference/xref apiRef/apiRelation apiClassifier/apiBaseClassifier ">Object</apiBaseClassifier></apiClassifierDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
The CSMSettings class contains properties for use with the
<codeph class="+ topic/ph pr-d/codeph ">TextRenderer.setAdvancedAntiAliasingTable()</codeph> method
to provide continuous stroke modulation (CSM). CSM is the continuous
modulation of both stroke weight and edge sharpness.
</apiDesc></apiClassifierDetail><related-links class="- topic/related-links "><link href="flash.text.xml#TextRenderer/setAdvancedAntiAliasingTable()" class="- topic/link "><linktext class="- topic/linktext ">TextRenderer.setAdvancedAntiAliasingTable()</linktext></link></related-links><apiConstructor id="flash.text:CSMSettings:CSMSettings" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiOperation/apiOperation apiOperation/apiConstructor"><apiName class="- topic/title reference/title apiRef/apiName ">CSMSettings</apiName><shortdesc class="- topic/shortdesc ">
Creates a new CSMSettings object which stores stroke values for custom anti-aliasing settings.</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage name="ActionScript" version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="Flash" version="9" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata></prolog><apiConstructorDetail class="- topic/body reference/refbody apiRef/apiDetail apiOperation/apiOperationDetail apiOperation/apiConstructorDetail"><apiConstructorDef class="- topic/section reference/section apiRef/apiDef apiOperation/apiConstructorDef "><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiParam class="- topic/ph reference/ph apiRef/apiDefItem apiOperation/apiParam "><apiItemName class="- topic/keyword reference/keyword apiRef/apiItemName ">fontSize</apiItemName><apiOperationClassifier class="- topic/xref reference/xref apiRef/apiRelation apiOperation/apiOperationClassifier ">Number</apiOperationClassifier><apiDesc class="- topic/section reference/section apiRef/apiDesc ">The size, in pixels, for which the settings apply.
</apiDesc></apiParam><apiParam class="- topic/ph reference/ph apiRef/apiDefItem apiOperation/apiParam "><apiItemName class="- topic/keyword reference/keyword apiRef/apiItemName ">insideCutoff</apiItemName><apiOperationClassifier class="- topic/xref reference/xref apiRef/apiRelation apiOperation/apiOperationClassifier ">Number</apiOperationClassifier><apiDesc class="- topic/section reference/section apiRef/apiDesc ">The inside cutoff value, above which densities are set to a maximum density
value (such as 255).
</apiDesc></apiParam><apiParam class="- topic/ph reference/ph apiRef/apiDefItem apiOperation/apiParam "><apiItemName class="- topic/keyword reference/keyword apiRef/apiItemName ">outsideCutoff</apiItemName><apiOperationClassifier class="- topic/xref reference/xref apiRef/apiRelation apiOperation/apiOperationClassifier ">Number</apiOperationClassifier><apiDesc class="- topic/section reference/section apiRef/apiDesc ">The outside cutoff value, below which densities are set to zero.
</apiDesc></apiParam></apiConstructorDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
Creates a new CSMSettings object which stores stroke values for custom anti-aliasing settings.
</apiDesc></apiConstructorDetail></apiConstructor><apiValue id="flash.text:CSMSettings:fontSize" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiValue/apiValue "><apiName class="- topic/title reference/title apiRef/apiName ">fontSize</apiName><shortdesc class="- topic/shortdesc ">
The size, in pixels, for which the settings apply.</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="Flash" version="9" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata></prolog><apiValueDetail class="- topic/body reference/refbody apiRef/apiDetail apiValue/apiValueDetail "><apiValueDef class="- topic/section reference/section apiRef/apiDef apiValue/apiValueDef "><apiProperty class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiProperty "/><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiDynamic class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiDynamic "/><apiValueClassifier class="- topic/xref reference/xref apiRef/apiRelation apiValue/apiValueClassifier ">Number</apiValueClassifier></apiValueDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
The size, in pixels, for which the settings apply.
<p class="- topic/p ">The <codeph class="+ topic/ph pr-d/codeph ">advancedAntiAliasingTable</codeph> array passed to the
<codeph class="+ topic/ph pr-d/codeph ">setAdvancedAntiAliasingTable()</codeph> method can contain multiple
entries that specify CSM settings for different font sizes. Using this
property, you can specify the font size to which the other settings apply.
</p>
</apiDesc></apiValueDetail><related-links class="- topic/related-links "><link href="flash.text.xml#TextRenderer/setAdvancedAntiAliasingTable()" class="- topic/link "><linktext class="- topic/linktext ">TextRenderer.setAdvancedAntiAliasingTable()</linktext></link></related-links></apiValue><apiValue id="flash.text:CSMSettings:insideCutoff" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiValue/apiValue "><apiName class="- topic/title reference/title apiRef/apiName ">insideCutoff</apiName><shortdesc class="- topic/shortdesc ">
The inside cutoff value, above which densities are set to a maximum density
value (such as 255).</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="Flash" version="9" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata></prolog><apiValueDetail class="- topic/body reference/refbody apiRef/apiDetail apiValue/apiValueDetail "><apiValueDef class="- topic/section reference/section apiRef/apiDef apiValue/apiValueDef "><apiProperty class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiProperty "/><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiDynamic class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiDynamic "/><apiValueClassifier class="- topic/xref reference/xref apiRef/apiRelation apiValue/apiValueClassifier ">Number</apiValueClassifier></apiValueDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
The inside cutoff value, above which densities are set to a maximum density
value (such as 255).
</apiDesc></apiValueDetail><related-links class="- topic/related-links "><link href="flash.text.xml#TextRenderer/setAdvancedAntiAliasingTable()" class="- topic/link "><linktext class="- topic/linktext ">TextRenderer.setAdvancedAntiAliasingTable()</linktext></link></related-links></apiValue><apiValue id="flash.text:CSMSettings:outsideCutoff" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiValue/apiValue "><apiName class="- topic/title reference/title apiRef/apiName ">outsideCutoff</apiName><shortdesc class="- topic/shortdesc ">
The outside cutoff value, below which densities are set to zero.</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="Flash" version="9" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata></prolog><apiValueDetail class="- topic/body reference/refbody apiRef/apiDetail apiValue/apiValueDetail "><apiValueDef class="- topic/section reference/section apiRef/apiDef apiValue/apiValueDef "><apiProperty class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiProperty "/><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiDynamic class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiDynamic "/><apiValueClassifier class="- topic/xref reference/xref apiRef/apiRelation apiValue/apiValueClassifier ">Number</apiValueClassifier></apiValueDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
The outside cutoff value, below which densities are set to zero.
</apiDesc></apiValueDetail><related-links class="- topic/related-links "><link href="flash.text.xml#TextRenderer/setAdvancedAntiAliasingTable()" class="- topic/link "><linktext class="- topic/linktext ">TextRenderer.setAdvancedAntiAliasingTable()</linktext></link></related-links></apiValue></apiClassifier><apiClassifier languages="" id="flash.text:TextColorType" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiClassifier/apiClassifier "><apiName class="- topic/title reference/title apiRef/apiName ">TextColorType</apiName><shortdesc class="- topic/shortdesc ">
The TextColorType class provides color values for the flash.text.TextRenderer class.</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="Flash" version="9" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata></prolog><apiClassifierDetail class="- topic/body reference/refbody apiRef/apiDetail apiClassifier/apiClassifierDetail "><apiClassifierDef class="- topic/section reference/section apiRef/apiDef apiClassifier/apiClassifierDef "><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiStatic class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiStatic "/><apiFinal class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiFinal "/><apiBaseClassifier class="- topic/xref reference/xref apiRef/apiRelation apiClassifier/apiBaseClassifier ">Object</apiBaseClassifier></apiClassifierDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
The TextColorType class provides color values for the flash.text.TextRenderer class.
</apiDesc></apiClassifierDetail><related-links class="- topic/related-links "><link href="flash.text.xml#TextRenderer" class="- topic/link "><linktext class="- topic/linktext ">flash.text.TextRenderer</linktext></link></related-links><apiValue id="flash.text:TextColorType:DARK_COLOR" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiValue/apiValue "><apiName class="- topic/title reference/title apiRef/apiName ">DARK_COLOR</apiName><shortdesc class="- topic/shortdesc ">
Used in the colorType parameter in the setAdvancedAntiAliasingTable() method.</shortdesc><prolog class="- topic/prolog "><author class="- topic/author ">Bob Pappas
</author><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="Flash" version="9" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata></prolog><apiValueDetail class="- topic/body reference/refbody apiRef/apiDetail apiValue/apiValueDetail "><apiValueDef class="- topic/section reference/section apiRef/apiDef apiValue/apiValueDef "><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiStatic class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiStatic "/><apiData class="- topic/ph reference/ph apiRef/apiData ">dark</apiData><apiValueClassifier class="- topic/xref reference/xref apiRef/apiRelation apiValue/apiValueClassifier ">String</apiValueClassifier></apiValueDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
Used in the <codeph class="+ topic/ph pr-d/codeph ">colorType</codeph> parameter in the <codeph class="+ topic/ph pr-d/codeph ">setAdvancedAntiAliasingTable()</codeph> method.
Use the syntax <codeph class="+ topic/ph pr-d/codeph ">TextColorType.DARK_COLOR</codeph>.
</apiDesc></apiValueDetail><related-links class="- topic/related-links "><link href="flash.text.xml#TextRenderer/setAdvancedAntiAliasingTable()" class="- topic/link "><linktext class="- topic/linktext ">flash.text.TextRenderer.setAdvancedAntiAliasingTable()</linktext></link></related-links></apiValue><apiValue id="flash.text:TextColorType:LIGHT_COLOR" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiValue/apiValue "><apiName class="- topic/title reference/title apiRef/apiName ">LIGHT_COLOR</apiName><shortdesc class="- topic/shortdesc ">
Used in the colorType parameter in the setAdvancedAntiAliasingTable() method.</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="Flash" version="9" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata></prolog><apiValueDetail class="- topic/body reference/refbody apiRef/apiDetail apiValue/apiValueDetail "><apiValueDef class="- topic/section reference/section apiRef/apiDef apiValue/apiValueDef "><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiStatic class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiStatic "/><apiData class="- topic/ph reference/ph apiRef/apiData ">light</apiData><apiValueClassifier class="- topic/xref reference/xref apiRef/apiRelation apiValue/apiValueClassifier ">String</apiValueClassifier></apiValueDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
Used in the <codeph class="+ topic/ph pr-d/codeph ">colorType</codeph> parameter in the <codeph class="+ topic/ph pr-d/codeph ">setAdvancedAntiAliasingTable()</codeph> method.
Use the syntax <codeph class="+ topic/ph pr-d/codeph ">TextColorType.LIGHT_COLOR</codeph>.
</apiDesc></apiValueDetail><related-links class="- topic/related-links "><link href="flash.text.xml#TextRenderer/setAdvancedAntiAliasingTable()" class="- topic/link "><linktext class="- topic/linktext ">flash.text.TextRenderer.setAdvancedAntiAliasingTable()</linktext></link></related-links></apiValue></apiClassifier><apiClassifier languages="" id="flash.text:GridFitType" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiClassifier/apiClassifier "><apiName class="- topic/title reference/title apiRef/apiName ">GridFitType</apiName><shortdesc class="- topic/shortdesc ">
The GridFitType class defines values for grid fitting in the TextField class.</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="Flash" version="9" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata></prolog><apiClassifierDetail class="- topic/body reference/refbody apiRef/apiDetail apiClassifier/apiClassifierDetail "><apiClassifierDef class="- topic/section reference/section apiRef/apiDef apiClassifier/apiClassifierDef "><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiStatic class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiStatic "/><apiFinal class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiFinal "/><apiBaseClassifier class="- topic/xref reference/xref apiRef/apiRelation apiClassifier/apiBaseClassifier ">Object</apiBaseClassifier></apiClassifierDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
The GridFitType class defines values for grid fitting in the TextField class.
</apiDesc></apiClassifierDetail><related-links class="- topic/related-links "><link href="flash.text.xml#TextField" class="- topic/link "><linktext class="- topic/linktext ">flash.text.TextField</linktext></link></related-links><apiValue id="flash.text:GridFitType:NONE" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiValue/apiValue "><apiName class="- topic/title reference/title apiRef/apiName ">NONE</apiName><shortdesc class="- topic/shortdesc ">
Doesn't set grid fitting.</shortdesc><prolog class="- topic/prolog "><author class="- topic/author ">Bob Pappas
</author><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="Flash" version="9" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata></prolog><apiValueDetail class="- topic/body reference/refbody apiRef/apiDetail apiValue/apiValueDetail "><apiValueDef class="- topic/section reference/section apiRef/apiDef apiValue/apiValueDef "><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiStatic class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiStatic "/><apiData class="- topic/ph reference/ph apiRef/apiData ">none</apiData><apiValueClassifier class="- topic/xref reference/xref apiRef/apiRelation apiValue/apiValueClassifier ">String</apiValueClassifier></apiValueDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
Doesn't set grid fitting. Horizontal and vertical lines
in the glyphs are not forced to the pixel grid.
This constant is used in setting the <codeph class="+ topic/ph pr-d/codeph ">gridFitType</codeph> property of the
TextField class. This is often a good setting for animation
or for large font sizes.
Use the syntax <codeph class="+ topic/ph pr-d/codeph ">GridFitType.NONE</codeph>.
</apiDesc></apiValueDetail><related-links class="- topic/related-links "><link href="flash.text.xml#TextField/gridFitType" class="- topic/link "><linktext class="- topic/linktext ">flash.text.TextField.gridFitType</linktext></link></related-links></apiValue><apiValue id="flash.text:GridFitType:PIXEL" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiValue/apiValue "><apiName class="- topic/title reference/title apiRef/apiName ">PIXEL</apiName><shortdesc class="- topic/shortdesc ">
Fits strong horizontal and vertical lines to the pixel grid.</shortdesc><prolog class="- topic/prolog "><author class="- topic/author ">Bob Pappas
</author><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="Flash" version="9" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata></prolog><apiValueDetail class="- topic/body reference/refbody apiRef/apiDetail apiValue/apiValueDetail "><apiValueDef class="- topic/section reference/section apiRef/apiDef apiValue/apiValueDef "><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiStatic class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiStatic "/><apiData class="- topic/ph reference/ph apiRef/apiData ">pixel</apiData><apiValueClassifier class="- topic/xref reference/xref apiRef/apiRelation apiValue/apiValueClassifier ">String</apiValueClassifier></apiValueDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
Fits strong horizontal and vertical lines to the pixel grid.
This constant is used in setting the <codeph class="+ topic/ph pr-d/codeph ">gridFitType</codeph> property of the
TextField class. This setting only works for left-justified text
fields and acts like the <codeph class="+ topic/ph pr-d/codeph ">GridFitType.SUBPIXEL</codeph> constant in static
text. This setting generally provides the best readability for left-aligned text.
Use the syntax <codeph class="+ topic/ph pr-d/codeph ">GridFitType.PIXEL</codeph>.
</apiDesc></apiValueDetail><related-links class="- topic/related-links "><link href="flash.text.xml#TextField/gridFitType" class="- topic/link "><linktext class="- topic/linktext ">flash.text.TextField.gridFitType</linktext></link></related-links></apiValue><apiValue id="flash.text:GridFitType:SUBPIXEL" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiValue/apiValue "><apiName class="- topic/title reference/title apiRef/apiName ">SUBPIXEL</apiName><shortdesc class="- topic/shortdesc ">
Fits strong horizontal and vertical lines to the sub-pixel
grid on LCD monitors.</shortdesc><prolog class="- topic/prolog "><author class="- topic/author ">Bob Pappas
</author><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="Flash" version="9" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata></prolog><apiValueDetail class="- topic/body reference/refbody apiRef/apiDetail apiValue/apiValueDetail "><apiValueDef class="- topic/section reference/section apiRef/apiDef apiValue/apiValueDef "><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiStatic class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiStatic "/><apiData class="- topic/ph reference/ph apiRef/apiData ">subpixel</apiData><apiValueClassifier class="- topic/xref reference/xref apiRef/apiRelation apiValue/apiValueClassifier ">String</apiValueClassifier></apiValueDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
Fits strong horizontal and vertical lines to the sub-pixel
grid on LCD monitors. (Red, green, and blue are actual pixels on an LCD screen.)
This is often a good setting for right-aligned or center-aligned dynamic
text, and it is sometimes a useful tradeoff for animation vs. text quality.
This constant is used in setting the <codeph class="+ topic/ph pr-d/codeph ">gridFitType</codeph> property of the
TextField class.
Use the syntax <codeph class="+ topic/ph pr-d/codeph ">GridFitType.SUBPIXEL</codeph>.
</apiDesc></apiValueDetail><related-links class="- topic/related-links "><link href="flash.text.xml#TextField/gridFitType" class="- topic/link "><linktext class="- topic/linktext ">flash.text.TextField.gridFitType</linktext></link></related-links></apiValue></apiClassifier><apiClassifier languages="" id="flash.text:StaticText" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiClassifier/apiClassifier "><apiName class="- topic/title reference/title apiRef/apiName ">StaticText</apiName><shortdesc class="- topic/shortdesc ">
This class represents StaticText objects on the display list.</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="Flash" version="9" class="+ topic/ph adobe-api-d/apiPlatform "/><apiPlatform description="" name="Lite" version="4" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata></prolog><apiClassifierDetail class="- topic/body reference/refbody apiRef/apiDetail apiClassifier/apiClassifierDetail "><apiClassifierDef class="- topic/section reference/section apiRef/apiDef apiClassifier/apiClassifierDef "><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiStatic class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiStatic "/><apiFinal class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiFinal "/><apiBaseClassifier class="- topic/xref reference/xref apiRef/apiRelation apiClassifier/apiBaseClassifier ">flash.display:DisplayObject</apiBaseClassifier></apiClassifierDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
This class represents StaticText objects on the display list.
You cannot create a StaticText object using ActionScript. Only the authoring tool
can create a StaticText object. An attempt to create a new StaticText object generates
an <codeph class="+ topic/ph pr-d/codeph ">ArgumentError</codeph>.
<p class="- topic/p ">To create a reference to an existing static text field in ActionScript 3.0,
you can iterate over the items in the display list. For example, the following snippet checks
to see if the display list contains a static text field and assigns the field to
a variable:</p>
<codeblock xml:space="preserve" class="+ topic/pre pr-d/codeblock ">
var i:uint;
for (i = 0; i &lt; this.numChildren; i++) {
var displayitem:DisplayObject = this.getChildAt(i);
if (displayitem instanceof StaticText) {
trace("a static text field is item " + i + " on the display list");
var myFieldLabel:StaticText = StaticText(displayitem);
trace("and contains the text: " + myFieldLabel.text);
}
}
</codeblock>
</apiDesc></apiClassifierDetail><apiValue id="flash.text:StaticText:text:get" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiValue/apiValue "><apiName class="- topic/title reference/title apiRef/apiName ">text</apiName><shortdesc class="- topic/shortdesc ">
Returns the current text of the static text field.</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="Flash" version="9" class="+ topic/ph adobe-api-d/apiPlatform "/><apiPlatform description="" name="Lite" version="4" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata></prolog><apiValueDetail class="- topic/body reference/refbody apiRef/apiDetail apiValue/apiValueDetail "><apiValueDef class="- topic/section reference/section apiRef/apiDef apiValue/apiValueDef "><apiProperty class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiProperty "/><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiDynamic class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiDynamic "/><apiValueAccess value="read" class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiValueAccess "/><apiValueClassifier class="- topic/xref reference/xref apiRef/apiRelation apiValue/apiValueClassifier ">String</apiValueClassifier></apiValueDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
Returns the current text of the static text field. The authoring tool may export multiple text field
objects comprising the complete text. For example, for vertical text, the authoring tool will create
one text field per character.
</apiDesc></apiValueDetail></apiValue></apiClassifier><apiClassifier languages="" id="flash.text:TextField" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiClassifier/apiClassifier "><apiName class="- topic/title reference/title apiRef/apiName ">TextField</apiName><shortdesc class="- topic/shortdesc ">
The TextField class is used to create display objects for text display and input.</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="Flash" version="9" class="+ topic/ph adobe-api-d/apiPlatform "/><apiPlatform description="" name="Lite" version="4" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata><asCustoms class="+ topic/metadata adobe-api-d/asCustoms "><keyword class="- topic/keyword ">TextField, TextField object, built-in class
</keyword></asCustoms></prolog><apiClassifierDetail class="- topic/body reference/refbody apiRef/apiDetail apiClassifier/apiClassifierDetail "><apiClassifierDef class="- topic/section reference/section apiRef/apiDef apiClassifier/apiClassifierDef "><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiStatic class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiStatic "/><apiTipTexts><apiTipText class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiTipText ">The TextField class is used to create display objects for text display and input.
</apiTipText></apiTipTexts><apiBaseClassifier class="- topic/xref reference/xref apiRef/apiRelation apiClassifier/apiBaseClassifier ">flash.display:InteractiveObject</apiBaseClassifier></apiClassifierDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
The TextField class is used to create display objects for text display and input.
<ph outputclass="flexonly" class="- topic/ph ">You can use the TextField class to perform low-level text rendering.
However, in Flex, you typically use the Label, Text, TextArea, and TextInput controls to process text.</ph>
<ph outputclass="flashonly" class="- topic/ph ">You can give a text field an instance name in the Property inspector and
use the methods and properties of the TextField class to manipulate it with ActionScript.
TextField instance names are displayed in the Movie Explorer and in the Insert Target Path dialog box
in the Actions panel.</ph>
<p class="- topic/p ">To create a text field dynamically, use the <codeph class="+ topic/ph pr-d/codeph ">TextField()</codeph> constructor.</p>
<p class="- topic/p ">The methods of the TextField class let you set, select, and manipulate text in a dynamic or input
text field that you create during authoring or at runtime. </p>
<p class="- topic/p ">ActionScript provides several ways to
format your text at runtime. The TextFormat class lets you set character and paragraph formatting
for TextField objects. You can apply Cascading Style Sheets (CSS) styles
to text fields by using the <codeph class="+ topic/ph pr-d/codeph ">TextField.styleSheet</codeph> property and the StyleSheet class. You can use CSS to
style built-in HTML tags, define new formatting tags, or apply styles.
You can assign HTML formatted text, which optionally uses CSS styles, directly to a text
field. HTML text that you assign to a text field can contain embedded
media (movie clips, SWF files, GIF files, PNG files, and JPEG files). The text wraps around the
embedded media in the same way that a web browser wraps text around media embedded in an HTML document. </p>
<p class="- topic/p ">Flash Player supports a subset of HTML tags that you can use to format text. See the list of supported
HTML tags in the description of the <codeph class="+ topic/ph pr-d/codeph ">htmlText</codeph> property.</p>
</apiDesc><example conref="examples\TextFieldExample.as" class="- topic/example "> The following example uses the <codeph class="+ topic/ph pr-d/codeph ">TextFieldExample</codeph> class to
display a text message. This is accomplished by using the following steps:
<ol class="- topic/ol "><li class="- topic/li ">A <codeph class="+ topic/ph pr-d/codeph ">label</codeph> property of type TextField is created.</li><li class="- topic/li ">The class constructor calls the <codeph class="+ topic/ph pr-d/codeph ">configureLabel()</codeph> function.</li><li class="- topic/li "> The <codeph class="+ topic/ph pr-d/codeph ">configureLabel()</codeph> method first creates a new TextField object and assigns it to
the <codeph class="+ topic/ph pr-d/codeph ">label</codeph> property, and then sets its parameters to the following:
<ul class="- topic/ul "><li class="- topic/li ">Left-justify the text field.</li><li class="- topic/li ">Enable the background fill.</li><li class="- topic/li ">Enable the border.</li></ul>
</li><li class="- topic/li ">The <codeph class="+ topic/ph pr-d/codeph ">configureLabel()</codeph> method creates the <codeph class="+ topic/ph pr-d/codeph ">format</codeph> variable and assigns it to
a new TextFormat instance with its parameters set to the following:
<ul class="- topic/ul "><li class="- topic/li ">Font type = Verdana</li><li class="- topic/li ">Font color = solid red</li><li class="- topic/li ">Font size = 10</li><li class="- topic/li ">Font underline = true</li></ul>
</li><li class="- topic/li ">The <codeph class="+ topic/ph pr-d/codeph ">defaultTextFormat</codeph> property of the <codeph class="+ topic/ph pr-d/codeph ">label</codeph> text field
is set to <codeph class="+ topic/ph pr-d/codeph ">format</codeph>, and the <codeph class="+ topic/ph pr-d/codeph ">label</codeph> instance is added to the display list,
which initially displays a text field with no text on the stage.</li><li class="- topic/li ">The constructor sets the text of the <codeph class="+ topic/ph pr-d/codeph ">label</codeph> text field to
<codeph class="+ topic/ph pr-d/codeph ">"Hello world and welcome to the show."</codeph> by calling the
<codeph class="+ topic/ph pr-d/codeph ">setLabel()</codeph> method.</li></ol>
<codeblock xml:space="preserve" class="+ topic/pre pr-d/codeblock ">
package {
import flash.display.Sprite;
import flash.text.TextField;
import flash.text.TextFieldAutoSize;
import flash.text.TextFormat;
public class TextFieldExample extends Sprite {
private var label:TextField;
private var labelText:String = "Hello world and welcome to the show.";
public function TextFieldExample() {
configureLabel();
setLabel(labelText);
}
public function setLabel(str:String):void {
label.text = str;
}
private function configureLabel():void {
label = new TextField();
label.autoSize = TextFieldAutoSize.LEFT;
label.background = true;
label.border = true;
var format:TextFormat = new TextFormat();
format.font = "Verdana";
format.color = 0xFF0000;
format.size = 10;
format.underline = true;
label.defaultTextFormat = format;
addChild(label);
}
}
}
</codeblock></example></apiClassifierDetail><related-links class="- topic/related-links "><link href="flash.text.xml#TextFormat" class="- topic/link "><linktext class="- topic/linktext ">flash.text.TextFormat</linktext></link><link href="flash.text.xml#StyleSheet" class="- topic/link "><linktext class="- topic/linktext ">flash.text.StyleSheet</linktext></link><link href="flash.text.xml#TextField/htmlText" class="- topic/link "><linktext class="- topic/linktext ">htmlText</linktext></link></related-links><adobeApiEvent id="flash.text:TextField_flash.events.Event_textInteractionModeChange" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef adobeApiEvent/adobeApiEvent "><apiName class="- topic/title reference/title apiRef/apiName ">textInteractionModeChange</apiName><shortdesc class="- topic/shortdesc ">
Flash Player dispatches the textInteractionModeChange event when a user
changes the interaction mode of a text field.</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="Flash" version="11" class="+ topic/ph adobe-api-d/apiPlatform "/><apiPlatform description="" name="Lite" version="4" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata></prolog><adobeApiEventDetail class="- topic/body reference/refbody apiRef/apiDetail adobeApiEvent/adobeApiEventDetail "><adobeApiEventDef class="- topic/section reference/section apiRef/apiDef adobeApiEvent/adobeApiEventDef "><adobeApiEventClassifier class="- topic/xref reference/xref apiRef/apiRelation adobeApiEvent/adobeApiEventClassifier ">flash.events.Event</adobeApiEventClassifier><apiGeneratedEvent class="- topic/state reference/state apiRef/apiQualifier adobeApiEvent/apiGeneratedEvent "/></adobeApiEventDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
Flash Player dispatches the <codeph class="+ topic/ph pr-d/codeph ">textInteractionModeChange</codeph> event when a user
changes the interaction mode of a text field.
for example on Android, one can toggle from NORMAL mode to SELECTION mode using context menu
options
</apiDesc></adobeApiEventDetail></adobeApiEvent><adobeApiEvent id="flash.text:TextField_flash.events.TextEvent.TEXT_INPUT_textInput" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef adobeApiEvent/adobeApiEvent "><apiName class="- topic/title reference/title apiRef/apiName ">textInput</apiName><shortdesc class="- topic/shortdesc ">
Flash Player dispatches the textInput event when a user enters one or more
characters of text.</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="Flash" version="9" class="+ topic/ph adobe-api-d/apiPlatform "/><apiPlatform description="" name="Lite" version="4" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata></prolog><adobeApiEventDetail class="- topic/body reference/refbody apiRef/apiDetail adobeApiEvent/adobeApiEventDetail "><adobeApiEventDef class="- topic/section reference/section apiRef/apiDef adobeApiEvent/adobeApiEventDef "><apiEventType class="- topic/state reference/state apiRef/apiQualifier adobeApiEvent/apiEventType ">flash.events.TextEvent.TEXT_INPUT</apiEventType><adobeApiEventClassifier class="- topic/xref reference/xref apiRef/apiRelation adobeApiEvent/adobeApiEventClassifier ">flash.events.TextEvent</adobeApiEventClassifier><apiGeneratedEvent class="- topic/state reference/state apiRef/apiQualifier adobeApiEvent/apiGeneratedEvent "/></adobeApiEventDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
Flash Player dispatches the <codeph class="+ topic/ph pr-d/codeph ">textInput</codeph> event when a user enters one or more
characters of text. Various
text input methods can generate this event, including standard keyboards,
input method editors (IMEs), voice or speech recognition systems, and even the act
of pasting plain text with no formatting or style information.
</apiDesc><example conref="examples\TextField_textInput.as" class="- topic/example "> The following example defines two TextField objects:
the first TextField object is an input text field, and the second TextField object
is a dynamic text field. As you enter text characters in
the first text field, the <codeph class="+ topic/ph pr-d/codeph ">textInput</codeph> event is dispatched, the <codeph class="+ topic/ph pr-d/codeph ">textInputHandler()</codeph> handler is called, and the characters display in the second
text field. When you paste a
block of text into the input field, the event handler copies the entire block
into the other field.
<codeblock xml:space="preserve" class="+ topic/pre pr-d/codeblock ">
package
{
import flash.display.Sprite;
import flash.text.*;
import flash.events.Event;
import flash.events.TextEvent;
import flash.events.MouseEvent;
public class TextInputExample extends Sprite
{
private var myTextBox1:TextField = new TextField();
private var myTextBox2:TextField = new TextField();
public function TextInputExample()
{
myTextBox1.type = TextFieldType.INPUT;
myTextBox1.width = 200;
myTextBox1.height = 20;
myTextBox1.background = true;
myTextBox1.border = true;
myTextBox2.x=220;
addChild(myTextBox1);
addChild(myTextBox2);
myTextBox1.addEventListener(TextEvent.TEXT_INPUT,textInputHandler);
}
public function textInputHandler(event:TextEvent):void
{
myTextBox2.text=event.text;
}
}
}
</codeblock></example></adobeApiEventDetail></adobeApiEvent><adobeApiEvent id="flash.text:TextField_flash.events.Event.SCROLL_scroll" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef adobeApiEvent/adobeApiEvent "><apiName class="- topic/title reference/title apiRef/apiName ">scroll</apiName><shortdesc class="- topic/shortdesc ">
Dispatched by a TextField object after the user scrolls.</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="Flash" version="9" class="+ topic/ph adobe-api-d/apiPlatform "/><apiPlatform description="" name="Lite" version="4" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata></prolog><adobeApiEventDetail class="- topic/body reference/refbody apiRef/apiDetail adobeApiEvent/adobeApiEventDetail "><adobeApiEventDef class="- topic/section reference/section apiRef/apiDef adobeApiEvent/adobeApiEventDef "><apiEventType class="- topic/state reference/state apiRef/apiQualifier adobeApiEvent/apiEventType ">flash.events.Event.SCROLL</apiEventType><adobeApiEventClassifier class="- topic/xref reference/xref apiRef/apiRelation adobeApiEvent/adobeApiEventClassifier ">flash.events.Event</adobeApiEventClassifier><apiGeneratedEvent class="- topic/state reference/state apiRef/apiQualifier adobeApiEvent/apiGeneratedEvent "/></adobeApiEventDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
Dispatched by a TextField object <i class="+ topic/ph hi-d/i ">after</i> the user scrolls.
</apiDesc><example conref="examples\TextField_scroll.as" class="- topic/example "> The following example defines two TextField objects.
The first TextField object has two associated event handlers. When you click the mouse
inside this first text field, the <codeph class="+ topic/ph pr-d/codeph ">mouseDown</codeph> event is dispatched, and the associated <codeph class="+ topic/ph pr-d/codeph ">mouseDownScroll</codeph> handler is called. The
<codeph class="+ topic/ph pr-d/codeph ">mouseDownScroll()</codeph> handler causes the field to scroll. Then, the
<codeph class="+ topic/ph pr-d/codeph ">scroll</codeph> event is dispatched, and the associated <codeph class="+ topic/ph pr-d/codeph ">scrollHandler()</codeph>
handler updates the second text field to display the current scroll position.
<codeblock xml:space="preserve" class="+ topic/pre pr-d/codeblock ">
package
{
import flash.display.Sprite;
import flash.text.*;
import flash.events.Event;
import flash.events.TextEvent;
import flash.events.MouseEvent;
public class TextScrollExample extends Sprite
{
private var myTextBox1:TextField = new TextField();
private var myTextBox2:TextField = new TextField();
private var myText:String = "Hello world and welcome to the show. It's really nice to meet you. Take your coat off and stay a while. OK, show is over. Hope you had fun. You can go home now. Don't forget to tip your waiter. There are mints in the bowl by the door. Thank you. Please come again.";
public function TextScrollExample()
{
myTextBox1.text = myText;
myTextBox1.width = 200;
myTextBox1.height = 50;
myTextBox1.multiline = true;
myTextBox1.wordWrap = true;
myTextBox1.background = true;
myTextBox1.border = true;
myTextBox2.x=220;
myTextBox2.text="scrolled to line: " + myTextBox1.scrollV;
addChild(myTextBox1);
addChild(myTextBox2);
myTextBox1.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownScroll);
myTextBox1.addEventListener(Event.SCROLL, scrollHandler);
}
public function mouseDownScroll(event:MouseEvent):void
{
myTextBox1.scrollV++;
}
public function scrollHandler(event:Event):void
{
myTextBox2.text="scrolled to line: " + myTextBox1.scrollV;
}
}
}
</codeblock></example></adobeApiEventDetail></adobeApiEvent><adobeApiEvent id="flash.text:TextField_flash.events.TextEvent.LINK_link" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef adobeApiEvent/adobeApiEvent "><apiName class="- topic/title reference/title apiRef/apiName ">link</apiName><shortdesc class="- topic/shortdesc ">
Dispatched when a user clicks a hyperlink in an
HTML-enabled text field, where the URL begins with "event:".</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="Flash" version="9" class="+ topic/ph adobe-api-d/apiPlatform "/><apiPlatform description="" name="Lite" version="4" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata></prolog><adobeApiEventDetail class="- topic/body reference/refbody apiRef/apiDetail adobeApiEvent/adobeApiEventDetail "><adobeApiEventDef class="- topic/section reference/section apiRef/apiDef adobeApiEvent/adobeApiEventDef "><apiEventType class="- topic/state reference/state apiRef/apiQualifier adobeApiEvent/apiEventType ">flash.events.TextEvent.LINK</apiEventType><adobeApiEventClassifier class="- topic/xref reference/xref apiRef/apiRelation adobeApiEvent/adobeApiEventClassifier ">flash.events.TextEvent</adobeApiEventClassifier><apiGeneratedEvent class="- topic/state reference/state apiRef/apiQualifier adobeApiEvent/apiGeneratedEvent "/></adobeApiEventDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
Dispatched when a user clicks a hyperlink in an
HTML-enabled text field, where the URL begins with "event:". The remainder of the URL after
"event:" is placed in the text property of the LINK event.
<p class="- topic/p "><b class="+ topic/ph hi-d/b ">Note:</b> The default behavior, adding the text to the text field,
occurs only when Flash Player generates the event, which in this case happens when
a user attempts to input text. You cannot put text into a text field by sending it <codeph class="+ topic/ph pr-d/codeph ">textInput</codeph>
events.</p>
</apiDesc><example conref="examples\TextField_event_link.as" class="- topic/example "> In the following example, the <codeph class="+ topic/ph pr-d/codeph ">playMP3()</codeph> function is defined.
A TextField object named <codeph class="+ topic/ph pr-d/codeph ">list</codeph> is created and populated with HTML text.
The text <codeph class="+ topic/ph pr-d/codeph ">"Track 1"</codeph> and <codeph class="+ topic/ph pr-d/codeph ">"Track 2"</codeph> are links inside the text field.
The playMP3() function is called when the user clicks either link. The name of the MP3
file, which follows the string "event:" in the <codeph class="+ topic/ph pr-d/codeph ">href</codeph> attribute of the
HTML tag, is passed to the <codeph class="+ topic/ph pr-d/codeph ">linkHandler()</codeph> method as the <codeph class="+ topic/ph pr-d/codeph ">text</codeph>
property of the <codeph class="+ topic/ph pr-d/codeph ">link</codeph> event object.
<codeblock xml:space="preserve" class="+ topic/pre pr-d/codeblock ">
package {
import flash.display.Sprite;
import flash.errors.IOError;
import flash.events.IOErrorEvent;
import flash.events.TextEvent;
import flash.media.Sound;
import flash.media.SoundChannel;
import flash.net.URLRequest;
import flash.text.TextField;
import flash.text.TextFieldAutoSize;
public class TextField_event_link extends Sprite
{
private var myMP3:Sound;
public function TextField_event_link() {
myMP3 = new Sound();
var list:TextField = new TextField();
list.autoSize = TextFieldAutoSize.LEFT;
list.multiline = true;
list.htmlText = "&lt;a href=\"event:track1.mp3\"&gt;Track 1&lt;/a&gt;&lt;br&gt;";
list.htmlText += "&lt;a href=\"event:track2.mp3\"&gt;Track 2&lt;/a&gt;&lt;br&gt;";
addEventListener(TextEvent.LINK, linkHandler);
addChild(list);
}
private function playMP3(mp3:String):void {
try {
myMP3.load(new URLRequest(mp3));
myMP3.play();
}
catch(err:Error) {
trace(err.message);
}
myMP3.addEventListener(IOErrorEvent.IO_ERROR, errorHandler);
}
private function linkHandler(linkEvent:TextEvent):void {
playMP3(linkEvent.text);
}
private function errorHandler(errorEvent:IOErrorEvent):void {
trace(errorEvent.text);
}
}
}
</codeblock></example></adobeApiEventDetail></adobeApiEvent><adobeApiEvent id="flash.text:TextField_flash.events.Event.CHANGE_change" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef adobeApiEvent/adobeApiEvent "><apiName class="- topic/title reference/title apiRef/apiName ">change</apiName><shortdesc class="- topic/shortdesc ">
Dispatched after a control value is modified, unlike
the textInput event, which is dispatched before the value is modified.</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="Flash" version="9" class="+ topic/ph adobe-api-d/apiPlatform "/><apiPlatform description="" name="Lite" version="4" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata></prolog><adobeApiEventDetail class="- topic/body reference/refbody apiRef/apiDetail adobeApiEvent/adobeApiEventDetail "><adobeApiEventDef class="- topic/section reference/section apiRef/apiDef adobeApiEvent/adobeApiEventDef "><apiEventType class="- topic/state reference/state apiRef/apiQualifier adobeApiEvent/apiEventType ">flash.events.Event.CHANGE</apiEventType><adobeApiEventClassifier class="- topic/xref reference/xref apiRef/apiRelation adobeApiEvent/adobeApiEventClassifier ">flash.events.Event</adobeApiEventClassifier><apiGeneratedEvent class="- topic/state reference/state apiRef/apiQualifier adobeApiEvent/apiGeneratedEvent "/></adobeApiEventDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
Dispatched after a control value is modified, unlike
the <codeph class="+ topic/ph pr-d/codeph ">textInput</codeph> event, which is dispatched before the value is modified.
Unlike the W3C DOM Event Model version of the <codeph class="+ topic/ph pr-d/codeph ">change</codeph> event, which dispatches the
event only after the control loses focus, the ActionScript 3.0 version of the
<codeph class="+ topic/ph pr-d/codeph ">change</codeph> event is dispatched any time the control changes. For example, if a user
types text into a text field, a <codeph class="+ topic/ph pr-d/codeph ">change</codeph> event is dispatched after every keystroke.
</apiDesc><example conref="examples\TextField_Event_changeExample.as" class="- topic/example "> In the following example, the text that the user enters (user input) is immediately copied
(echoed) into another text field with a different text format.
<p class="- topic/p ">Two text fields are created, one for the user input and the other
(<codeph class="+ topic/ph pr-d/codeph ">headingTextField</codeph>) for the copy of the user input. A TextFormat
object is also created and the default text format is assigned to the
<codeph class="+ topic/ph pr-d/codeph ">headingTextField</codeph> text field. When the content of the text field
is changed, the <codeph class="+ topic/ph pr-d/codeph ">changeHandler()</codeph> method is invoked, which assigns
the text in the <codeph class="+ topic/ph pr-d/codeph ">inputTextField</codeph> text field to the <codeph class="+ topic/ph pr-d/codeph ">headingTextField</codeph>
text field. (If the method was called for the <codeph class="+ topic/ph pr-d/codeph ">TextEvent.TEXT_INPUT</codeph> event
instead of the <codeph class="+ topic/ph pr-d/codeph ">Event.CHANGE</codeph> event, the content of the user input
is copied only after the user has entered more text.)</p>
<codeblock xml:space="preserve" class="+ topic/pre pr-d/codeblock ">
package {
import flash.display.Sprite;
import flash.text.TextField;
import flash.text.TextFieldType;
import flash.text.TextFormat;
import flash.text.TextFormatAlign;
import flash.events.Event;
import flash.events.TextEvent;
public class TextField_Event_changeExample extends Sprite {
private var inputTextField:TextField = new TextField();
private var headingTextField:TextField = new TextField();
private var newFormat:TextFormat = new TextFormat();
public function TextField_Event_changeExample() {
headingTextField.x = 10;
headingTextField.y = 10;
headingTextField.height = 30;
headingTextField.width = 400;
headingTextField.background = true;
headingTextField.backgroundColor = 0xF5F5DC;
headingTextField.selectable = false;
inputTextField.x = 10;
inputTextField.y = 70;
inputTextField.height = 20;
inputTextField.width = 230;
inputTextField.background = true;
inputTextField.border = true;
inputTextField.maxChars = 40;
inputTextField.wordWrap = true;
inputTextField.type = TextFieldType.INPUT;
inputTextField.addEventListener(Event.CHANGE, changeHandler);
newFormat.bold = true;
newFormat.size = 18;
newFormat.color = 0xFF0000;
newFormat.align = TextFormatAlign.CENTER;
headingTextField.defaultTextFormat = newFormat;
this.addChild(inputTextField);
this.addChild(headingTextField);
}
private function changeHandler(e:Event):void {
headingTextField.text = inputTextField.text;
}
}
}
</codeblock></example></adobeApiEventDetail></adobeApiEvent><apiConstructor id="flash.text:TextField:TextField" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiOperation/apiOperation apiOperation/apiConstructor"><apiName class="- topic/title reference/title apiRef/apiName ">TextField</apiName><shortdesc class="- topic/shortdesc ">
Creates a new TextField instance.</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="Flash" version="9" class="+ topic/ph adobe-api-d/apiPlatform "/><apiPlatform description="" name="Lite" version="4" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata></prolog><apiConstructorDetail class="- topic/body reference/refbody apiRef/apiDetail apiOperation/apiOperationDetail apiOperation/apiConstructorDetail"><apiConstructorDef class="- topic/section reference/section apiRef/apiDef apiOperation/apiConstructorDef "><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/></apiConstructorDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
Creates a new TextField instance. After you create the TextField instance, call the
<codeph class="+ topic/ph pr-d/codeph ">addChild()</codeph> or <codeph class="+ topic/ph pr-d/codeph ">addChildAt()</codeph> method of the parent
DisplayObjectContainer object to add the TextField instance to the display list.
<p class="- topic/p ">The default size for a text field is 100 x 100 pixels.</p>
</apiDesc><example conref="examples\TextField_new.as" class="- topic/example "> The following example shows how you can dynamically create an input TextField object in ActionScript 3.0 by setting the text field object's type property to the TextFieldType.INPUT constant.
Example provided by
<xref href="http://actionscriptexamples.com/2008/12/02/dynamically-creating-an-input-text-field-in-actionscript-30/" scope="_mmexternal" class="- topic/xref ">ActionScriptExamples.com</xref>.
<codeblock xml:space="preserve" class="+ topic/pre pr-d/codeblock ">
var theTextField:TextField = new TextField();
theTextField.type = TextFieldType.INPUT;
theTextField.border = true;
theTextField.x = 10;
theTextField.y = 10;
theTextField.multiline = true;
theTextField.wordWrap = true;
addChild(theTextField);
</codeblock></example></apiConstructorDetail></apiConstructor><apiOperation id="flash.text:TextField:appendText" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiOperation/apiOperation "><apiName class="- topic/title reference/title apiRef/apiName ">appendText</apiName><shortdesc class="- topic/shortdesc ">
Appends the string specified by the newText parameter to the end of the text
of the text field.</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="Flash" version="9" class="+ topic/ph adobe-api-d/apiPlatform "/><apiPlatform description="" name="Lite" version="4" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata></prolog><apiOperationDetail class="- topic/body reference/refbody apiRef/apiDetail apiOperation/apiOperationDetail "><apiOperationDef class="- topic/section reference/section apiRef/apiDef apiOperation/apiOperationDef "><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiReturn class="- topic/ph reference/ph apiRef/apiDefItem apiOperation/apiReturn "><apiType value="void" name="type" class="- topic/state reference/state apiRef/apiType "/></apiReturn><apiParam class="- topic/ph reference/ph apiRef/apiDefItem apiOperation/apiParam "><apiItemName class="- topic/keyword reference/keyword apiRef/apiItemName ">newText</apiItemName><apiOperationClassifier class="- topic/xref reference/xref apiRef/apiRelation apiOperation/apiOperationClassifier ">String</apiOperationClassifier><apiDesc class="- topic/section reference/section apiRef/apiDesc ">The string to append to the existing text.
</apiDesc></apiParam><apiTipTexts><apiTipText class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiTipText ">Appends text to the end of the existing text of the TextField.
</apiTipText></apiTipTexts></apiOperationDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
Appends the string specified by the <codeph class="+ topic/ph pr-d/codeph ">newText</codeph> parameter to the end of the text
of the text field. This method is more efficient than an addition assignment (<codeph class="+ topic/ph pr-d/codeph ">+=</codeph>) on
a <codeph class="+ topic/ph pr-d/codeph ">text</codeph> property (such as <codeph class="+ topic/ph pr-d/codeph ">someTextField.text += moreText</codeph>),
particularly for a text field that contains a significant amount of content.
</apiDesc><example conref="examples\TextField_appendTextExample.as" class="- topic/example "> The following example displays the time if it's not the weekend or the text, "It's the weekend,"
if it is. It also counts the number of characters up to a certain position and the number of lines in the text field.
<p class="- topic/p ">The <codeph class="+ topic/ph pr-d/codeph ">outputText</codeph> text field is set to automatically fit the text and to resize as a
left-justified text using <codeph class="+ topic/ph pr-d/codeph ">autoSize</codeph> property. The <codeph class="+ topic/ph pr-d/codeph ">outputText.text</codeph> property writes the first
line of the content and the method <codeph class="+ topic/ph pr-d/codeph ">appendText()</codeph> appends the rest of the content. (It is not
necessary to start with the <codeph class="+ topic/ph pr-d/codeph ">text</codeph> property. The <codeph class="+ topic/ph pr-d/codeph ">appendText()</codeph> method could also be
used to append text from the outset.) Setting the <codeph class="+ topic/ph pr-d/codeph ">text</codeph> property a second time will overwrite
the original text. Use <codeph class="+ topic/ph pr-d/codeph ">+=</codeph> operator to append content with the <codeph class="+ topic/ph pr-d/codeph ">text</codeph> property.</p>
<p class="- topic/p ">The <codeph class="+ topic/ph pr-d/codeph ">if</codeph> statement checks if the date is Saturday (6) or Sunday (0). If it's not, the
<codeph class="+ topic/ph pr-d/codeph ">toLocaleTimeString()</codeph> method returns the local time, which is appended to the text field's content.</p>
<p class="- topic/p ">The text field's <codeph class="+ topic/ph pr-d/codeph ">length</codeph> property is used to read the number of characters until right
before the function is called, and the property <codeph class="+ topic/ph pr-d/codeph ">numLines</codeph> is used to count the number of lines
in the text field. Note that the empty lines are counted in the number of lines and the empty spaces and
line breaks (\n) are counted in determining the content length.</p>
<codeblock xml:space="preserve" class="+ topic/pre pr-d/codeblock ">
package {
import flash.display.Sprite;
import flash.text.TextField;
import flash.text.TextFieldAutoSize;
public class TextField_appendTextExample extends Sprite {
public function TextField_appendTextExample() {
var outputText:TextField = new TextField();
var today:Date = new Date();
outputText.x = 10;
outputText.y = 10;
outputText.background = true;
outputText.autoSize = TextFieldAutoSize.LEFT;
outputText.text = "WHAT TIME IS IT?" + "\n\n";
if((today.day == 0) || (today.day == 6)) {
outputText.appendText("It's the weekend.");
outputText.appendText("\n\n");
} else {
outputText.appendText("The time is: ");
outputText.appendText(today.toLocaleTimeString() + ".\n\n");
}
outputText.appendText("Number of characters including line breaks and spaces so far: ");
outputText.appendText(outputText.length.toString() + "\n");
outputText.appendText("Number of lines in the outputText: ");
outputText.appendText(outputText.numLines.toString());
this.addChild(outputText);
}
}
}
</codeblock></example></apiOperationDetail></apiOperation><apiOperation id="flash.text:TextField:getCharBoundaries" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiOperation/apiOperation "><apiName class="- topic/title reference/title apiRef/apiName ">getCharBoundaries</apiName><shortdesc class="- topic/shortdesc ">
Returns a rectangle that is the bounding box of the character.</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="Flash" version="9" class="+ topic/ph adobe-api-d/apiPlatform "/><apiPlatform description="" name="Lite" version="4" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata></prolog><apiOperationDetail class="- topic/body reference/refbody apiRef/apiDetail apiOperation/apiOperationDetail "><apiOperationDef class="- topic/section reference/section apiRef/apiDef apiOperation/apiOperationDef "><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiReturn class="- topic/ph reference/ph apiRef/apiDefItem apiOperation/apiReturn "><apiDesc class="- topic/section reference/section apiRef/apiDesc ">A rectangle with <codeph class="+ topic/ph pr-d/codeph ">x</codeph> and <codeph class="+ topic/ph pr-d/codeph ">y</codeph> minimum and maximum values
defining the bounding box of the character.
</apiDesc><apiOperationClassifier class="- topic/xref reference/xref apiRef/apiRelation apiOperation/apiOperationClassifier ">flash.geom:Rectangle</apiOperationClassifier></apiReturn><apiParam class="- topic/ph reference/ph apiRef/apiDefItem apiOperation/apiParam "><apiItemName class="- topic/keyword reference/keyword apiRef/apiItemName ">charIndex</apiItemName><apiOperationClassifier class="- topic/xref reference/xref apiRef/apiRelation apiOperation/apiOperationClassifier ">int</apiOperationClassifier><apiDesc class="- topic/section reference/section apiRef/apiDesc ">The zero-based index value for the character (for example, the first
position is 0, the second position is 1, and so on).
</apiDesc></apiParam><apiTipTexts><apiTipText class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiTipText ">Returns a rectangle that is the bounding box of the character.
</apiTipText></apiTipTexts></apiOperationDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
Returns a rectangle that is the bounding box of the character.
</apiDesc><example conref="examples\TextField_getCharBoundariesExample.as" class="- topic/example "> In the following example the <codeph class="+ topic/ph pr-d/codeph ">getCharBoundaries()</codeph> method is used to mark
(put a spotlight on) a character that is selected by the user.
<p class="- topic/p ">The class defines the <codeph class="+ topic/ph pr-d/codeph ">spotlight</codeph> Shape object that will be used to draw a rectangle around
each character that is selected. When the user clicks on the <codeph class="+ topic/ph pr-d/codeph ">myTextField</codeph> text field, the
<codeph class="+ topic/ph pr-d/codeph ">clickHandler()</codeph> method is invoked.</p>
<p class="- topic/p ">In the <codeph class="+ topic/ph pr-d/codeph ">clickHandler()</codeph> method, the <codeph class="+ topic/ph pr-d/codeph ">getCharIndexAtPoint()</codeph> method gets the clicked character's
index based on the <codeph class="+ topic/ph pr-d/codeph ">localX</codeph> and <codeph class="+ topic/ph pr-d/codeph ">localY</codeph> coordinates of the mouse click, which is relative
to the containing <codeph class="+ topic/ph pr-d/codeph ">Sprite</codeph>. The <codeph class="+ topic/ph pr-d/codeph ">getCharIndexAtPoint()</codeph> method returns <codeph class="+ topic/ph pr-d/codeph ">-1</codeph> if
the point (mouse click) was not over any character. Since the text field could be larger than the text, the returned
integer (<codeph class="+ topic/ph pr-d/codeph ">index</codeph>) is checked to make sure the user has clicked on a character. The <codeph class="+ topic/ph pr-d/codeph ">index</codeph> integer
is also used by <codeph class="+ topic/ph pr-d/codeph ">getCharBoundaries()</codeph> to get a <codeph class="+ topic/ph pr-d/codeph ">Rectangle</codeph> object that holds the boundary
of the character. The <codeph class="+ topic/ph pr-d/codeph ">clear()</codeph> method clears any previously displayed <codeph class="+ topic/ph pr-d/codeph ">spotlight</codeph> Shape object. A
new rectangle the size of the character's width and height boundaries is produced at the location of the character
(offset from the (10, 10) coordinates) using the returned <codeph class="+ topic/ph pr-d/codeph ">frame</codeph> rectangle's x and y coordinates.
To put the spotlight on the character, the <codeph class="+ topic/ph pr-d/codeph ">spotlight</codeph> Shape object is filled with color yellow and the
opacity is set to 35 percent, so the character can be seen. Note that spaces are also considered a character.</p>
<codeblock xml:space="preserve" class="+ topic/pre pr-d/codeblock ">
package {
import flash.display.Sprite;
import flash.events.MouseEvent;
import flash.text.TextField;
import flash.geom.Rectangle;
import flash.events.MouseEvent;
import flash.text.TextFieldAutoSize;
import flash.display.Shape;
public class TextField_getCharBoundariesExample extends Sprite
{
private var myTextField:TextField = new TextField();
private var spotlight:Shape = new Shape();
public function TextField_getCharBoundariesExample() {
myTextField.x = 10;
myTextField.y = 10;
myTextField.border = true;
myTextField.selectable = false;
myTextField.autoSize = TextFieldAutoSize.LEFT;
myTextField.text = "Selected a character from this text by clicking on it."
myTextField.addEventListener(MouseEvent.CLICK, clickHandler);
this.addChild(myTextField);
this.addChild(spotlight);
}
private function clickHandler (e:MouseEvent):void {
var index:int = myTextField.getCharIndexAtPoint(e.localX, e.localY);
if (index != -1) {
var frame:Rectangle = myTextField.getCharBoundaries(index);
spotlight.graphics.clear();
spotlight.graphics.beginFill(0xFFFF00, .35);
spotlight.graphics.drawRect((frame.x + 10), (frame.y + 10), frame.width, frame.height);
spotlight.graphics.endFill();
}
}
}
}
</codeblock></example></apiOperationDetail><related-links class="- topic/related-links "><link href="flash.geom.xml#Rectangle" class="- topic/link "><linktext class="- topic/linktext ">flash.geom.Rectangle</linktext></link></related-links></apiOperation><apiOperation id="flash.text:TextField:getCharIndexAtPoint" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiOperation/apiOperation "><apiName class="- topic/title reference/title apiRef/apiName ">getCharIndexAtPoint</apiName><shortdesc class="- topic/shortdesc ">
Returns the zero-based index value of the character at the point specified by the x
and y parameters.</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="Flash" version="9" class="+ topic/ph adobe-api-d/apiPlatform "/><apiPlatform description="" name="Lite" version="4" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata></prolog><apiOperationDetail class="- topic/body reference/refbody apiRef/apiDetail apiOperation/apiOperationDetail "><apiOperationDef class="- topic/section reference/section apiRef/apiDef apiOperation/apiOperationDef "><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiReturn class="- topic/ph reference/ph apiRef/apiDefItem apiOperation/apiReturn "><apiDesc class="- topic/section reference/section apiRef/apiDesc ">The zero-based index value of the character (for example, the first position is 0,
the second position is 1, and so on). Returns -1 if the point is not over any character.
</apiDesc><apiOperationClassifier class="- topic/xref reference/xref apiRef/apiRelation apiOperation/apiOperationClassifier ">int</apiOperationClassifier></apiReturn><apiParam class="- topic/ph reference/ph apiRef/apiDefItem apiOperation/apiParam "><apiItemName class="- topic/keyword reference/keyword apiRef/apiItemName ">x</apiItemName><apiOperationClassifier class="- topic/xref reference/xref apiRef/apiRelation apiOperation/apiOperationClassifier ">Number</apiOperationClassifier><apiDesc class="- topic/section reference/section apiRef/apiDesc ">The <i class="+ topic/ph hi-d/i ">x</i> coordinate of the character.
</apiDesc></apiParam><apiParam class="- topic/ph reference/ph apiRef/apiDefItem apiOperation/apiParam "><apiItemName class="- topic/keyword reference/keyword apiRef/apiItemName ">y</apiItemName><apiOperationClassifier class="- topic/xref reference/xref apiRef/apiRelation apiOperation/apiOperationClassifier ">Number</apiOperationClassifier><apiDesc class="- topic/section reference/section apiRef/apiDesc ">The <i class="+ topic/ph hi-d/i ">y</i> coordinate of the character.
</apiDesc></apiParam><apiTipTexts><apiTipText class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiTipText ">Returns the zero-based index value of the character.
</apiTipText></apiTipTexts></apiOperationDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
Returns the zero-based index value of the character at the point specified by the <codeph class="+ topic/ph pr-d/codeph ">x</codeph>
and <codeph class="+ topic/ph pr-d/codeph ">y</codeph> parameters.
</apiDesc><example conref="examples\TextField_getCharIndexAtPointExample.as" class="- topic/example "> In the following example, when a user clicked on a character, the character is echoed
in another text field above the text.
<p class="- topic/p ">The first text field holds the text the user is going to select. In order to make sure the text
is clicked but not selected, <codeph class="+ topic/ph pr-d/codeph ">selectable</codeph> property is set to false. When the user clicks
on the <codeph class="+ topic/ph pr-d/codeph ">firstTextField</codeph> text field, the <codeph class="+ topic/ph pr-d/codeph ">clickHandler()</codeph> method is invoked.</p>
<p class="- topic/p ">In the <codeph class="+ topic/ph pr-d/codeph ">clickHandler()</codeph> method, the <codeph class="+ topic/ph pr-d/codeph ">getCharIndexAtPoint()</codeph> method returns the character's
index based on the <codeph class="+ topic/ph pr-d/codeph ">localX</codeph> and <codeph class="+ topic/ph pr-d/codeph ">localY</codeph> coordinates of the mouse click. Since the text field
could be larger than the text, the return integer (<codeph class="+ topic/ph pr-d/codeph ">index</codeph>) is checked to make sure the user has clicked
on a character. (The <codeph class="+ topic/ph pr-d/codeph ">getCharIndexAtPoint()</codeph> method returns <codeph class="+ topic/ph pr-d/codeph ">-1</codeph>, if the point (mouse click)
was not over a character.) The mouse coordinates is used to set the coordinates of the new text field where the
echoed character will appear. The color of the character in the second text field is set to red. Finally
the text of the second field is set to the selected character, which is retrieved using the <codeph class="+ topic/ph pr-d/codeph ">charAt()</codeph> method.
Note that using the <codeph class="+ topic/ph pr-d/codeph ">text</codeph> property instead of the <codeph class="+ topic/ph pr-d/codeph ">appendText()</codeph> method will overwrite the character
in the second text field, instead of appending it.</p>
<codeblock xml:space="preserve" class="+ topic/pre pr-d/codeblock ">
package {
import flash.display.Sprite;
import flash.events.MouseEvent;
import flash.text.TextField;
import flash.geom.Rectangle;
import flash.events.MouseEvent;
import flash.text.TextFieldAutoSize;
public class TextField_getCharIndexAtPointExample extends Sprite {
private var firstTextField:TextField = new TextField();
private var secondTextField:TextField = new TextField();
public function TextField_getCharIndexAtPointExample() {
firstTextField.x = 100;
firstTextField.y = 100;
firstTextField.width = 260;
firstTextField.height = 20;
firstTextField.border = true;
firstTextField.background = true;
firstTextField.selectable = false;
firstTextField.text = "Selected a character from this text by clicking on it."
firstTextField.addEventListener(MouseEvent.CLICK, clickHandler);
this.addChild(firstTextField);
this.addChild(secondTextField);
}
private function clickHandler (e:MouseEvent):void {
var index:int = firstTextField.getCharIndexAtPoint(e.localX, e.localY);
if (index != -1) {
secondTextField.x = mouseX;
secondTextField.y = 70;
secondTextField.border = true;
secondTextField.selectable = false;
secondTextField.background = true;
secondTextField.textColor = 0xFF0000;
secondTextField.autoSize = TextFieldAutoSize.LEFT;
secondTextField.text = firstTextField.text.charAt(index);
}
}
}
}
</codeblock></example></apiOperationDetail></apiOperation><apiOperation id="flash.text:TextField:getFirstCharInParagraph" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiOperation/apiOperation "><apiName class="- topic/title reference/title apiRef/apiName ">getFirstCharInParagraph</apiName><shortdesc class="- topic/shortdesc ">
Given a character index, returns the index of the first character in the same paragraph.</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="Flash" version="9" class="+ topic/ph adobe-api-d/apiPlatform "/><apiPlatform description="" name="Lite" version="4" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata></prolog><apiOperationDetail class="- topic/body reference/refbody apiRef/apiDetail apiOperation/apiOperationDetail "><apiOperationDef class="- topic/section reference/section apiRef/apiDef apiOperation/apiOperationDef "><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiException class="+ topic/ph reference/ph apiRef/apiDefItem apiOperation/apiEvent adobe-api-d/apiException "><apiDesc class="- topic/section reference/section apiRef/apiDesc ">The character index specified is out of range.
</apiDesc><apiItemName class="- topic/keyword reference/keyword apiRef/apiItemName ">RangeError</apiItemName><apiOperationClassifier class="- topic/xref reference/xref apiRef/apiRelation apiOperation/apiOperationClassifier ">RangeError</apiOperationClassifier></apiException><apiReturn class="- topic/ph reference/ph apiRef/apiDefItem apiOperation/apiReturn "><apiDesc class="- topic/section reference/section apiRef/apiDesc ">The zero-based index value of the first character in the same paragraph.
</apiDesc><apiOperationClassifier class="- topic/xref reference/xref apiRef/apiRelation apiOperation/apiOperationClassifier ">int</apiOperationClassifier></apiReturn><apiParam class="- topic/ph reference/ph apiRef/apiDefItem apiOperation/apiParam "><apiItemName class="- topic/keyword reference/keyword apiRef/apiItemName ">charIndex</apiItemName><apiOperationClassifier class="- topic/xref reference/xref apiRef/apiRelation apiOperation/apiOperationClassifier ">int</apiOperationClassifier><apiDesc class="- topic/section reference/section apiRef/apiDesc ">The zero-based index value of the character (for example, the first character is 0,
the second character is 1, and so on).
</apiDesc></apiParam><apiTipTexts><apiTipText class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiTipText ">The zero-based index value of the character.
</apiTipText></apiTipTexts></apiOperationDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
Given a character index, returns the index of the first character in the same paragraph.
</apiDesc><example conref="examples\TextField_getFirstCharInParagraphExample.as" class="- topic/example "> In the following example, paragraph formatting is applied to the text field content.
When the user clicks on a paragraph, the text of the paragraph will be aligned right and when the user
clicks on the paragraph again, it will return to the original (default) format (left-align).
<p class="- topic/p ">In the constructor, the <codeph class="+ topic/ph pr-d/codeph ">myTextField</codeph> text field is set to text wrap. The <codeph class="+ topic/ph pr-d/codeph ">getTextFormat</codeph>
method returns the original format of the first character of the content of the text field, which is placed
in the <codeph class="+ topic/ph pr-d/codeph ">originalFormat</codeph> TextFormat object. A new TextFormat object (<codeph class="+ topic/ph pr-d/codeph ">newFormat</codeph>) is
also defined and its <codeph class="+ topic/ph pr-d/codeph ">align</codeph> property is assigned to right-justified. When the user clicks
on the text field, the <codeph class="+ topic/ph pr-d/codeph ">clickHandler()</codeph> method is invoked.</p>
<p class="- topic/p ">In the <codeph class="+ topic/ph pr-d/codeph ">clickHandler()</codeph> method, the <codeph class="+ topic/ph pr-d/codeph ">getCharIndexAtPoint()</codeph> method returns the character's
index based on the <codeph class="+ topic/ph pr-d/codeph ">localX</codeph> and <codeph class="+ topic/ph pr-d/codeph ">localY</codeph> coordinates of the mouse click. The first <codeph class="+ topic/ph pr-d/codeph ">if</codeph>
statement checks to see if the use has clicked on a character. Using the <codeph class="+ topic/ph pr-d/codeph ">clickIndex</codeph> integer returned by the
<codeph class="+ topic/ph pr-d/codeph ">getCharIndexAtPoint()</codeph> method, the <codeph class="+ topic/ph pr-d/codeph ">getFirstCharInParagraph()</codeph> method returns the index of the
first character in the paragraph the user has clicked. The index of the last character in the paragraph is
determined by adding the length of the paragraph (using <codeph class="+ topic/ph pr-d/codeph ">getParagraphLength()</codeph> method) to the index of the first
character in the paragraph, minus the last character (<codeph class="+ topic/ph pr-d/codeph ">\n</codeph>). The second <codeph class="+ topic/ph pr-d/codeph ">if</codeph> statement
checks the format of the first character in the paragraph. If its alignment value is the same as the
original format (left-justified), the new format is applied to all the characters in the paragraph.
Otherwise, the format of the paragraph is set back to the original format. Alignment, along with formatting
like indent, bullet, tab stop, left and right margin are formats that are meant for paragraphs.
Note that once word wrap or line break is used, the formatting will only apply to the first line of the
paragraph if <codeph class="+ topic/ph pr-d/codeph ">endIndex</codeph> argument is not defined for the <codeph class="+ topic/ph pr-d/codeph ">setTextFormat()</codeph> method.</p>
<codeblock xml:space="preserve" class="+ topic/pre pr-d/codeblock ">
package {
import flash.display.Sprite;
import flash.text.TextField;
import flash.events.MouseEvent;
import flash.text.TextFormat;
import flash.text.TextFormatAlign;
public class TextField_getFirstCharInParagraphExample extends Sprite
{
private var myTextField:TextField = new TextField();
private var originalFormat:TextFormat = new TextFormat();
private var newFormat:TextFormat = new TextFormat();
public function TextField_getFirstCharInParagraphExample() {
myTextField.x = 10;
myTextField.y = 10;
myTextField.border = true;
myTextField.wordWrap = true;
myTextField.width = 300;
myTextField.height = 300;
myTextField.background = true;
myTextField.appendText("The TextField class is used to create display objects for "
+ "text display and input. All dynamic and input text fields in a SWF file "
+ "are instances of the TextField class. You can use the TextField class "
+ "to perform low-level text rendering. However, in Flex, you typically use "
+ "the Label, Text, TextArea, and TextInput controls to process text. "
+ "You can give a text field an instance name in the Property inspector "
+ "and use the methods and properties of the TextField class to manipulate it with ActionScript. "
+ "TextField instance names are displayed in the Movie Explorer and in the Insert "
+ "Target Path dialog box in the Actions panel.\n\n"
+ "To create a text field dynamically, use the TextField constructor.\n\n"
+ "The methods of the TextField class let you set, select, and manipulate "
+ "text in a dynamic or input text field that you create during authoring or at runtime.\n\n");
originalFormat = myTextField.getTextFormat(0);
newFormat.align = TextFormatAlign.RIGHT;
myTextField.addEventListener(MouseEvent.CLICK, clickHandler);
this.addChild(myTextField);
}
private function clickHandler(e:MouseEvent):void {
var clickIndex:int = myTextField.getCharIndexAtPoint(e.localX, e.localY);
if(clickIndex != -1) {
var paragraphFirstIndex:int = myTextField.getFirstCharInParagraph(clickIndex);
var paragraphEndIndex:int = paragraphFirstIndex + ((myTextField.getParagraphLength(clickIndex) - 1));
if (myTextField.getTextFormat(paragraphFirstIndex).align == originalFormat.align) {
myTextField.setTextFormat(newFormat, paragraphFirstIndex, paragraphEndIndex);
}else {
myTextField.setTextFormat(originalFormat, paragraphFirstIndex, paragraphEndIndex);
}
}
}
}
}
</codeblock></example></apiOperationDetail></apiOperation><apiOperation id="flash.text:TextField:getImageReference" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiOperation/apiOperation "><apiName class="- topic/title reference/title apiRef/apiName ">getImageReference</apiName><shortdesc class="- topic/shortdesc ">
Returns a DisplayObject reference for the given id, for an image or SWF file
that has been added to an HTML-formatted text field by using an &amp;lt;img&amp;gt; tag.</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="Flash" version="9" class="+ topic/ph adobe-api-d/apiPlatform "/><apiPlatform description="" name="Lite" version="4" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata></prolog><apiOperationDetail class="- topic/body reference/refbody apiRef/apiDetail apiOperation/apiOperationDetail "><apiOperationDef class="- topic/section reference/section apiRef/apiDef apiOperation/apiOperationDef "><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiReturn class="- topic/ph reference/ph apiRef/apiDefItem apiOperation/apiReturn "><apiDesc class="- topic/section reference/section apiRef/apiDesc ">The display object corresponding to the image or SWF file with the matching <codeph class="+ topic/ph pr-d/codeph ">id</codeph>
attribute in the <codeph class="+ topic/ph pr-d/codeph ">&lt;img&gt;</codeph> tag of the text field. For media loaded from an external source,
this object is a Loader object, and, once loaded, the media object is a child of that Loader object. For media
embedded in the SWF file, it is the loaded object. If no <codeph class="+ topic/ph pr-d/codeph ">&lt;img&gt;</codeph> tag with
the matching <codeph class="+ topic/ph pr-d/codeph ">id</codeph> exists, the method returns <codeph class="+ topic/ph pr-d/codeph ">null</codeph>.
</apiDesc><apiOperationClassifier class="- topic/xref reference/xref apiRef/apiRelation apiOperation/apiOperationClassifier ">flash.display:DisplayObject</apiOperationClassifier></apiReturn><apiParam class="- topic/ph reference/ph apiRef/apiDefItem apiOperation/apiParam "><apiItemName class="- topic/keyword reference/keyword apiRef/apiItemName ">id</apiItemName><apiOperationClassifier class="- topic/xref reference/xref apiRef/apiRelation apiOperation/apiOperationClassifier ">String</apiOperationClassifier><apiDesc class="- topic/section reference/section apiRef/apiDesc ">The <codeph class="+ topic/ph pr-d/codeph ">id</codeph> to match (in the <codeph class="+ topic/ph pr-d/codeph ">id</codeph> attribute of the
<codeph class="+ topic/ph pr-d/codeph ">&lt;img&gt;</codeph> tag).
</apiDesc></apiParam></apiOperationDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
Returns a DisplayObject reference for the given <codeph class="+ topic/ph pr-d/codeph ">id</codeph>, for an image or SWF file
that has been added to an HTML-formatted text field by using an <codeph class="+ topic/ph pr-d/codeph ">&lt;img&gt;</codeph> tag.
The <codeph class="+ topic/ph pr-d/codeph ">&lt;img&gt;</codeph> tag is in the following format:
<p class="- topic/p "><pre xml:space="preserve" class="- topic/pre "><codeph class="+ topic/ph pr-d/codeph "> &lt;img src = 'filename.jpg' id = 'instanceName' &gt;</codeph></pre></p>
</apiDesc><example conref="examples\TextField_getImageReferenceExample.as" class="- topic/example "> In the following example, when the text field is clicked, the image in the field is set to 25 percent opacity and
it rotates 90 degrees from its original rotation. The image will continue to rotate with each subsequent click.
<p class="- topic/p ">The image (<codeph class="+ topic/ph pr-d/codeph ">image.jpg</codeph>) is included via the HTML. (Here it is assumed that an image file is in the same
directory as the SWF file.) An <codeph class="+ topic/ph pr-d/codeph ">id</codeph> attribute needs to be defined for the <codeph class="+ topic/ph pr-d/codeph ">img</codeph> tag in order
to access the image using <codeph class="+ topic/ph pr-d/codeph ">getImageReference()</codeph> method. The <codeph class="+ topic/ph pr-d/codeph ">htmlText</codeph> property is used to include
HTML-formatted string content. When the user clicks on the <codeph class="+ topic/ph pr-d/codeph ">myTextField</codeph> text field, the <codeph class="+ topic/ph pr-d/codeph ">clickHandler()</codeph>
method is invoked.</p>
<p class="- topic/p ">In the <codeph class="+ topic/ph pr-d/codeph ">clickHandler()</codeph> method, the <codeph class="+ topic/ph pr-d/codeph ">getImageReference()</codeph> method returns a reference to
the image as a <codeph class="+ topic/ph pr-d/codeph ">DisplayObject</codeph>. This reference can be used to manipulate the image, like any <codeph class="+ topic/ph pr-d/codeph ">DisplayObject</codeph>
object. Here, the <codeph class="+ topic/ph pr-d/codeph ">alpha</codeph> (transparency) and <codeph class="+ topic/ph pr-d/codeph ">rotation</codeph> properties are set. The <codeph class="+ topic/ph pr-d/codeph ">transform</codeph>
property can also be used to access the display object's matrix, color transform, and pixel bounds. Note also that
<codeph class="+ topic/ph pr-d/codeph ">flash.display.DisplayObject</codeph> needs to be imported.</p>
<codeblock xml:space="preserve" class="+ topic/pre pr-d/codeblock ">
package {
import flash.display.Sprite;
import flash.text.TextField;
import flash.events.Event;
import flash.events.MouseEvent;
import flash.display.DisplayObject;
import flash.text.TextFieldAutoSize;
public class TextField_getImageReferenceExample extends Sprite
{
private var myTextField:TextField = new TextField();
public function TextField_getImageReferenceExample()
{
var myText1:String = "&lt;p&gt;Here is an image we want to mainpulate: &lt;img src='image.jpg' id='testimage'&gt;&lt;/p&gt;";
myTextField.x = 10;
myTextField.y = 10;
myTextField.width = 250;
myTextField.height = 250;
myTextField.background = true;
myTextField.border = true;
myTextField.border = true;
myTextField.multiline = true;
myTextField.htmlText = myText1;
myTextField.addEventListener(MouseEvent.CLICK, clickHandler);
this.addChild(myTextField);
}
private function clickHandler(e:MouseEvent):void {
var imageRef:DisplayObject = myTextField.getImageReference("testimage");
imageRef.rotation += 90;
imageRef.x = 125;
imageRef.y = 125;
imageRef.alpha = 0.25;
}
}
}
</codeblock></example></apiOperationDetail><related-links class="- topic/related-links "><link href="flash.text.xml#TextField/htmlText" class="- topic/link "><linktext class="- topic/linktext ">htmlText</linktext></link></related-links></apiOperation><apiOperation id="flash.text:TextField:getLineIndexAtPoint" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiOperation/apiOperation "><apiName class="- topic/title reference/title apiRef/apiName ">getLineIndexAtPoint</apiName><shortdesc class="- topic/shortdesc ">
Returns the zero-based index value of the line at the point specified by the x
and y parameters.</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="Flash" version="9" class="+ topic/ph adobe-api-d/apiPlatform "/><apiPlatform description="" name="Lite" version="4" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata></prolog><apiOperationDetail class="- topic/body reference/refbody apiRef/apiDetail apiOperation/apiOperationDetail "><apiOperationDef class="- topic/section reference/section apiRef/apiDef apiOperation/apiOperationDef "><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiReturn class="- topic/ph reference/ph apiRef/apiDefItem apiOperation/apiReturn "><apiDesc class="- topic/section reference/section apiRef/apiDesc ">The zero-based index value of the line (for example, the first line is 0, the
second line is 1, and so on). Returns -1 if the point is not over any line.
</apiDesc><apiOperationClassifier class="- topic/xref reference/xref apiRef/apiRelation apiOperation/apiOperationClassifier ">int</apiOperationClassifier></apiReturn><apiParam class="- topic/ph reference/ph apiRef/apiDefItem apiOperation/apiParam "><apiItemName class="- topic/keyword reference/keyword apiRef/apiItemName ">x</apiItemName><apiOperationClassifier class="- topic/xref reference/xref apiRef/apiRelation apiOperation/apiOperationClassifier ">Number</apiOperationClassifier><apiDesc class="- topic/section reference/section apiRef/apiDesc ">The <i class="+ topic/ph hi-d/i ">x</i> coordinate of the line.
</apiDesc></apiParam><apiParam class="- topic/ph reference/ph apiRef/apiDefItem apiOperation/apiParam "><apiItemName class="- topic/keyword reference/keyword apiRef/apiItemName ">y</apiItemName><apiOperationClassifier class="- topic/xref reference/xref apiRef/apiRelation apiOperation/apiOperationClassifier ">Number</apiOperationClassifier><apiDesc class="- topic/section reference/section apiRef/apiDesc ">The <i class="+ topic/ph hi-d/i ">y</i> coordinate of the line.
</apiDesc></apiParam><apiTipTexts><apiTipText class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiTipText ">The zero-based index value of the line at a specified point.
</apiTipText></apiTipTexts></apiOperationDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
Returns the zero-based index value of the line at the point specified by the <codeph class="+ topic/ph pr-d/codeph ">x</codeph>
and <codeph class="+ topic/ph pr-d/codeph ">y</codeph> parameters.
</apiDesc><example conref="examples\TextField_getLineIndexAtPointExample.as" class="- topic/example "> In the following example, when a user selects a line from the Shakespeare's sonnet,
it is copied (appended) into a new text field.
<p class="- topic/p ">In the constructor, the <codeph class="+ topic/ph pr-d/codeph ">poem</codeph> text field is set not to wrap (since it's a poem).
The <codeph class="+ topic/ph pr-d/codeph ">autoSize</codeph> property also is used to set the text to automatically fit and to have
it resize as a left-justified text. The <codeph class="+ topic/ph pr-d/codeph ">poemCopy</codeph> text field is placed under the
<codeph class="+ topic/ph pr-d/codeph ">poem</codeph> text field. When a user clicks on some line of the poem, the <codeph class="+ topic/ph pr-d/codeph ">clickHandler()</codeph>
method is invoked.</p>
<p class="- topic/p ">In <codeph class="+ topic/ph pr-d/codeph ">clickHandler()</codeph> method, the <codeph class="+ topic/ph pr-d/codeph ">getLineIndexAtPoint()</codeph> method returns
the line index of where the user has clicked based on the <codeph class="+ topic/ph pr-d/codeph ">localX</codeph> and <codeph class="+ topic/ph pr-d/codeph ">localY</codeph>
coordinates of the mouse click. (Since the original poem fits the size of the text field here,
it is not necessary to check for out of range error (<codeph class="+ topic/ph pr-d/codeph ">RangeError</codeph>) thrown by
<codeph class="+ topic/ph pr-d/codeph ">getCharIndexAtPoint()</codeph> method.) The line index is then used to get the content of
the line as a string with the <codeph class="+ topic/ph pr-d/codeph ">getLineText()</codeph> method, which is then appended to the
<codeph class="+ topic/ph pr-d/codeph ">poemCopy</codeph> text field content. The copying can go on continuously but after a point,
the text will be outside of the range of the viewable <codeph class="+ topic/ph pr-d/codeph ">poemCopy</codeph> text field.</p>
<codeblock xml:space="preserve" class="+ topic/pre pr-d/codeblock ">
package {
import flash.display.Sprite;
import flash.text.TextField;
import flash.events.MouseEvent;
import flash.text.TextFormat;
import flash.text.TextFieldAutoSize;
public class TextField_getLineIndexAtPointExample extends Sprite {
private var poem:TextField = new TextField();
private var poemCopy:TextField = new TextField();
public function TextField_getLineIndexAtPointExample() {
poem.border = true;
poem.autoSize = TextFieldAutoSize.LEFT;
poem.x = 10;
poem.wordWrap = false;
poemCopy.height = 250;
poemCopy.width = 270;
poemCopy.y = 230;
poemCopy.x = 10;
poemCopy.background = true;
poemCopy.border = true;
poemCopy.wordWrap = false;
poem.appendText("Let me not to the marriage of true minds\n"
+ "Admit impediments. love is not love\n"
+ "Which alters when it alteration finds\n"
+ "Or bends with the remover to remove:\n"
+ "O no! it is an ever-fixed mark\n"
+ "That looks on tempests and is never shaken;\n"
+ "It is the star to every wandering bark,\n"
+ "Whose worth's unknown, although his height be taken.\n"
+ "Love's not Time's fool, though rosy lips and cheeks\n"
+ "Within his bending sickle's compass come:\n"
+ "Love alters not with his brief hours and weeks,\n"
+ "But bears it out even to the edge of doom.\n"
+ "If this be error and upon me proved,\n"
+ "I never writ, nor no man ever loved.");
poem.addEventListener(MouseEvent.CLICK, clickHandler);
this.addChild(poem);
this.addChild(poemCopy);
}
private function clickHandler(e:MouseEvent):void {
var index:int = poem.getLineIndexAtPoint(e.localX, e.localY);
var s:String;
s = poem.getLineText(index);
poemCopy.appendText(s + "\n");
}
}
}
</codeblock></example></apiOperationDetail></apiOperation><apiOperation id="flash.text:TextField:getLineIndexOfChar" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiOperation/apiOperation "><apiName class="- topic/title reference/title apiRef/apiName ">getLineIndexOfChar</apiName><shortdesc class="- topic/shortdesc ">
Returns the zero-based index value of the line containing the character specified
by the charIndex parameter.</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="Flash" version="9" class="+ topic/ph adobe-api-d/apiPlatform "/><apiPlatform description="" name="Lite" version="4" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata></prolog><apiOperationDetail class="- topic/body reference/refbody apiRef/apiDetail apiOperation/apiOperationDetail "><apiOperationDef class="- topic/section reference/section apiRef/apiDef apiOperation/apiOperationDef "><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiException class="+ topic/ph reference/ph apiRef/apiDefItem apiOperation/apiEvent adobe-api-d/apiException "><apiDesc class="- topic/section reference/section apiRef/apiDesc ">The character index specified is out of range.
</apiDesc><apiItemName class="- topic/keyword reference/keyword apiRef/apiItemName ">RangeError</apiItemName><apiOperationClassifier class="- topic/xref reference/xref apiRef/apiRelation apiOperation/apiOperationClassifier ">RangeError</apiOperationClassifier></apiException><apiReturn class="- topic/ph reference/ph apiRef/apiDefItem apiOperation/apiReturn "><apiDesc class="- topic/section reference/section apiRef/apiDesc ">The zero-based index value of the line.
</apiDesc><apiOperationClassifier class="- topic/xref reference/xref apiRef/apiRelation apiOperation/apiOperationClassifier ">int</apiOperationClassifier></apiReturn><apiParam class="- topic/ph reference/ph apiRef/apiDefItem apiOperation/apiParam "><apiItemName class="- topic/keyword reference/keyword apiRef/apiItemName ">charIndex</apiItemName><apiOperationClassifier class="- topic/xref reference/xref apiRef/apiRelation apiOperation/apiOperationClassifier ">int</apiOperationClassifier><apiDesc class="- topic/section reference/section apiRef/apiDesc ">The zero-based index value of the character (for example, the first character is 0,
the second character is 1, and so on).
</apiDesc></apiParam><apiTipTexts><apiTipText class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiTipText ">The zero-based index value of the line containing the character that the
the <codeph class="+ topic/ph pr-d/codeph ">charIndex</codeph> parameter specifies.
</apiTipText></apiTipTexts></apiOperationDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
Returns the zero-based index value of the line containing the character specified
by the <codeph class="+ topic/ph pr-d/codeph ">charIndex</codeph> parameter.
</apiDesc><example conref="examples\TextField_getLineIndexOfCharExample.as" class="- topic/example "> In the following example, the <codeph class="+ topic/ph pr-d/codeph ">getLineIndexOfChar()</codeph> method returns
the line numbers for the 100th and 500th characters in the text field.
<p class="- topic/p ">The <codeph class="+ topic/ph pr-d/codeph ">myTextField</codeph> text field is defined to wrap and resize as a left-justified text.
The <codeph class="+ topic/ph pr-d/codeph ">getLineIndexOfChar()</codeph> method returns the line index for the specified character
indexes (100 and 500). This information is then appended after the paragraph. Note that since
line index begins with 0, the line index (<codeph class="+ topic/ph pr-d/codeph ">index</codeph>) is increased by 1 to get the line number.
Also if the display is resized the line number may change but the information here will stay the same
since the method is only invoked once.</p>
<codeblock xml:space="preserve" class="+ topic/pre pr-d/codeblock ">
package {
import flash.display.Sprite;
import flash.text.TextField;
import flash.text.TextFieldAutoSize;
public class TextField_getLineIndexOfCharExample extends Sprite
{
public function TextField_getLineIndexOfCharExample()
{
var myTextField:TextField = new TextField();
myTextField.x = 10;
myTextField.y = 10;
myTextField.width = 200;
myTextField.background = true;
myTextField.border = true;
myTextField.wordWrap = true;
myTextField.autoSize = TextFieldAutoSize.LEFT;
myTextField.appendText("The TextField class is used to create display objects for "
+ "text display and input. All dynamic and input text fields in a SWF file"
+ "are instances of the TextField class. You can use the TextField class "
+ "to perform low-level text rendering. However, in Flex, you typically use "
+ "the Label, Text, TextArea, and TextInput controls to process text. "
+ "You can give a text field an instance name in the Property inspector "
+ "and use the methods and properties of the TextField class to manipulate it with ActionScript. "
+ "TextField instance names are displayed in the Movie Explorer and in the Insert "
+ "Target Path dialog box in the Actions panel.\n\n");
var index:int = myTextField.getLineIndexOfChar(100);
myTextField.appendText("100th character is in line: " + (index + 1) + "\n");
index = myTextField.getLineIndexOfChar(500);
myTextField.appendText("500th character is in line: " + (index + 1));
this.addChild(myTextField);
}
}
}
</codeblock></example></apiOperationDetail></apiOperation><apiOperation id="flash.text:TextField:getLineLength" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiOperation/apiOperation "><apiName class="- topic/title reference/title apiRef/apiName ">getLineLength</apiName><shortdesc class="- topic/shortdesc ">
Returns the number of characters in a specific text line.</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="Flash" version="9" class="+ topic/ph adobe-api-d/apiPlatform "/><apiPlatform description="" name="Lite" version="4" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata><asCustoms class="+ topic/metadata adobe-api-d/asCustoms "><keyword class="- topic/keyword ">TextField, TextField.getLineLength, getLineLength
</keyword></asCustoms></prolog><apiOperationDetail class="- topic/body reference/refbody apiRef/apiDetail apiOperation/apiOperationDetail "><apiOperationDef class="- topic/section reference/section apiRef/apiDef apiOperation/apiOperationDef "><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiException class="+ topic/ph reference/ph apiRef/apiDefItem apiOperation/apiEvent adobe-api-d/apiException "><apiDesc class="- topic/section reference/section apiRef/apiDesc ">The line number specified is out of range.
</apiDesc><apiItemName class="- topic/keyword reference/keyword apiRef/apiItemName ">RangeError</apiItemName><apiOperationClassifier class="- topic/xref reference/xref apiRef/apiRelation apiOperation/apiOperationClassifier ">RangeError</apiOperationClassifier></apiException><apiReturn class="- topic/ph reference/ph apiRef/apiDefItem apiOperation/apiReturn "><apiDesc class="- topic/section reference/section apiRef/apiDesc ">The number of characters in the line.
</apiDesc><apiOperationClassifier class="- topic/xref reference/xref apiRef/apiRelation apiOperation/apiOperationClassifier ">int</apiOperationClassifier></apiReturn><apiParam class="- topic/ph reference/ph apiRef/apiDefItem apiOperation/apiParam "><apiItemName class="- topic/keyword reference/keyword apiRef/apiItemName ">lineIndex</apiItemName><apiOperationClassifier class="- topic/xref reference/xref apiRef/apiRelation apiOperation/apiOperationClassifier ">int</apiOperationClassifier><apiDesc class="- topic/section reference/section apiRef/apiDesc ">The line number for which you want the length.
</apiDesc></apiParam><apiTipTexts><apiTipText class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiTipText ">Returns the number of characters in a specific text line.
</apiTipText></apiTipTexts></apiOperationDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
Returns the number of characters in a specific text line.
</apiDesc><example conref="examples\TextField_getLineLengthExample.as" class="- topic/example "> In the following example, once the user selects a line, its line length (number of characters) is
displayed in a separate text field.
<p class="- topic/p ">As an illustration, <codeph class="+ topic/ph pr-d/codeph ">myTextField</codeph> text field, which displays the text that will be counted, is set to
<codeph class="+ topic/ph pr-d/codeph ">INPUT</codeph>, meaning users can actually change the lines or add lines between the lines or at the end.
(There is an empty line created by using line break (<codeph class="+ topic/ph pr-d/codeph ">\n</codeph>) at the end of the last line.) The <codeph class="+ topic/ph pr-d/codeph ">countLines</codeph>
text field, where the result of counting the line length is displayed, is set below <codeph class="+ topic/ph pr-d/codeph ">myTextField</codeph>
text field and its text is not selectable. When the user clicks on a line in the <codeph class="+ topic/ph pr-d/codeph ">myTextField</codeph> text field,
the <codeph class="+ topic/ph pr-d/codeph ">clickHandler()</codeph> method is invoked.</p>
<p class="- topic/p ">In the <codeph class="+ topic/ph pr-d/codeph ">clickHandler()</codeph> method, the <codeph class="+ topic/ph pr-d/codeph ">getLineIndexAtPoint()</codeph> method returns the line index of
where the user clicked, by using the <codeph class="+ topic/ph pr-d/codeph ">localX</codeph> and <codeph class="+ topic/ph pr-d/codeph ">localY</codeph> coordinates of the mouse click.
The <codeph class="+ topic/ph pr-d/codeph ">if</codeph> statement checks to see if the use has clicked on a character. If so, the
<codeph class="+ topic/ph pr-d/codeph ">getLineLength()</codeph> method, using the index of line, returns the number of characters in the line.
Note that the empty lines between the lines include the second line break (<codeph class="+ topic/ph pr-d/codeph ">\n</codeph>) and have
a count of 1 character, while the line after the last line has a 0 count. Spaces also count as one character.
The users can write a new line or changes a line and get the character count of the line by clicking on it.
If text wrap is used and the screen is resized, the line index could change.</p>
<codeblock xml:space="preserve" class="+ topic/pre pr-d/codeblock ">
package {
import flash.display.Sprite;
import flash.text.TextField;
import flash.text.TextFieldType;
import flash.events.Event;
import flash.events.MouseEvent;
public class TextField_getLineLengthExample extends Sprite {
private var myTextField:TextField = new TextField();
private var countLines:TextField = new TextField();
public function TextField_getLineLengthExample() {
myTextField.x = 10;
myTextField.y = 10;
myTextField.width = 350;
myTextField.height = 150;
myTextField.background = true;
myTextField.border = true;
myTextField.type = TextFieldType.INPUT;
myTextField.appendText("Click on the lines to count its number of characters:\n\n");
myTextField.appendText("This is a short line.\n");
myTextField.appendText("This is a longer line than the last line.\n\n");
myTextField.appendText("This one is even longer than the one before. It has two sentences.\n");
this.addChild(myTextField);
countLines.border = true;
countLines.x = 10;
countLines.y = 180;
countLines.height = 30;
countLines.width = 200;
countLines.background = true;
countLines.selectable = false;
this.addChild(countLines);
myTextField.addEventListener(MouseEvent.CLICK, clickHandler);
}
private function clickHandler(e:MouseEvent):void {
var index:int = myTextField.getLineIndexAtPoint(e.localX, e.localY);
if (index != -1) {
var lenght:int = myTextField.getLineLength(index);
countLines.text = "Number of characters in the line is: " + lenght.toString();
}
}
}
}
</codeblock></example></apiOperationDetail></apiOperation><apiOperation id="flash.text:TextField:getLineMetrics" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiOperation/apiOperation "><apiName class="- topic/title reference/title apiRef/apiName ">getLineMetrics</apiName><shortdesc class="- topic/shortdesc ">
Returns metrics information about a given text line.</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="Flash" version="9" class="+ topic/ph adobe-api-d/apiPlatform "/><apiPlatform description="" name="Lite" version="4" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata><asCustoms class="+ topic/metadata adobe-api-d/asCustoms "><keyword class="- topic/keyword ">TextField, TextField.getLineMetrics, getLineMetrics
</keyword></asCustoms></prolog><apiOperationDetail class="- topic/body reference/refbody apiRef/apiDetail apiOperation/apiOperationDetail "><apiOperationDef class="- topic/section reference/section apiRef/apiDef apiOperation/apiOperationDef "><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiException class="+ topic/ph reference/ph apiRef/apiDefItem apiOperation/apiEvent adobe-api-d/apiException "><apiDesc class="- topic/section reference/section apiRef/apiDesc ">The line number specified is out of range.
</apiDesc><apiItemName class="- topic/keyword reference/keyword apiRef/apiItemName ">RangeError</apiItemName><apiOperationClassifier class="- topic/xref reference/xref apiRef/apiRelation apiOperation/apiOperationClassifier ">RangeError</apiOperationClassifier></apiException><apiReturn class="- topic/ph reference/ph apiRef/apiDefItem apiOperation/apiReturn "><apiDesc class="- topic/section reference/section apiRef/apiDesc ">A TextLineMetrics object.
</apiDesc><apiOperationClassifier class="- topic/xref reference/xref apiRef/apiRelation apiOperation/apiOperationClassifier ">flash.text:TextLineMetrics</apiOperationClassifier></apiReturn><apiParam class="- topic/ph reference/ph apiRef/apiDefItem apiOperation/apiParam "><apiItemName class="- topic/keyword reference/keyword apiRef/apiItemName ">lineIndex</apiItemName><apiOperationClassifier class="- topic/xref reference/xref apiRef/apiRelation apiOperation/apiOperationClassifier ">int</apiOperationClassifier><apiDesc class="- topic/section reference/section apiRef/apiDesc ">The line number for which you want metrics information.
</apiDesc></apiParam><apiTipTexts><apiTipText class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiTipText ">Returns metrics information about a given text line.
</apiTipText></apiTipTexts></apiOperationDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
Returns metrics information about a given text line.
</apiDesc><example conref="examples\TextField_getLineMetricsExample.as" class="- topic/example "> The following example displays some line metrics values for two differently formatted lines of text.
<p class="- topic/p ">The text appended is two lines from the <i class="+ topic/ph hi-d/i ">Song of Myself</i> by Walt Whitman. A new TextFormat object
(<codeph class="+ topic/ph pr-d/codeph ">newFormat</codeph>) is used to set the format of the second line. The first line holds the
default format. The <codeph class="+ topic/ph pr-d/codeph ">getLineMetrics()</codeph> method returns a <codeph class="+ topic/ph pr-d/codeph ">TextLineMetrics</codeph>
object for a specific line. (Line index begins with 0.) Using <codeph class="+ topic/ph pr-d/codeph ">metrics1</codeph> and <codeph class="+ topic/ph pr-d/codeph ">metrics2</codeph>
TextLineMetrics objects for the line one and two, respectively, the ascent, descent, height, and weight
value of the line are retrieved and displayed. The result numbers are converted to
string but not rounded. Note that this value is for the line and not a specific character. It
reflects the range of characters for a line. For example, if a line has different characters with
different height formats, the character with the highest height will determine the value. This also
means that if one of the character's format is changes, some of the metrics values could also change.</p>
<codeblock xml:space="preserve" class="+ topic/pre pr-d/codeblock ">
package {
import flash.display.Sprite;
import flash.text.TextField;
import flash.text.TextLineMetrics;
import flash.text.TextFieldAutoSize;
import flash.text.AntiAliasType;
import flash.text.TextFormat;
public class TextField_getLineMetricsExample extends Sprite {
public function TextField_getLineMetricsExample() {
var myTextField:TextField = new TextField();
var newFormat:TextFormat = new TextFormat();
myTextField.x = 10;
myTextField.y = 10;
myTextField.background = true;
myTextField.wordWrap = false;
myTextField.autoSize = TextFieldAutoSize.LEFT;
myTextField.appendText("A child said What is the grass? fetching it to me with full hands;\n");
myTextField.appendText("How could I answer the child? I do not know what it is any more than he.\n\n");
newFormat.size = 14;
newFormat.font = "Arial";
newFormat.italic = true;
myTextField.setTextFormat(newFormat, 67, 139);
var metrics1:TextLineMetrics = myTextField.getLineMetrics(0);
myTextField.appendText("Metrics ascent for the line 1 is: " + metrics1.ascent.toString() + "\n");
myTextField.appendText("Metrics descent is: " + metrics1.descent.toString() + "\n");
myTextField.appendText("Metrics height is: " + metrics1.height.toString() + "\n");
myTextField.appendText("Metrics width is: " + metrics1.width.toString() + "\n\n");
var metrics2:TextLineMetrics = myTextField.getLineMetrics(1);
myTextField.appendText("Metrics ascent for the line 2 is: " + metrics2.ascent.toString() + "\n");
myTextField.appendText("Metrics descent is: " + metrics2.descent.toString() + "\n");
myTextField.appendText("Metrics height is: " + metrics2.height.toString() + "\n");
myTextField.appendText("Metrics width is: " + metrics2.width.toString() + "\n");
addChild(myTextField);
}
}
}
</codeblock></example></apiOperationDetail><related-links class="- topic/related-links "><link href="flash.text.xml#TextLineMetrics" class="- topic/link "><linktext class="- topic/linktext ">flash.text.TextLineMetrics</linktext></link><link href="flash.text.xml#TextLineMetrics" class="- topic/link "><linktext class="- topic/linktext ">flash.text.TextLineMetrics</linktext></link></related-links></apiOperation><apiOperation id="flash.text:TextField:getLineOffset" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiOperation/apiOperation "><apiName class="- topic/title reference/title apiRef/apiName ">getLineOffset</apiName><shortdesc class="- topic/shortdesc ">
Returns the character index of the first character in the line that
the lineIndex parameter specifies.</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="Flash" version="9" class="+ topic/ph adobe-api-d/apiPlatform "/><apiPlatform description="" name="Lite" version="4" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata></prolog><apiOperationDetail class="- topic/body reference/refbody apiRef/apiDetail apiOperation/apiOperationDetail "><apiOperationDef class="- topic/section reference/section apiRef/apiDef apiOperation/apiOperationDef "><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiException class="+ topic/ph reference/ph apiRef/apiDefItem apiOperation/apiEvent adobe-api-d/apiException "><apiDesc class="- topic/section reference/section apiRef/apiDesc ">The line number specified is out of range.
</apiDesc><apiItemName class="- topic/keyword reference/keyword apiRef/apiItemName ">RangeError</apiItemName><apiOperationClassifier class="- topic/xref reference/xref apiRef/apiRelation apiOperation/apiOperationClassifier ">RangeError</apiOperationClassifier></apiException><apiReturn class="- topic/ph reference/ph apiRef/apiDefItem apiOperation/apiReturn "><apiDesc class="- topic/section reference/section apiRef/apiDesc ">The zero-based index value of the first character in the line.
</apiDesc><apiOperationClassifier class="- topic/xref reference/xref apiRef/apiRelation apiOperation/apiOperationClassifier ">int</apiOperationClassifier></apiReturn><apiParam class="- topic/ph reference/ph apiRef/apiDefItem apiOperation/apiParam "><apiItemName class="- topic/keyword reference/keyword apiRef/apiItemName ">lineIndex</apiItemName><apiOperationClassifier class="- topic/xref reference/xref apiRef/apiRelation apiOperation/apiOperationClassifier ">int</apiOperationClassifier><apiDesc class="- topic/section reference/section apiRef/apiDesc ">The zero-based index value of the line (for example, the first line is 0,
the second line is 1, and so on).
</apiDesc></apiParam><apiTipTexts><apiTipText class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiTipText ">The zero-based index value of the first character in the line.
</apiTipText></apiTipTexts></apiOperationDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
Returns the character index of the first character in the line that
the <codeph class="+ topic/ph pr-d/codeph ">lineIndex</codeph> parameter specifies.
</apiDesc><example conref="examples\TextField_getLineOffsetExample.as" class="- topic/example "> The following example checks for the first character of the line 4, which
will change if the screen (and the text field) is resized.
<p class="- topic/p ">The <codeph class="+ topic/ph pr-d/codeph ">myTextField</codeph> text field is set to word wrap. The <codeph class="+ topic/ph pr-d/codeph ">countField</codeph>
text field will display the first character of line 4. When the user clicks on the <codeph class="+ topic/ph pr-d/codeph ">myTextField</codeph>
text field, the <codeph class="+ topic/ph pr-d/codeph ">clickHandler()</codeph> method is invoked.</p>
<p class="- topic/p ">In the <codeph class="+ topic/ph pr-d/codeph ">clickHandler()</codeph> method, the <codeph class="+ topic/ph pr-d/codeph ">getLineOffset()</codeph> method returns
the index of the first character in the line index 3, which is the fourth line of the text.
(First line has a 0 index.) The <codeph class="+ topic/ph pr-d/codeph ">charAt()</codeph> method is used to get the character
using the index of the first character of the fourth line. The <codeph class="+ topic/ph pr-d/codeph ">countField</codeph> text field
content is updated with this information using the <codeph class="+ topic/ph pr-d/codeph ">text</codeph> property of the
<codeph class="+ topic/ph pr-d/codeph ">countField</codeph> text field. Using the <codeph class="+ topic/ph pr-d/codeph ">countField.text</codeph> property means that
each time after the click the content of the <codeph class="+ topic/ph pr-d/codeph ">countField</codeph> text field will be overwritten.
If the user resizes the display, the content will wrap and the first character of the line 4 could
change. By clicking again on the <codeph class="+ topic/ph pr-d/codeph ">myTextField</codeph> field, the content of <codeph class="+ topic/ph pr-d/codeph ">countField</codeph>
text field is updated with the new first character for the fourth line.</p>
<codeblock xml:space="preserve" class="+ topic/pre pr-d/codeblock ">
package {
import flash.display.Sprite;
import flash.text.TextField;
import flash.events.MouseEvent;
public class TextField_getLineOffsetExample extends Sprite {
private var myTextField:TextField = new TextField();
private var countField:TextField = new TextField();
public function TextField_getLineOffsetExample() {
myTextField.x = 10;
myTextField.y = 10;
myTextField.width = 150;
myTextField.height = 300;
myTextField.background = true;
myTextField.border = true;
myTextField.wordWrap = true;
countField.height = 20;
countField.width = 200;
countField.x = 10;
countField.y = 320;
countField.selectable = false;
myTextField.appendText("The TextField class is used to create display objects for "
+ "text display and input. All dynamic and input text fields in a SWF file "
+ "are instances of the TextField class. You can use the TextField class "
+ "to perform low-level text rendering. However, in Flex, you typically use "
+ "the Label, Text, TextArea, and TextInput controls to process text. "
+ "You can give a text field an instance name in the Property inspector "
+ "and use the methods and properties of the TextField class to manipulate it with ActionScript.");
myTextField.addEventListener(MouseEvent.CLICK, clickHandler);
this.addChild(myTextField);
this.addChild(countField);
}
private function clickHandler(e:MouseEvent):void {
var c:String;
var index:int;
index = myTextField.getLineOffset(3);
c = myTextField.text.charAt(index);
countField.text = "The first character of line 4 is: " + c;
}
}
}
</codeblock></example></apiOperationDetail></apiOperation><apiOperation id="flash.text:TextField:getLineText" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiOperation/apiOperation "><apiName class="- topic/title reference/title apiRef/apiName ">getLineText</apiName><shortdesc class="- topic/shortdesc ">
Returns the text of the line specified by the lineIndex parameter.</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="Flash" version="9" class="+ topic/ph adobe-api-d/apiPlatform "/><apiPlatform description="" name="Lite" version="4" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata></prolog><apiOperationDetail class="- topic/body reference/refbody apiRef/apiDetail apiOperation/apiOperationDetail "><apiOperationDef class="- topic/section reference/section apiRef/apiDef apiOperation/apiOperationDef "><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiException class="+ topic/ph reference/ph apiRef/apiDefItem apiOperation/apiEvent adobe-api-d/apiException "><apiDesc class="- topic/section reference/section apiRef/apiDesc ">The line number specified is out of range.
</apiDesc><apiItemName class="- topic/keyword reference/keyword apiRef/apiItemName ">RangeError</apiItemName><apiOperationClassifier class="- topic/xref reference/xref apiRef/apiRelation apiOperation/apiOperationClassifier ">RangeError</apiOperationClassifier></apiException><apiReturn class="- topic/ph reference/ph apiRef/apiDefItem apiOperation/apiReturn "><apiDesc class="- topic/section reference/section apiRef/apiDesc ">The text string contained in the specified line.
</apiDesc><apiOperationClassifier class="- topic/xref reference/xref apiRef/apiRelation apiOperation/apiOperationClassifier ">String</apiOperationClassifier></apiReturn><apiParam class="- topic/ph reference/ph apiRef/apiDefItem apiOperation/apiParam "><apiItemName class="- topic/keyword reference/keyword apiRef/apiItemName ">lineIndex</apiItemName><apiOperationClassifier class="- topic/xref reference/xref apiRef/apiRelation apiOperation/apiOperationClassifier ">int</apiOperationClassifier><apiDesc class="- topic/section reference/section apiRef/apiDesc ">The zero-based index value of the line (for example, the first line is 0,
the second line is 1, and so on).
</apiDesc></apiParam><apiTipTexts><apiTipText class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiTipText ">The text string contained in the specified line.
</apiTipText></apiTipTexts></apiOperationDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
Returns the text of the line specified by the <codeph class="+ topic/ph pr-d/codeph ">lineIndex</codeph> parameter.
</apiDesc><example conref="examples\TextField_getLineTextExample.as" class="- topic/example "> In the following example, the line numbers of all the instances of the word "love" used in Shakespeare's
sonnet are found and displayed.
<p class="- topic/p ">The <codeph class="+ topic/ph pr-d/codeph ">poem</codeph> text field is set to fit automatically the text and to resize as a left-justified text.
The <codeph class="+ topic/ph pr-d/codeph ">wordWrap</codeph> property is set to <codeph class="+ topic/ph pr-d/codeph ">false</codeph>, so the lines of the poem would not wrap, though
normally when using the <codeph class="+ topic/ph pr-d/codeph ">autoSize</codeph> property, this should not be a problem. The <codeph class="+ topic/ph pr-d/codeph ">for</codeph> loop iterates through the lines
of the sonnet using the property <codeph class="+ topic/ph pr-d/codeph ">numLines</codeph> of the text field. The <codeph class="+ topic/ph pr-d/codeph ">getLineText()</codeph> method
returns the content of the line as a string. (Note that the <codeph class="+ topic/ph pr-d/codeph ">numLines</codeph> property returns the number
of lines starting with line 1, while for the <codeph class="+ topic/ph pr-d/codeph ">getLineText()</codeph> method the line number begins with 0.)
Using the regular expression pattern (<codeph class="+ topic/ph pr-d/codeph ">/love/i</codeph>), the <codeph class="+ topic/ph pr-d/codeph ">if</codeph> statement looks for any substring
of the word in upper or lowercase. If the pattern is found, the <codeph class="+ topic/ph pr-d/codeph ">search</codeph> method returns the index of
the first matching substring, otherwise it returns <codeph class="+ topic/ph pr-d/codeph ">-1</codeph> (if there is no match). The line number where
"love" was found (<codeph class="+ topic/ph pr-d/codeph ">(i + 1)</codeph>) is then placed in the string <codeph class="+ topic/ph pr-d/codeph ">lineResult</codeph>. The string method converts
the number argument (<codeph class="+ topic/ph pr-d/codeph ">(i + 1)</codeph>) to a string as long as there is another argument that is a string (" ").
The line result of the search will include lines with the words "loved" or "Love's." If the string "Love was found in lines:"
was appended before the <codeph class="+ topic/ph pr-d/codeph ">for</codeph> loop, the word "Love" in this line would also have been included.</p>
<codeblock xml:space="preserve" class="+ topic/pre pr-d/codeblock ">
package {
import flash.display.Sprite;
import flash.text.TextField;
import flash.text.TextFieldAutoSize;
import flash.utils.Timer;
import flash.events.TimerEvent;
public class TextField_getLineTextExample extends Sprite {
public function TextField_getLineTextExample() {
var poem:TextField = new TextField();
var lineResult:String = "";
var pattern:RegExp = /love/i;
poem.x = 10;
poem.y = 10;
poem.background = true;
poem.wordWrap = false;
poem.autoSize = TextFieldAutoSize.LEFT;
poem.text = "Let me not to the marriage of true minds\n"
+ "Admit impediments. love is not love\n"
+ "Which alters when it alteration finds\n"
+ "Or bends with the remover to remove:\n"
+ "O no! it is an ever-fixed mark\n"
+ "That looks on tempests and is never shaken;\n"
+ "It is the star to every wandering bark,\n"
+ "Whose worth's unknown, although his height be taken.\n"
+ "Love's not Time's fool, though rosy lips and cheeks\n"
+ "Within his bending sickle's compass come:\n"
+ "Love alters not with his brief hours and weeks,\n"
+ "But bears it out even to the edge of doom.\n"
+ "If this be error and upon me proved,\n"
+ "I never writ, nor no man ever loved.\n\n";
for (var i:int = 0; i &lt; poem.numLines; i++) {
var s:String = poem.getLineText(i);
if(s.search(pattern) != -1) {
lineResult += (i + 1) + " ";
}
}
poem.appendText("Love was found in lines: " + lineResult);
this.addChild(poem);
}
}
}
</codeblock></example></apiOperationDetail></apiOperation><apiOperation id="flash.text:TextField:getParagraphLength" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiOperation/apiOperation "><apiName class="- topic/title reference/title apiRef/apiName ">getParagraphLength</apiName><shortdesc class="- topic/shortdesc ">
Given a character index, returns the length of the paragraph containing the given character.</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="Flash" version="9" class="+ topic/ph adobe-api-d/apiPlatform "/><apiPlatform description="" name="Lite" version="4" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata></prolog><apiOperationDetail class="- topic/body reference/refbody apiRef/apiDetail apiOperation/apiOperationDetail "><apiOperationDef class="- topic/section reference/section apiRef/apiDef apiOperation/apiOperationDef "><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiException class="+ topic/ph reference/ph apiRef/apiDefItem apiOperation/apiEvent adobe-api-d/apiException "><apiDesc class="- topic/section reference/section apiRef/apiDesc ">The character index specified is out of range.
</apiDesc><apiItemName class="- topic/keyword reference/keyword apiRef/apiItemName ">RangeError</apiItemName><apiOperationClassifier class="- topic/xref reference/xref apiRef/apiRelation apiOperation/apiOperationClassifier ">RangeError</apiOperationClassifier></apiException><apiReturn class="- topic/ph reference/ph apiRef/apiDefItem apiOperation/apiReturn "><apiDesc class="- topic/section reference/section apiRef/apiDesc ">Returns the number of characters in the paragraph.
</apiDesc><apiOperationClassifier class="- topic/xref reference/xref apiRef/apiRelation apiOperation/apiOperationClassifier ">int</apiOperationClassifier></apiReturn><apiParam class="- topic/ph reference/ph apiRef/apiDefItem apiOperation/apiParam "><apiItemName class="- topic/keyword reference/keyword apiRef/apiItemName ">charIndex</apiItemName><apiOperationClassifier class="- topic/xref reference/xref apiRef/apiRelation apiOperation/apiOperationClassifier ">int</apiOperationClassifier><apiDesc class="- topic/section reference/section apiRef/apiDesc ">The zero-based index value of the character (for example, the first character is 0,
the second character is 1, and so on).
</apiDesc></apiParam><apiTipTexts><apiTipText class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiTipText ">The zero-based index value of the character.
</apiTipText></apiTipTexts></apiOperationDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
Given a character index, returns the length of the paragraph containing the given character.
The length is relative to the first character in the paragraph (as returned by
<codeph class="+ topic/ph pr-d/codeph ">getFirstCharInParagraph()</codeph>), not to the character index passed in.
</apiDesc><example conref="examples\TextField_getParagraphLengthExample.as" class="- topic/example "> In the following example, when a user selects a paragraph, the paragraph's length and number
of "s" characters in the paragraph are displayed in a separate text field.
<p class="- topic/p ">The <codeph class="+ topic/ph pr-d/codeph ">myTextField</codeph> text field displays the paragraphs that the user will select.
When the user click on the text field, the <codeph class="+ topic/ph pr-d/codeph ">MouseEvent.CLICK</codeph> event is dispatched, and
the <codeph class="+ topic/ph pr-d/codeph ">clickHandler()</codeph> method is called. The paragraph length and number of "s" characters
will appear in <codeph class="+ topic/ph pr-d/codeph ">countField</codeph> text field, which is placed below <codeph class="+ topic/ph pr-d/codeph ">myTextField</codeph> text field.</p>
<p class="- topic/p ">In the <codeph class="+ topic/ph pr-d/codeph ">clickHandler()</codeph> method, the <codeph class="+ topic/ph pr-d/codeph ">getCharIndexAtPoint()</codeph> method returns the character's
index based on the <codeph class="+ topic/ph pr-d/codeph ">localX</codeph> and <codeph class="+ topic/ph pr-d/codeph ">localY</codeph> coordinates of the mouse click. The first <codeph class="+ topic/ph pr-d/codeph ">if</codeph>
statement checks to see if the use has clicked on a character. The <codeph class="+ topic/ph pr-d/codeph ">getFirstCharInParagraph()</codeph> method,
uses this index to return the index of the first character in the same paragraph. The paragraph length returned by
<codeph class="+ topic/ph pr-d/codeph ">getParagraphLength()</codeph> method is used with the index of the first character in the paragraph to determine the
index for the end of the paragraph. A <codeph class="+ topic/ph pr-d/codeph ">for</codeph> loop iterates through the paragraph looking for the number of "s"
characters.</p>
<codeblock xml:space="preserve" class="+ topic/pre pr-d/codeblock ">
package {
import flash.display.Sprite;
import flash.text.TextField;
import flash.events.MouseEvent;
public class TextField_getParagraphLengthExample extends Sprite {
private var myTextField:TextField = new TextField();
private var countField:TextField = new TextField();
public function TextField_getParagraphLengthExample() {
myTextField.x = 10;
myTextField.y = 10;
myTextField.background = true;
myTextField.border = true;
myTextField.wordWrap = true;
myTextField.width = 300;
myTextField.height = 280;
myTextField.appendText("The TextField class is used to create display objects for "
+ "text display and input. All dynamic and input text fields in a SWF file"
+ "are instances of the TextField class. You can use the TextField class "
+ "to perform low-level text rendering. However, in Flex, you typically use "
+ "the Label, Text, TextArea, and TextInput controls to process text. "
+ "You can give a text field an instance name in the Property inspector "
+ "and use the methods and properties of the TextField class to manipulate it with ActionScript. "
+ "TextField instance names are displayed in the Movie Explorer and in the Insert "
+ "Target Path dialog box in the Actions panel.\n\n"
+ "To create a text field dynamically, use the TextField() constructor.\n\n"
+ "The methods of the TextField class let you set, select, and manipulate "
+ "text in a dynamic or input text field that you create during authoring or at runtime.");
myTextField.addEventListener(MouseEvent.CLICK, clickHandler);
countField.x = 10;
countField.y = 300;
countField.height = 50;
countField.width = 250;
countField.background = true;
countField.selectable = false;
this.addChild(myTextField);
this.addChild(countField);
}
private function clickHandler(e:MouseEvent):void {
var index:int = myTextField.getCharIndexAtPoint(e.localX, e.localY);
if(index != -1) {
var beginParag:int = myTextField.getFirstCharInParagraph(index);
var paragLength:int = myTextField.getParagraphLength(index);
var endParag:int = beginParag + paragLength;
var sCount:uint = 0;
for (var i:int = beginParag; i &lt;= endParag; i++) {
if ((myTextField.text.charAt(i) == "s") || (myTextField.text.charAt(i) == "S")) {
sCount++;
}
countField.text = "Paragraph length is: " + paragLength.toString() + "\n"
+ "Number of 's' characters in the paragraph: " + sCount.toString();
}
}
}
}
}
</codeblock></example></apiOperationDetail><related-links class="- topic/related-links "><link href="flash.text.xml#TextField/getFirstCharInParagraph()" class="- topic/link "><linktext class="- topic/linktext ">flash.text.TextField.getFirstCharInParagraph()</linktext></link></related-links></apiOperation><apiOperation id="flash.text:TextField:getTextFormat" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiOperation/apiOperation "><apiName class="- topic/title reference/title apiRef/apiName ">getTextFormat</apiName><shortdesc class="- topic/shortdesc ">
Returns a TextFormat object that contains formatting information for the range of text that the
beginIndex and endIndex parameters specify.</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="Flash" version="9" class="+ topic/ph adobe-api-d/apiPlatform "/><apiPlatform description="" name="Lite" version="4" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata><asCustoms class="+ topic/metadata adobe-api-d/asCustoms "><keyword class="- topic/keyword ">TextField, TextField.getTextFormat, getTextFormat
</keyword></asCustoms></prolog><apiOperationDetail class="- topic/body reference/refbody apiRef/apiDetail apiOperation/apiOperationDetail "><apiOperationDef class="- topic/section reference/section apiRef/apiDef apiOperation/apiOperationDef "><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiException class="+ topic/ph reference/ph apiRef/apiDefItem apiOperation/apiEvent adobe-api-d/apiException "><apiDesc class="- topic/section reference/section apiRef/apiDesc ">The <codeph class="+ topic/ph pr-d/codeph ">beginIndex</codeph> or <codeph class="+ topic/ph pr-d/codeph ">endIndex</codeph> specified is out of range.
</apiDesc><apiItemName class="- topic/keyword reference/keyword apiRef/apiItemName ">RangeError</apiItemName><apiOperationClassifier class="- topic/xref reference/xref apiRef/apiRelation apiOperation/apiOperationClassifier ">RangeError</apiOperationClassifier></apiException><apiReturn class="- topic/ph reference/ph apiRef/apiDefItem apiOperation/apiReturn "><apiDesc class="- topic/section reference/section apiRef/apiDesc ">The TextFormat object that represents the formatting properties for the specified text.
</apiDesc><apiOperationClassifier class="- topic/xref reference/xref apiRef/apiRelation apiOperation/apiOperationClassifier ">flash.text:TextFormat</apiOperationClassifier></apiReturn><apiParam class="- topic/ph reference/ph apiRef/apiDefItem apiOperation/apiParam "><apiItemName class="- topic/keyword reference/keyword apiRef/apiItemName ">beginIndex</apiItemName><apiOperationClassifier class="- topic/xref reference/xref apiRef/apiRelation apiOperation/apiOperationClassifier ">int</apiOperationClassifier><apiData class="- topic/ph reference/ph apiRef/apiData ">-1</apiData><apiDesc class="- topic/section reference/section apiRef/apiDesc ">Optional; an integer that specifies the starting location of a range of text within the text field.
</apiDesc></apiParam><apiParam class="- topic/ph reference/ph apiRef/apiDefItem apiOperation/apiParam "><apiItemName class="- topic/keyword reference/keyword apiRef/apiItemName ">endIndex</apiItemName><apiOperationClassifier class="- topic/xref reference/xref apiRef/apiRelation apiOperation/apiOperationClassifier ">int</apiOperationClassifier><apiData class="- topic/ph reference/ph apiRef/apiData ">-1</apiData><apiDesc class="- topic/section reference/section apiRef/apiDesc ">Optional; an integer that specifies the position of the first character after the desired
text span. As designed, if you specify <codeph class="+ topic/ph pr-d/codeph ">beginIndex</codeph> and <codeph class="+ topic/ph pr-d/codeph ">endIndex</codeph> values,
the text from <codeph class="+ topic/ph pr-d/codeph ">beginIndex</codeph> to <codeph class="+ topic/ph pr-d/codeph ">endIndex-1</codeph> is read.
</apiDesc></apiParam><apiTipTexts><apiTipText class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiTipText ">Returns a TextFormat object.
</apiTipText></apiTipTexts></apiOperationDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
Returns a TextFormat object that contains formatting information for the range of text that the
<codeph class="+ topic/ph pr-d/codeph ">beginIndex</codeph> and <codeph class="+ topic/ph pr-d/codeph ">endIndex</codeph> parameters specify. Only properties
that are common to the entire text specified are set in the resulting TextFormat object.
Any property that is <i class="+ topic/ph hi-d/i ">mixed</i>, meaning that it has different values
at different points in the text, has a value of <codeph class="+ topic/ph pr-d/codeph ">null</codeph>.
<p class="- topic/p ">If you do not specify
values for these parameters, this method is applied to all the text in the text field. </p>
<p class="- topic/p ">The following table describes three possible usages:</p>
<adobetable class="innertable"><tgroup cols="2" class="- topic/tgroup "><thead class="- topic/thead "><row class="- topic/row "><entry class="- topic/entry ">Usage</entry><entry class="- topic/entry ">Description</entry></row></thead><tbody class="- topic/tbody "><row class="- topic/row "><entry class="- topic/entry "><codeph class="+ topic/ph pr-d/codeph ">my_textField.getTextFormat()</codeph></entry><entry class="- topic/entry ">Returns a TextFormat object containing formatting information for all text in a text field.
Only properties that are common to all text in the text field are set in the resulting TextFormat
object. Any property that is <i class="+ topic/ph hi-d/i ">mixed</i>, meaning that it has different values at different
points in the text, has a value of <codeph class="+ topic/ph pr-d/codeph ">null</codeph>.</entry></row><row class="- topic/row "><entry class="- topic/entry "><codeph class="+ topic/ph pr-d/codeph ">my_textField.getTextFormat(beginIndex:Number)</codeph></entry><entry class="- topic/entry ">Returns a TextFormat object containing a copy of the text format of the character at the
<codeph class="+ topic/ph pr-d/codeph ">beginIndex</codeph> position.</entry></row><row class="- topic/row "><entry class="- topic/entry "><codeph class="+ topic/ph pr-d/codeph ">my_textField.getTextFormat(beginIndex:Number,endIndex:Number)</codeph></entry><entry class="- topic/entry ">Returns a TextFormat object containing formatting information for the span of
text from <codeph class="+ topic/ph pr-d/codeph ">beginIndex</codeph> to <codeph class="+ topic/ph pr-d/codeph ">endIndex-1</codeph>. Only properties that are common
to all of the text in the specified range are set in the resulting TextFormat object. Any property
that is mixed (that is, has different values at different points in the range) has its value set to <codeph class="+ topic/ph pr-d/codeph ">null</codeph>.</entry></row></tbody></tgroup></adobetable>
</apiDesc><example class="- topic/example ">Please see the <xref href="TextField.html#getFirstCharInParagraph()" class="- topic/xref ">getFirstCharInParagraph()</xref> or
<xref href="TextField.html#setTextFormat()" class="- topic/xref ">setTextFormat()</xref> method example for illustrations of how
to use the <codeph class="+ topic/ph pr-d/codeph ">getTextFormat()</codeph> method.
</example></apiOperationDetail><related-links class="- topic/related-links "><link href="flash.text.xml#TextFormat" class="- topic/link "><linktext class="- topic/linktext ">flash.text.TextFormat</linktext></link><link href="flash.text.xml#TextField/defaultTextFormat" class="- topic/link "><linktext class="- topic/linktext ">flash.text.TextField.defaultTextFormat</linktext></link><link href="flash.text.xml#TextField/setTextFormat()" class="- topic/link "><linktext class="- topic/linktext ">flash.text.TextField.setTextFormat()</linktext></link></related-links></apiOperation><apiOperation id="flash.text:TextField:isFontCompatible" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiOperation/apiOperation "><apiName class="- topic/title reference/title apiRef/apiName ">isFontCompatible</apiName><shortdesc class="- topic/shortdesc ">
Returns true if an embedded font is available with the specified fontName and fontStyle
where Font.fontType is flash.text.FontType.EMBEDDED.</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="Flash" version="10" class="+ topic/ph adobe-api-d/apiPlatform "/><apiPlatform description="" name="AIR" version="1.5" class="+ topic/ph adobe-api-d/apiPlatform "/><apiPlatform description="" name="Lite" version="4" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata></prolog><apiOperationDetail class="- topic/body reference/refbody apiRef/apiDetail apiOperation/apiOperationDetail "><apiOperationDef class="- topic/section reference/section apiRef/apiDef apiOperation/apiOperationDef "><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiStatic class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiStatic "/><apiException class="+ topic/ph reference/ph apiRef/apiDefItem apiOperation/apiEvent adobe-api-d/apiException "><apiDesc class="- topic/section reference/section apiRef/apiDesc ">The <codeph class="+ topic/ph pr-d/codeph ">fontStyle</codeph> specified is not a member of <codeph class="+ topic/ph pr-d/codeph ">flash.text.FontStyle</codeph>.
</apiDesc><apiItemName class="- topic/keyword reference/keyword apiRef/apiItemName ">ArgumentError</apiItemName><apiOperationClassifier class="- topic/xref reference/xref apiRef/apiRelation apiOperation/apiOperationClassifier ">ArgumentError</apiOperationClassifier></apiException><apiReturn class="- topic/ph reference/ph apiRef/apiDefItem apiOperation/apiReturn "><apiDesc class="- topic/section reference/section apiRef/apiDesc "><codeph class="+ topic/ph pr-d/codeph ">true</codeph> if a compatible embedded font is available, otherwise <codeph class="+ topic/ph pr-d/codeph ">false</codeph>.
</apiDesc><apiOperationClassifier class="- topic/xref reference/xref apiRef/apiRelation apiOperation/apiOperationClassifier ">Boolean</apiOperationClassifier></apiReturn><apiParam class="- topic/ph reference/ph apiRef/apiDefItem apiOperation/apiParam "><apiItemName class="- topic/keyword reference/keyword apiRef/apiItemName ">fontName</apiItemName><apiOperationClassifier class="- topic/xref reference/xref apiRef/apiRelation apiOperation/apiOperationClassifier ">String</apiOperationClassifier><apiDesc class="- topic/section reference/section apiRef/apiDesc ">The name of the embedded font to check.
</apiDesc></apiParam><apiParam class="- topic/ph reference/ph apiRef/apiDefItem apiOperation/apiParam "><apiItemName class="- topic/keyword reference/keyword apiRef/apiItemName ">fontStyle</apiItemName><apiOperationClassifier class="- topic/xref reference/xref apiRef/apiRelation apiOperation/apiOperationClassifier ">String</apiOperationClassifier><apiDesc class="- topic/section reference/section apiRef/apiDesc ">Specifies the font style to check. Use <codeph class="+ topic/ph pr-d/codeph ">flash.text.FontStyle</codeph>
</apiDesc></apiParam></apiOperationDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
Returns true if an embedded font is available with the specified <codeph class="+ topic/ph pr-d/codeph ">fontName</codeph> and <codeph class="+ topic/ph pr-d/codeph ">fontStyle</codeph>
where <codeph class="+ topic/ph pr-d/codeph ">Font.fontType</codeph> is <codeph class="+ topic/ph pr-d/codeph ">flash.text.FontType.EMBEDDED</codeph>. Starting with Flash Player 10,
two kinds of embedded fonts can appear in a SWF file. Normal embedded fonts are only used with
TextField objects.
CFF embedded fonts are only used with the flash.text.engine classes. The two types are distinguished by the
<codeph class="+ topic/ph pr-d/codeph ">fontType</codeph> property of the <codeph class="+ topic/ph pr-d/codeph ">Font</codeph> class, as returned by the <codeph class="+ topic/ph pr-d/codeph ">enumerateFonts()</codeph> function.
<p class="- topic/p ">TextField cannot use a font of type <codeph class="+ topic/ph pr-d/codeph ">EMBEDDED_CFF</codeph>. If <codeph class="+ topic/ph pr-d/codeph ">embedFonts</codeph> is set to <codeph class="+ topic/ph pr-d/codeph ">true</codeph>
and the only font available at run time with the specified name and style is of type <codeph class="+ topic/ph pr-d/codeph ">EMBEDDED_CFF</codeph>,
Flash Player fails to render the text, as if no embedded font were available with the specified name and style.</p>
<p class="- topic/p ">If both <codeph class="+ topic/ph pr-d/codeph ">EMBEDDED</codeph> and <codeph class="+ topic/ph pr-d/codeph ">EMBEDDED_CFF</codeph> fonts are available with the same name and style, the <codeph class="+ topic/ph pr-d/codeph ">EMBEDDED</codeph>
font is selected and text renders with the <codeph class="+ topic/ph pr-d/codeph ">EMBEDDED</codeph> font.</p>
</apiDesc></apiOperationDetail><related-links class="- topic/related-links "><link href="flash.text.engine.xml#FontDescription/fontLookup" class="- topic/link "><linktext class="- topic/linktext ">flash.text.engine.FontDescription.fontLookup</linktext></link><link href="flash.text.engine.xml#TextBlock/createTextLine()" class="- topic/link "><linktext class="- topic/linktext ">flash.text.engine.TextBlock.createTextLine()</linktext></link><link href="flash.text.xml#FontType/EMBEDDED_CFF" class="- topic/link "><linktext class="- topic/linktext ">flash.text.FontType.EMBEDDED_CFF</linktext></link></related-links></apiOperation><apiOperation id="flash.text:TextField:replaceSelectedText" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiOperation/apiOperation "><apiName class="- topic/title reference/title apiRef/apiName ">replaceSelectedText</apiName><shortdesc class="- topic/shortdesc ">
Replaces the current selection with the contents of the value parameter.</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="Flash" version="9" class="+ topic/ph adobe-api-d/apiPlatform "/><apiPlatform description="" name="Lite" version="4" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata><asCustoms class="+ topic/metadata adobe-api-d/asCustoms "><keyword class="- topic/keyword ">TextField, TextField.replaceSelectedText, replaceSelectedText
</keyword></asCustoms></prolog><apiOperationDetail class="- topic/body reference/refbody apiRef/apiDetail apiOperation/apiOperationDetail "><apiOperationDef class="- topic/section reference/section apiRef/apiDef apiOperation/apiOperationDef "><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiException class="+ topic/ph reference/ph apiRef/apiDefItem apiOperation/apiEvent adobe-api-d/apiException "><apiDesc class="- topic/section reference/section apiRef/apiDesc ">This method cannot be used on a text field with a style sheet.
</apiDesc><apiItemName class="- topic/keyword reference/keyword apiRef/apiItemName ">Error</apiItemName><apiOperationClassifier class="- topic/xref reference/xref apiRef/apiRelation apiOperation/apiOperationClassifier ">Error</apiOperationClassifier></apiException><apiReturn class="- topic/ph reference/ph apiRef/apiDefItem apiOperation/apiReturn "><apiType value="void" name="type" class="- topic/state reference/state apiRef/apiType "/></apiReturn><apiParam class="- topic/ph reference/ph apiRef/apiDefItem apiOperation/apiParam "><apiItemName class="- topic/keyword reference/keyword apiRef/apiItemName ">value</apiItemName><apiOperationClassifier class="- topic/xref reference/xref apiRef/apiRelation apiOperation/apiOperationClassifier ">String</apiOperationClassifier><apiDesc class="- topic/section reference/section apiRef/apiDesc ">The string to replace the currently selected text.
</apiDesc></apiParam><apiTipTexts><apiTipText class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiTipText ">Replaces the current selection with the contents of the value parameter.
</apiTipText></apiTipTexts></apiOperationDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
Replaces the current selection with the contents of the <codeph class="+ topic/ph pr-d/codeph ">value</codeph> parameter.
The text is inserted at the position of the current selection, using the current default character
format and default paragraph format. The text is not treated as HTML.
<p class="- topic/p ">You can use the <codeph class="+ topic/ph pr-d/codeph ">replaceSelectedText()</codeph> method to insert and delete text without disrupting
the character and paragraph formatting of the rest of the text.</p>
<p class="- topic/p "><b class="+ topic/ph hi-d/b ">Note:</b> This method does not work if a style sheet is applied to the text field.</p>
</apiDesc><example conref="examples\TextField_replaceSelectedTextExample.as" class="- topic/example "> In the following example, the user erases some text from the first text field
by selecting it and replaces a selected text in the second text field with "NEW TEXT" string.
<p class="- topic/p ">Two different TextField objects are created and event listeners are added for the
<codeph class="+ topic/ph pr-d/codeph ">MouseEvent.MOUSE_UP</codeph> events. Mouse up occurs when the user releases the mouse,
an event that normally happens after a selection of text is made. Note that the default
setting for a text field is for its text to be selected.</p>
<p class="- topic/p ">In the <codeph class="+ topic/ph pr-d/codeph ">mouseHandler1()</codeph> method, when a user release a mouse in the
<codeph class="+ topic/ph pr-d/codeph ">myTextField1</codeph> text field, the text is erased by replacing it with an empty
string. This can continue until all the text is erased. In the <codeph class="+ topic/ph pr-d/codeph ">mouseHandler2()</codeph>
method, when a user selects some text in <codeph class="+ topic/ph pr-d/codeph ">myTextField2</codeph> text field, properties
<codeph class="+ topic/ph pr-d/codeph ">selectionBeginIndex</codeph> and <codeph class="+ topic/ph pr-d/codeph ">selectionEndIndex</codeph> are checked to see if
any character was selected. (The <codeph class="+ topic/ph pr-d/codeph ">selectionBeginIndex</codeph> and <codeph class="+ topic/ph pr-d/codeph ">selectionEndIndex</codeph>
properties don't have the same value if some text were selected.) The selected text is then replaced
with "NEW TEXT" string. This can continue until all the original text of the second text field is
replaced with the "NEW TEXT" string.</p>
<codeblock xml:space="preserve" class="+ topic/pre pr-d/codeblock ">
package {
import flash.display.Sprite;
import flash.text.TextField;
import flash.events.MouseEvent;
public class TextField_replaceSelectedTextExample extends Sprite {
private var myTextField1:TextField = new TextField();
private var myTextField2:TextField = new TextField();
public function TextField_replaceSelectedTextExample() {
myTextField1.x = 10;
myTextField1.width = 300;
myTextField1.height = 50;
myTextField1.background = true;
myTextField1.border = true;
myTextField1.text = "Select the text you want to remove from the line.";
myTextField2.x = 10;
myTextField2.y = 60;
myTextField2.width = 300;
myTextField2.height = 50;
myTextField2.background = true;
myTextField2.border = true;
myTextField2.text = "Select the text you want to replace with NEW TEXT.";
myTextField1.addEventListener(MouseEvent.MOUSE_UP, mouseHandler1);
myTextField2.addEventListener(MouseEvent.MOUSE_UP, mouseHandler2);
this.addChild(myTextField1);
this.addChild(myTextField2);
}
private function mouseHandler1(e:MouseEvent):void {
myTextField1.replaceSelectedText("");
}
private function mouseHandler2(e:MouseEvent):void {
if(myTextField2.selectionBeginIndex != myTextField2.selectionEndIndex) {
myTextField2.replaceSelectedText("NEW TEXT");
}
}
}
}
</codeblock></example></apiOperationDetail><related-links class="- topic/related-links "><link href="flash.display.xml#Stage/focus" class="- topic/link "><linktext class="- topic/linktext ">flash.display.Stage.focus</linktext></link></related-links></apiOperation><apiOperation id="flash.text:TextField:replaceText" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiOperation/apiOperation "><apiName class="- topic/title reference/title apiRef/apiName ">replaceText</apiName><shortdesc class="- topic/shortdesc ">
Replaces the range of characters that the beginIndex and
endIndex parameters specify with the contents
of the newText parameter.</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="Flash" version="9" class="+ topic/ph adobe-api-d/apiPlatform "/><apiPlatform description="" name="Lite" version="4" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata><asCustoms class="+ topic/metadata adobe-api-d/asCustoms "><keyword class="- topic/keyword ">
</keyword></asCustoms></prolog><apiOperationDetail class="- topic/body reference/refbody apiRef/apiDetail apiOperation/apiOperationDetail "><apiOperationDef class="- topic/section reference/section apiRef/apiDef apiOperation/apiOperationDef "><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiException class="+ topic/ph reference/ph apiRef/apiDefItem apiOperation/apiEvent adobe-api-d/apiException "><apiDesc class="- topic/section reference/section apiRef/apiDesc ">This method cannot be used on a text field with a style sheet.
</apiDesc><apiItemName class="- topic/keyword reference/keyword apiRef/apiItemName ">Error</apiItemName><apiOperationClassifier class="- topic/xref reference/xref apiRef/apiRelation apiOperation/apiOperationClassifier ">Error</apiOperationClassifier></apiException><apiReturn class="- topic/ph reference/ph apiRef/apiDefItem apiOperation/apiReturn "><apiType value="void" name="type" class="- topic/state reference/state apiRef/apiType "/></apiReturn><apiParam class="- topic/ph reference/ph apiRef/apiDefItem apiOperation/apiParam "><apiItemName class="- topic/keyword reference/keyword apiRef/apiItemName ">beginIndex</apiItemName><apiOperationClassifier class="- topic/xref reference/xref apiRef/apiRelation apiOperation/apiOperationClassifier ">int</apiOperationClassifier><apiDesc class="- topic/section reference/section apiRef/apiDesc ">The zero-based index value for the start position of the replacement range.
</apiDesc></apiParam><apiParam class="- topic/ph reference/ph apiRef/apiDefItem apiOperation/apiParam "><apiItemName class="- topic/keyword reference/keyword apiRef/apiItemName ">endIndex</apiItemName><apiOperationClassifier class="- topic/xref reference/xref apiRef/apiRelation apiOperation/apiOperationClassifier ">int</apiOperationClassifier><apiDesc class="- topic/section reference/section apiRef/apiDesc ">The zero-based index position of the first character after the desired
text span.
</apiDesc></apiParam><apiParam class="- topic/ph reference/ph apiRef/apiDefItem apiOperation/apiParam "><apiItemName class="- topic/keyword reference/keyword apiRef/apiItemName ">newText</apiItemName><apiOperationClassifier class="- topic/xref reference/xref apiRef/apiRelation apiOperation/apiOperationClassifier ">String</apiOperationClassifier><apiDesc class="- topic/section reference/section apiRef/apiDesc ">The text to use to replace the specified range of characters.
</apiDesc></apiParam><apiTipTexts><apiTipText class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiTipText ">Replaces a range of characters.
</apiTipText></apiTipTexts></apiOperationDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
Replaces the range of characters that the <codeph class="+ topic/ph pr-d/codeph ">beginIndex</codeph> and
<codeph class="+ topic/ph pr-d/codeph ">endIndex</codeph> parameters specify with the contents
of the <codeph class="+ topic/ph pr-d/codeph ">newText</codeph> parameter. As designed, the text from
<codeph class="+ topic/ph pr-d/codeph ">beginIndex</codeph> to <codeph class="+ topic/ph pr-d/codeph ">endIndex-1</codeph> is replaced.
<p class="- topic/p "><b class="+ topic/ph hi-d/b ">Note:</b> This method does not work if a style sheet is applied to the text field.</p>
</apiDesc><example conref="examples\TextField_replaceTextExample.as" class="- topic/example "> The following example uses the <codeph class="+ topic/ph pr-d/codeph ">replaceText()</codeph> method to delete, replace and insert
some text into a text field.
<p class="- topic/p ">The <codeph class="+ topic/ph pr-d/codeph ">outputText</codeph> text field is set to automatically fit the text and to resize as a left-justified text.
With the first <codeph class="+ topic/ph pr-d/codeph ">replaceText()</codeph> method call, the first line ("This is the wrong heading")
is replaced with "THIS IS THE HEADING FOR EVERYONE." With the second method call, the text "CORRECT"
is inserted between "THE" and "HEADING." With the third method call, the words "FOR EVERYONE" are deleted.
Note that with each call to the method <codeph class="+ topic/ph pr-d/codeph ">appendText()</codeph>, the current text's begin and end index
are changed. Here, only the final text (after the changes have been made) will display.</p>
<codeblock xml:space="preserve" class="+ topic/pre pr-d/codeblock ">
package {
import flash.display.Sprite;
import flash.text.TextField;
import flash.text.TextFieldAutoSize;
public class TextField_replaceTextExample extends Sprite {
public function TextField_replaceTextExample() {
var outputText:TextField = new TextField();
outputText.x = 10;
outputText.y = 10;
outputText.background = true;
outputText.autoSize = TextFieldAutoSize.LEFT;
outputText.appendText("This is the wrong heading");
outputText.appendText("\n\n");
outputText.appendText("This is the body of the text.");
outputText.replaceText(0, 25, "THIS IS THE HEADING FOR EVERYONE");
outputText.replaceText(12, 12, "CORRECT ");
outputText.replaceText(27, 40, "");
this.addChild(outputText);
}
}
}
</codeblock></example></apiOperationDetail></apiOperation><apiOperation id="flash.text:TextField:setSelection" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiOperation/apiOperation "><apiName class="- topic/title reference/title apiRef/apiName ">setSelection</apiName><shortdesc class="- topic/shortdesc ">
Sets as selected the text designated by the index values of the
first and last characters, which are specified with the beginIndex
and endIndex parameters.</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="Flash" version="9" class="+ topic/ph adobe-api-d/apiPlatform "/><apiPlatform description="" name="Lite" version="4" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata><asCustoms class="+ topic/metadata adobe-api-d/asCustoms "><internal>Need to add an example.
</internal></asCustoms></prolog><apiOperationDetail class="- topic/body reference/refbody apiRef/apiDetail apiOperation/apiOperationDetail "><apiOperationDef class="- topic/section reference/section apiRef/apiDef apiOperation/apiOperationDef "><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiReturn class="- topic/ph reference/ph apiRef/apiDefItem apiOperation/apiReturn "><apiType value="void" name="type" class="- topic/state reference/state apiRef/apiType "/></apiReturn><apiParam class="- topic/ph reference/ph apiRef/apiDefItem apiOperation/apiParam "><apiItemName class="- topic/keyword reference/keyword apiRef/apiItemName ">beginIndex</apiItemName><apiOperationClassifier class="- topic/xref reference/xref apiRef/apiRelation apiOperation/apiOperationClassifier ">int</apiOperationClassifier><apiDesc class="- topic/section reference/section apiRef/apiDesc ">The zero-based index value of the first character in the selection
(for example, the first character is 0, the second character is 1, and so on).
</apiDesc></apiParam><apiParam class="- topic/ph reference/ph apiRef/apiDefItem apiOperation/apiParam "><apiItemName class="- topic/keyword reference/keyword apiRef/apiItemName ">endIndex</apiItemName><apiOperationClassifier class="- topic/xref reference/xref apiRef/apiRelation apiOperation/apiOperationClassifier ">int</apiOperationClassifier><apiDesc class="- topic/section reference/section apiRef/apiDesc ">The zero-based index value of the last character in the selection.
</apiDesc></apiParam><apiTipTexts><apiTipText class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiTipText ">Sets a new text selection.
</apiTipText></apiTipTexts></apiOperationDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
Sets as selected the text designated by the index values of the
first and last characters, which are specified with the <codeph class="+ topic/ph pr-d/codeph ">beginIndex</codeph>
and <codeph class="+ topic/ph pr-d/codeph ">endIndex</codeph> parameters. If the two parameter values are the same,
this method sets the insertion point, as if you set the
<codeph class="+ topic/ph pr-d/codeph ">caretIndex</codeph> property.
</apiDesc><example conref="examples\TextField_setSelectionExample.as" class="- topic/example "> In the following example, when the user clicks anywhere in the text field a predefined range
of text will be selected (highlighting the words "TEXT IN ALL CAPS").
<p class="- topic/p ">Two event listeners for the <codeph class="+ topic/ph pr-d/codeph ">myTextField</codeph> text field respond to the user's mouse clicks or mouse up events.
Mouse up will occur when the user releases the mouse, an event that normally happens after a selection of text is made.
Note that the default setting for a text field is for its text to be selected. When some text is clicked,
<codeph class="+ topic/ph pr-d/codeph ">clickHandler()</codeph> method is invoked. When some text is selected and the mouse is released,
<codeph class="+ topic/ph pr-d/codeph ">mouseUpHandler()</codeph> method is invoked.</p>
<p class="- topic/p ">In both <codeph class="+ topic/ph pr-d/codeph ">clickHandler()</codeph> and <codeph class="+ topic/ph pr-d/codeph ">mouseUpHandler()</codeph> methods, the <codeph class="+ topic/ph pr-d/codeph ">setSelection()</codeph> method
sets only the characters between indexes 54 and 70 (TEXT IN ALL CAPS) to be selected.</p>
<codeblock xml:space="preserve" class="+ topic/pre pr-d/codeblock ">
package {
import flash.display.Sprite;
import flash.events.MouseEvent;
import flash.text.TextField;
import flash.text.TextFieldAutoSize;
public class TextField_setSelectionExample extends Sprite
{
private var myTextField:TextField = new TextField();
public function TextField_setSelectionExample() {
myTextField.autoSize = TextFieldAutoSize.LEFT;
myTextField.text = "No matter where you click on this text field only the TEXT IN ALL CAPS is selected.";
myTextField.addEventListener(MouseEvent.CLICK, clickHandler);
myTextField.addEventListener(MouseEvent.MOUSE_UP, mouseUpHandler);
this.addChild(myTextField);
}
private function clickHandler(event:MouseEvent):void {
myTextField.setSelection(54, 70);
}
private function mouseUpHandler(event:MouseEvent):void {
myTextField.setSelection(54, 70);
}
}
}
</codeblock></example></apiOperationDetail><related-links class="- topic/related-links "><link href="flash.text.xml#TextField/selectable" class="- topic/link "><linktext class="- topic/linktext ">selectable</linktext></link><link href="flash.text.xml#TextField/selectionBeginIndex" class="- topic/link "><linktext class="- topic/linktext ">selectionBeginIndex</linktext></link><link href="flash.text.xml#TextField/selectionEndIndex" class="- topic/link "><linktext class="- topic/linktext ">selectionEndIndex</linktext></link><link href="flash.text.xml#TextField/caretIndex" class="- topic/link "><linktext class="- topic/linktext ">caretIndex</linktext></link></related-links></apiOperation><apiOperation id="flash.text:TextField:setTextFormat" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiOperation/apiOperation "><apiName class="- topic/title reference/title apiRef/apiName ">setTextFormat</apiName><shortdesc class="- topic/shortdesc ">
Applies the text formatting that the format parameter specifies to the specified text in a text field.</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="Flash" version="9" class="+ topic/ph adobe-api-d/apiPlatform "/><apiPlatform description="" name="Lite" version="4" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata><asCustoms class="+ topic/metadata adobe-api-d/asCustoms "><keyword class="- topic/keyword ">TextField, TextField.setTextFormat, setTextFormat
</keyword></asCustoms></prolog><apiOperationDetail class="- topic/body reference/refbody apiRef/apiDetail apiOperation/apiOperationDetail "><apiOperationDef class="- topic/section reference/section apiRef/apiDef apiOperation/apiOperationDef "><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiException class="+ topic/ph reference/ph apiRef/apiDefItem apiOperation/apiEvent adobe-api-d/apiException "><apiDesc class="- topic/section reference/section apiRef/apiDesc ">This method cannot be used on a text field with a style sheet.
</apiDesc><apiItemName class="- topic/keyword reference/keyword apiRef/apiItemName ">Error</apiItemName><apiOperationClassifier class="- topic/xref reference/xref apiRef/apiRelation apiOperation/apiOperationClassifier ">Error</apiOperationClassifier></apiException><apiException class="+ topic/ph reference/ph apiRef/apiDefItem apiOperation/apiEvent adobe-api-d/apiException "><apiDesc class="- topic/section reference/section apiRef/apiDesc ">The <codeph class="+ topic/ph pr-d/codeph ">beginIndex</codeph> or <codeph class="+ topic/ph pr-d/codeph ">endIndex</codeph> specified is out of range.
</apiDesc><apiItemName class="- topic/keyword reference/keyword apiRef/apiItemName ">RangeError</apiItemName><apiOperationClassifier class="- topic/xref reference/xref apiRef/apiRelation apiOperation/apiOperationClassifier ">RangeError</apiOperationClassifier></apiException><apiReturn class="- topic/ph reference/ph apiRef/apiDefItem apiOperation/apiReturn "><apiType value="void" name="type" class="- topic/state reference/state apiRef/apiType "/></apiReturn><apiParam class="- topic/ph reference/ph apiRef/apiDefItem apiOperation/apiParam "><apiItemName class="- topic/keyword reference/keyword apiRef/apiItemName ">format</apiItemName><apiOperationClassifier class="- topic/xref reference/xref apiRef/apiRelation apiOperation/apiOperationClassifier ">flash.text:TextFormat</apiOperationClassifier><apiDesc class="- topic/section reference/section apiRef/apiDesc ">A TextFormat object that contains character and paragraph formatting information.
</apiDesc></apiParam><apiParam class="- topic/ph reference/ph apiRef/apiDefItem apiOperation/apiParam "><apiItemName class="- topic/keyword reference/keyword apiRef/apiItemName ">beginIndex</apiItemName><apiOperationClassifier class="- topic/xref reference/xref apiRef/apiRelation apiOperation/apiOperationClassifier ">int</apiOperationClassifier><apiData class="- topic/ph reference/ph apiRef/apiData ">-1</apiData><apiDesc class="- topic/section reference/section apiRef/apiDesc ">Optional; an integer that specifies the zero-based index position specifying the
first character of the desired range of text.
</apiDesc></apiParam><apiParam class="- topic/ph reference/ph apiRef/apiDefItem apiOperation/apiParam "><apiItemName class="- topic/keyword reference/keyword apiRef/apiItemName ">endIndex</apiItemName><apiOperationClassifier class="- topic/xref reference/xref apiRef/apiRelation apiOperation/apiOperationClassifier ">int</apiOperationClassifier><apiData class="- topic/ph reference/ph apiRef/apiData ">-1</apiData><apiDesc class="- topic/section reference/section apiRef/apiDesc ">Optional; an integer that specifies the first character after the desired text span.
As designed, if you specify <codeph class="+ topic/ph pr-d/codeph ">beginIndex</codeph> and <codeph class="+ topic/ph pr-d/codeph ">endIndex</codeph> values,
the text from <codeph class="+ topic/ph pr-d/codeph ">beginIndex</codeph> to <codeph class="+ topic/ph pr-d/codeph ">endIndex-1</codeph> is updated.
<p class="- topic/p ">
<adobetable class="innertable"><tgroup cols="2" class="- topic/tgroup "><thead class="- topic/thead "><row class="- topic/row "><entry class="- topic/entry ">Usage</entry><entry class="- topic/entry ">Description</entry></row></thead><tbody class="- topic/tbody "><row class="- topic/row "><entry class="- topic/entry "><codeph class="+ topic/ph pr-d/codeph ">my_textField.setTextFormat(textFormat:TextFormat)</codeph></entry><entry class="- topic/entry ">Applies the properties of <codeph class="+ topic/ph pr-d/codeph ">textFormat</codeph> to all text in the text
field.</entry></row><row class="- topic/row "><entry class="- topic/entry "><codeph class="+ topic/ph pr-d/codeph ">my_textField.setTextFormat(textFormat:TextFormat, beginIndex:int)</codeph></entry><entry class="- topic/entry ">Applies the properties of <codeph class="+ topic/ph pr-d/codeph ">textFormat</codeph> to the text starting with the
<codeph class="+ topic/ph pr-d/codeph ">beginIndex</codeph> position.</entry></row><row class="- topic/row "><entry class="- topic/entry "><codeph class="+ topic/ph pr-d/codeph ">my_textField.setTextFormat(textFormat:TextFormat, beginIndex:int,
endIndex:int)</codeph></entry><entry class="- topic/entry ">Applies the properties of the <codeph class="+ topic/ph pr-d/codeph ">textFormat</codeph> parameter to the span of
text from the <codeph class="+ topic/ph pr-d/codeph ">beginIndex</codeph> position to the <codeph class="+ topic/ph pr-d/codeph ">endIndex-1</codeph> position.</entry></row></tbody></tgroup></adobetable>
</p>
<p class="- topic/p ">Notice that any text inserted manually by the user, or replaced by the
<codeph class="+ topic/ph pr-d/codeph ">replaceSelectedText()</codeph> method, receives the default text field formatting for new
text, and not the formatting specified for the text insertion point. To set a text field's
default formatting for new text, use the <codeph class="+ topic/ph pr-d/codeph ">defaultTextFormat</codeph> property.</p>
</apiDesc></apiParam><apiTipTexts><apiTipText class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiTipText ">Applies text formatting.
</apiTipText></apiTipTexts></apiOperationDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
Applies the text formatting that the <codeph class="+ topic/ph pr-d/codeph ">format</codeph> parameter specifies to the specified text in a text field.
The value of <codeph class="+ topic/ph pr-d/codeph ">format</codeph> must be a TextFormat object that specifies the
desired text formatting changes. Only the non-null properties of <codeph class="+ topic/ph pr-d/codeph ">format</codeph> are applied
to the text field. Any property of <codeph class="+ topic/ph pr-d/codeph ">format</codeph> that is set to <codeph class="+ topic/ph pr-d/codeph ">null</codeph> is not
applied. By default, all of the properties of a newly created TextFormat object are set to <codeph class="+ topic/ph pr-d/codeph ">null</codeph>.
<p class="- topic/p "><b class="+ topic/ph hi-d/b ">Note:</b> This method does not work if a style sheet is applied to the text field.</p>
<p class="- topic/p ">The <codeph class="+ topic/ph pr-d/codeph ">setTextFormat()</codeph> method changes the text formatting applied to a range of
characters or to the entire body of text in a text field. To apply the properties of format to all text in the text
field, do not specify values for <codeph class="+ topic/ph pr-d/codeph ">beginIndex</codeph> and <codeph class="+ topic/ph pr-d/codeph ">endIndex</codeph>. To apply the
properties of the format to a range of text, specify values for the <codeph class="+ topic/ph pr-d/codeph ">beginIndex</codeph> and
the <codeph class="+ topic/ph pr-d/codeph ">endIndex</codeph> parameters. You can use the <codeph class="+ topic/ph pr-d/codeph ">length</codeph> property to determine
the index values.</p>
<p class="- topic/p ">The two types of formatting information in a TextFormat object are
character level formatting and paragraph level formatting.
Each character in a text field can have its own character formatting
settings, such as font name, font size, bold, and italic.</p>
<p class="- topic/p ">For paragraphs, the first character of the paragraph is examined for the paragraph formatting
settings for the entire paragraph. Examples of paragraph formatting settings are left margin,
right margin, and indentation.</p>
<p class="- topic/p ">Any text inserted manually by the user, or replaced by the
<codeph class="+ topic/ph pr-d/codeph ">replaceSelectedText()</codeph> method, receives the default text field formatting for new text,
and not the formatting specified for the text insertion point. To set the default
formatting for new text, use <codeph class="+ topic/ph pr-d/codeph ">defaultTextFormat</codeph>.</p>
</apiDesc><example conref="examples\TextField_setTextFormatExample.as" class="- topic/example "> In the following example, when the text is clicked, a defined range of text, "TEXT IN ALL CAPS," switches
format between the default text format and the new format.
<p class="- topic/p ">An event listener for the <codeph class="+ topic/ph pr-d/codeph ">myTextField</codeph> text field is added to respond to the mouse clicks by invoking
the <codeph class="+ topic/ph pr-d/codeph ">clickHandler()</codeph> method. In the <codeph class="+ topic/ph pr-d/codeph ">clickHandler()</codeph> method, the <codeph class="+ topic/ph pr-d/codeph ">getTextFormat()</codeph>
method returns the current format of a character (index 55) from the intended range of the text, which is then placed
in the <codeph class="+ topic/ph pr-d/codeph ">currentTextFormat</codeph> TextFormat object. The <codeph class="+ topic/ph pr-d/codeph ">if</codeph> statement checks the <codeph class="+ topic/ph pr-d/codeph ">currentTextFormat</codeph>
text format to see if the character in the range is using the new format (font point is set to 18). If not, the new format changes
the size to 18 point, color to red, and applies underline and italics to the range of text between 54-70 (TEXT IN ALL CAPS).
If the character in the range is using the new format, the format of the range is set back to the default (original)
format of the text field.</p>
<codeblock xml:space="preserve" class="+ topic/pre pr-d/codeblock ">
package {
import flash.display.Sprite;
import flash.text.TextField;
import flash.text.TextFormat;
import flash.text.TextFieldAutoSize;
import flash.events.MouseEvent;
public class TextField_setTextFormatExample extends Sprite {
private var myTextField:TextField = new TextField();
private var newFormat:TextFormat = new TextFormat();
public function TextField_setTextFormatExample() {
myTextField.autoSize = TextFieldAutoSize.LEFT;
myTextField.selectable = false;
myTextField.background = true;
myTextField.text = "No matter where you click on this text field only the TEXT IN ALL CAPS changes format.";
myTextField.addEventListener(MouseEvent.CLICK, clickHandler);
newFormat.color = 0xFF0000;
newFormat.size = 18;
newFormat.underline = true;
newFormat.italic = true;
this.addChild(myTextField);
}
private function clickHandler(event:MouseEvent):void {
var currentTextFormat:TextFormat = myTextField.getTextFormat(55);
if(currentTextFormat.size != 18) {
myTextField.setTextFormat(newFormat, 54, 70);
}
else {
myTextField.setTextFormat(myTextField.defaultTextFormat);
}
}
}
}
</codeblock></example></apiOperationDetail><related-links class="- topic/related-links "><link href="flash.text.xml#TextFormat" class="- topic/link "><linktext class="- topic/linktext ">flash.text.TextFormat</linktext></link><link href="flash.text.xml#TextField/defaultTextFormat" class="- topic/link "><linktext class="- topic/linktext ">flash.text.TextField.defaultTextFormat</linktext></link></related-links></apiOperation><apiValue id="flash.text:TextField:alwaysShowSelection:get" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiValue/apiValue "><apiName class="- topic/title reference/title apiRef/apiName ">alwaysShowSelection</apiName><shortdesc class="- topic/shortdesc ">
When set to true and the text field is not in focus, Flash Player highlights the
selection in the text field in gray.</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="Flash" version="9" class="+ topic/ph adobe-api-d/apiPlatform "/><apiPlatform description="" name="Lite" version="4" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata><asCustoms class="+ topic/metadata adobe-api-d/asCustoms "><keyword class="- topic/keyword ">TextField, TextField object, built-in class
</keyword></asCustoms></prolog><apiValueDetail class="- topic/body reference/refbody apiRef/apiDetail apiValue/apiValueDetail "><apiValueDef class="- topic/section reference/section apiRef/apiDef apiValue/apiValueDef "><apiProperty class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiProperty "/><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiDynamic class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiDynamic "/><apiValueAccess value="readwrite" class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiValueAccess "/><apiValueClassifier class="- topic/xref reference/xref apiRef/apiRelation apiValue/apiValueClassifier ">Boolean</apiValueClassifier><apiDefaultValue>false
</apiDefaultValue></apiValueDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
When set to <codeph class="+ topic/ph pr-d/codeph ">true</codeph> and the text field is not in focus, Flash Player highlights the
selection in the text field in gray. When set to <codeph class="+ topic/ph pr-d/codeph ">false</codeph> and the text field is not in
focus, Flash Player does not highlight the selection in the text field.
</apiDesc><example conref="examples\TextField_alwaysShowSelection.as" class="- topic/example "> Compile and run the following file. When you run the file, drag to select text
in each of the two text fields, and notice the difference in selection highlighting when you
select text in the two text fields (changing focus):
<codeblock xml:space="preserve" class="+ topic/pre pr-d/codeblock ">
package {
import flash.display.Sprite;
import flash.text.TextField;
import flash.text.TextFieldType;
public class TextField_alwaysShowSelection extends Sprite {
public function TextField_alwaysShowSelection() {
var label1:TextField = createCustomTextField(0, 20, 200, 20);
label1.text = "This text is selected.";
label1.setSelection(0, 9);
label1.alwaysShowSelection = true;
var label2:TextField = createCustomTextField(0, 50, 200, 20);
label2.text = "Drag to select some of this text.";
}
private function createCustomTextField(x:Number, y:Number, width:Number, height:Number):TextField {
var result:TextField = new TextField();
result.x = x; result.y = y;
result.width = width; result.height = height;
addChild(result);
return result;
}
}
}
</codeblock></example></apiValueDetail><related-links class="- topic/related-links "><link href="flash.display.xml#Stage/focus" class="- topic/link "><linktext class="- topic/linktext ">flash.display.Stage.focus</linktext></link></related-links></apiValue><apiValue id="flash.text:TextField:antiAliasType:get" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiValue/apiValue "><apiName class="- topic/title reference/title apiRef/apiName ">antiAliasType</apiName><shortdesc class="- topic/shortdesc ">
The type of anti-aliasing used for this text field.</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="Flash" version="9" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata><asCustoms class="+ topic/metadata adobe-api-d/asCustoms "><maelexample>This example creates two text fields and applies advanced anti-aliasing to the first one
only. It assumes that you have a font
embedded in the Library with the linkage identifier set to <code>"Times-12"</code>.
To embed the font, follow these steps:
<ol class="- topic/ol "><li class="- topic/li ">Open your Library</li><li class="- topic/li ">Click the Library options menu in the upper right corner of the Library</li><li class="- topic/li ">Select "New Font" from the dropdown list</li><li class="- topic/li ">Name the font "Times-12"</li><li class="- topic/li ">Select "Times New Roman" from the font dropdown list</li><li class="- topic/li ">Press the "OK" button</li><li class="- topic/li ">Right-click on the newly created font and select "Linkage..."</li><li class="- topic/li ">Check the "Export for ActionScript" box</li><li class="- topic/li ">Accept the default identifier "Times-12" by pressing the "OK" button</li></ol>
<listing version="2.0">
var my_format:TextFormat = new TextFormat();
my_format.font = "Times-12";
var my_text1:TextField = this.createTextField("my_text1", this.getNextHighestDepth(), 10, 10, 300, 30);
my_text1.text = "This text uses advanced anti-aliasing.";
my_text1.antiAliasType = "advanced";
my_text1.border = true;
my_text1.embedFonts = true;
my_text1.setTextFormat(my_format);
var my_text2:TextField = this.createTextField("my_text2", this.getNextHighestDepth(), 10, 50, 300, 30);
my_text2.text = "This text uses normal anti-aliasing."
my_text2.antiAliasType = "normal";
my_text2.border = true;
my_text2.embedFonts = true;
my_text2.setTextFormat(my_format);
</listing>
</maelexample></asCustoms></prolog><apiValueDetail class="- topic/body reference/refbody apiRef/apiDetail apiValue/apiValueDetail "><apiValueDef class="- topic/section reference/section apiRef/apiDef apiValue/apiValueDef "><apiProperty class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiProperty "/><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiDynamic class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiDynamic "/><apiValueAccess value="readwrite" class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiValueAccess "/><apiValueClassifier class="- topic/xref reference/xref apiRef/apiRelation apiValue/apiValueClassifier ">String</apiValueClassifier><apiTipTexts><apiTipText class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiTipText ">The type of anti-aliasing used.
</apiTipText></apiTipTexts></apiValueDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
The type of anti-aliasing used for this text field. Use <codeph class="+ topic/ph pr-d/codeph ">flash.text.AntiAliasType</codeph>
constants for this property. You can control this setting only if the font is
embedded (with the <codeph class="+ topic/ph pr-d/codeph ">embedFonts</codeph> property set to <codeph class="+ topic/ph pr-d/codeph ">true</codeph>).
The default setting is <codeph class="+ topic/ph pr-d/codeph ">flash.text.AntiAliasType.NORMAL</codeph>.
<p class="- topic/p ">To set values for this property, use the following string values:</p>
<adobetable class="innertable"><tgroup cols="2" class="- topic/tgroup "><thead class="- topic/thead "><row class="- topic/row "><entry class="- topic/entry ">String value</entry><entry class="- topic/entry ">Description</entry></row></thead><tbody class="- topic/tbody "><row class="- topic/row "><entry class="- topic/entry "><codeph class="+ topic/ph pr-d/codeph ">flash.text.AntiAliasType.NORMAL</codeph></entry><entry class="- topic/entry ">Applies the regular text anti-aliasing. This value matches the type of anti-aliasing that
Flash Player 7 and earlier versions used.</entry></row><row class="- topic/row "><entry class="- topic/entry "><codeph class="+ topic/ph pr-d/codeph ">flash.text.AntiAliasType.ADVANCED</codeph></entry><entry class="- topic/entry ">Applies advanced anti-aliasing, which makes text more legible. (This feature became
available in Flash Player 8.) Advanced anti-aliasing allows for high-quality rendering
of font faces at small sizes. It is best used with applications
with a lot of small text. Advanced anti-aliasing is not recommended for
fonts that are larger than 48 points.</entry></row></tbody></tgroup></adobetable>
</apiDesc></apiValueDetail><related-links class="- topic/related-links "><link href="flash.text.xml#AntiAliasType" class="- topic/link "><linktext class="- topic/linktext ">flash.text.AntiAliasType</linktext></link><link href="flash.text.xml#TextField/embedFonts" class="- topic/link "><linktext class="- topic/linktext ">flash.text.TextField.embedFonts</linktext></link></related-links></apiValue><apiValue id="flash.text:TextField:autoSize:get" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiValue/apiValue "><apiName class="- topic/title reference/title apiRef/apiName ">autoSize</apiName><shortdesc class="- topic/shortdesc ">
Controls automatic sizing and alignment of text fields.</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="Flash" version="9" class="+ topic/ph adobe-api-d/apiPlatform "/><apiPlatform description="" name="Lite" version="4" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata><asCustoms class="+ topic/metadata adobe-api-d/asCustoms "><keyword class="- topic/keyword ">TextField, TextField.autoSize, autoSize
</keyword></asCustoms></prolog><apiValueDetail class="- topic/body reference/refbody apiRef/apiDetail apiValue/apiValueDetail "><apiValueDef class="- topic/section reference/section apiRef/apiDef apiValue/apiValueDef "><apiProperty class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiProperty "/><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiDynamic class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiDynamic "/><apiValueAccess value="readwrite" class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiValueAccess "/><apiValueClassifier class="- topic/xref reference/xref apiRef/apiRelation apiValue/apiValueClassifier ">String</apiValueClassifier><apiException class="+ topic/ph reference/ph apiRef/apiDefItem apiOperation/apiEvent adobe-api-d/apiException "><apiDesc class="- topic/section reference/section apiRef/apiDesc ">The <codeph class="+ topic/ph pr-d/codeph ">autoSize</codeph> specified is not a member of flash.text.TextFieldAutoSize.
</apiDesc><apiItemName class="- topic/keyword reference/keyword apiRef/apiItemName ">ArgumentError</apiItemName><apiOperationClassifier class="- topic/xref reference/xref apiRef/apiRelation apiOperation/apiOperationClassifier ">ArgumentError</apiOperationClassifier></apiException><apiTipTexts><apiTipText class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiTipText ">Controls automatic sizing and alignment of text fields.
</apiTipText></apiTipTexts></apiValueDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
Controls automatic sizing and alignment of text fields.
Acceptable values for the <codeph class="+ topic/ph pr-d/codeph ">TextFieldAutoSize</codeph> constants: <codeph class="+ topic/ph pr-d/codeph ">TextFieldAutoSize.NONE</codeph> (the default),
<codeph class="+ topic/ph pr-d/codeph ">TextFieldAutoSize.LEFT</codeph>, <codeph class="+ topic/ph pr-d/codeph ">TextFieldAutoSize.RIGHT</codeph>, and <codeph class="+ topic/ph pr-d/codeph ">TextFieldAutoSize.CENTER</codeph>.
<p class="- topic/p ">If <codeph class="+ topic/ph pr-d/codeph ">autoSize</codeph> is set to <codeph class="+ topic/ph pr-d/codeph ">TextFieldAutoSize.NONE</codeph> (the default) no resizing occurs.</p>
<p class="- topic/p ">If <codeph class="+ topic/ph pr-d/codeph ">autoSize</codeph> is set to <codeph class="+ topic/ph pr-d/codeph ">TextFieldAutoSize.LEFT</codeph>, the text is
treated as left-justified text, meaning that the left margin of the text field remains fixed and any
resizing of a single line of the text field is on the right margin. If the text includes a line break
(for example, <codeph class="+ topic/ph pr-d/codeph ">"\n"</codeph> or <codeph class="+ topic/ph pr-d/codeph ">"\r"</codeph>), the bottom is also resized to fit the next
line of text. If <codeph class="+ topic/ph pr-d/codeph ">wordWrap</codeph> is also set to <codeph class="+ topic/ph pr-d/codeph ">true</codeph>, only the bottom
of the text field is resized and the right side remains fixed.</p>
<p class="- topic/p ">If <codeph class="+ topic/ph pr-d/codeph ">autoSize</codeph> is set to <codeph class="+ topic/ph pr-d/codeph ">TextFieldAutoSize.RIGHT</codeph>, the text is treated as
right-justified text, meaning that the right margin of the text field remains fixed and any resizing
of a single line of the text field is on the left margin. If the text includes a line break
(for example, <codeph class="+ topic/ph pr-d/codeph ">"\n" or "\r")</codeph>, the bottom is also resized to fit the next
line of text. If <codeph class="+ topic/ph pr-d/codeph ">wordWrap</codeph> is also set to <codeph class="+ topic/ph pr-d/codeph ">true</codeph>, only the bottom
of the text field is resized and the left side remains fixed.</p>
<p class="- topic/p ">If <codeph class="+ topic/ph pr-d/codeph ">autoSize</codeph> is set to <codeph class="+ topic/ph pr-d/codeph ">TextFieldAutoSize.CENTER</codeph>, the text is treated as
center-justified text, meaning that any resizing of a single line of the text field is equally distributed
to both the right and left margins. If the text includes a line break (for example, <codeph class="+ topic/ph pr-d/codeph ">"\n"</codeph> or
<codeph class="+ topic/ph pr-d/codeph ">"\r"</codeph>), the bottom is also resized to fit the next line of text. If <codeph class="+ topic/ph pr-d/codeph ">wordWrap</codeph> is also
set to <codeph class="+ topic/ph pr-d/codeph ">true</codeph>, only the bottom of the text field is resized and the left and
right sides remain fixed.</p>
</apiDesc></apiValueDetail><related-links class="- topic/related-links "><link href="flash.text.xml#TextFieldAutoSize" class="- topic/link "><linktext class="- topic/linktext ">flash.text.TextFieldAutoSize</linktext></link><link href="flash.text.xml#TextField/autoSize" class="- topic/link "><linktext class="- topic/linktext ">flash.text.TextField.autoSize</linktext></link><link href="flash.text.xml#TextField/wordWrap" class="- topic/link "><linktext class="- topic/linktext ">flash.text.TextField.wordWrap</linktext></link></related-links></apiValue><apiValue id="flash.text:TextField:backgroundColor:get" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiValue/apiValue "><apiName class="- topic/title reference/title apiRef/apiName ">backgroundColor</apiName><shortdesc class="- topic/shortdesc ">
The color of the text field background.</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="Flash" version="9" class="+ topic/ph adobe-api-d/apiPlatform "/><apiPlatform description="" name="Lite" version="4" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata><asCustoms class="+ topic/metadata adobe-api-d/asCustoms "><keyword class="- topic/keyword ">TextField, TextField.backgroundColor, backgroundColor, background Color
</keyword></asCustoms></prolog><apiValueDetail class="- topic/body reference/refbody apiRef/apiDetail apiValue/apiValueDetail "><apiValueDef class="- topic/section reference/section apiRef/apiDef apiValue/apiValueDef "><apiProperty class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiProperty "/><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiDynamic class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiDynamic "/><apiValueAccess value="readwrite" class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiValueAccess "/><apiValueClassifier class="- topic/xref reference/xref apiRef/apiRelation apiValue/apiValueClassifier ">uint</apiValueClassifier></apiValueDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
The color of the text field background. The default value is <codeph class="+ topic/ph pr-d/codeph ">0xFFFFFF</codeph> (white).
This property can be retrieved or set, even if there currently is no background, but the
color is visible only if the text field has the <codeph class="+ topic/ph pr-d/codeph ">background</codeph> property set to
<codeph class="+ topic/ph pr-d/codeph ">true</codeph>.
</apiDesc></apiValueDetail><related-links class="- topic/related-links "><link href="flash.text.xml#TextField/background" class="- topic/link "><linktext class="- topic/linktext ">flash.text.TextField.background</linktext></link></related-links></apiValue><apiValue id="flash.text:TextField:background:get" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiValue/apiValue "><apiName class="- topic/title reference/title apiRef/apiName ">background</apiName><shortdesc class="- topic/shortdesc ">
Specifies whether the text field has a background fill.</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="Flash" version="9" class="+ topic/ph adobe-api-d/apiPlatform "/><apiPlatform description="" name="Lite" version="4" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata><asCustoms class="+ topic/metadata adobe-api-d/asCustoms "><keyword class="- topic/keyword ">TextField, TextField.background, background
</keyword></asCustoms></prolog><apiValueDetail class="- topic/body reference/refbody apiRef/apiDetail apiValue/apiValueDetail "><apiValueDef class="- topic/section reference/section apiRef/apiDef apiValue/apiValueDef "><apiProperty class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiProperty "/><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiDynamic class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiDynamic "/><apiValueAccess value="readwrite" class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiValueAccess "/><apiValueClassifier class="- topic/xref reference/xref apiRef/apiRelation apiValue/apiValueClassifier ">Boolean</apiValueClassifier><apiDefaultValue>false
</apiDefaultValue></apiValueDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
Specifies whether the text field has a background fill. If <codeph class="+ topic/ph pr-d/codeph ">true</codeph>, the text field has a
background fill. If <codeph class="+ topic/ph pr-d/codeph ">false</codeph>, the text field has no background fill.
Use the <codeph class="+ topic/ph pr-d/codeph ">backgroundColor</codeph> property to set the background color of a text field.
</apiDesc></apiValueDetail><related-links class="- topic/related-links "><link href="flash.text.xml#TextField/backgroundColor" class="- topic/link "><linktext class="- topic/linktext ">flash.text.TextField.backgroundColor</linktext></link></related-links></apiValue><apiValue id="flash.text:TextField:borderColor:get" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiValue/apiValue "><apiName class="- topic/title reference/title apiRef/apiName ">borderColor</apiName><shortdesc class="- topic/shortdesc ">
The color of the text field border.</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="Flash" version="9" class="+ topic/ph adobe-api-d/apiPlatform "/><apiPlatform description="" name="Lite" version="4" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata><asCustoms class="+ topic/metadata adobe-api-d/asCustoms "><keyword class="- topic/keyword ">TextField, TextField.borderColor, borderColor
</keyword></asCustoms></prolog><apiValueDetail class="- topic/body reference/refbody apiRef/apiDetail apiValue/apiValueDetail "><apiValueDef class="- topic/section reference/section apiRef/apiDef apiValue/apiValueDef "><apiProperty class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiProperty "/><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiDynamic class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiDynamic "/><apiValueAccess value="readwrite" class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiValueAccess "/><apiValueClassifier class="- topic/xref reference/xref apiRef/apiRelation apiValue/apiValueClassifier ">uint</apiValueClassifier></apiValueDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
The color of the text field border. The default value is <codeph class="+ topic/ph pr-d/codeph ">0x000000</codeph> (black).
This property can be retrieved or set, even if there currently is no border, but the
color is visible only if the text field has the <codeph class="+ topic/ph pr-d/codeph ">border</codeph> property set to
<codeph class="+ topic/ph pr-d/codeph ">true</codeph>.
</apiDesc></apiValueDetail><related-links class="- topic/related-links "><link href="flash.text.xml#TextField/border" class="- topic/link "><linktext class="- topic/linktext ">flash.text.TextField.border</linktext></link></related-links></apiValue><apiValue id="flash.text:TextField:border:get" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiValue/apiValue "><apiName class="- topic/title reference/title apiRef/apiName ">border</apiName><shortdesc class="- topic/shortdesc ">
Specifies whether the text field has a border.</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="Flash" version="9" class="+ topic/ph adobe-api-d/apiPlatform "/><apiPlatform description="" name="Lite" version="4" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata><asCustoms class="+ topic/metadata adobe-api-d/asCustoms "><keyword class="- topic/keyword ">TextField, TextField.border, border
</keyword></asCustoms></prolog><apiValueDetail class="- topic/body reference/refbody apiRef/apiDetail apiValue/apiValueDetail "><apiValueDef class="- topic/section reference/section apiRef/apiDef apiValue/apiValueDef "><apiProperty class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiProperty "/><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiDynamic class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiDynamic "/><apiValueAccess value="readwrite" class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiValueAccess "/><apiValueClassifier class="- topic/xref reference/xref apiRef/apiRelation apiValue/apiValueClassifier ">Boolean</apiValueClassifier><apiDefaultValue>false
</apiDefaultValue></apiValueDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
Specifies whether the text field has a border. If <codeph class="+ topic/ph pr-d/codeph ">true</codeph>, the text field has a border.
If <codeph class="+ topic/ph pr-d/codeph ">false</codeph>, the text field has no border. Use the <codeph class="+ topic/ph pr-d/codeph ">borderColor</codeph> property
to set the border color.
</apiDesc></apiValueDetail><related-links class="- topic/related-links "><link href="flash.text.xml#TextField/borderColor" class="- topic/link "><linktext class="- topic/linktext ">flash.text.TextField.borderColor</linktext></link></related-links></apiValue><apiValue id="flash.text:TextField:bottomScrollV:get" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiValue/apiValue "><apiName class="- topic/title reference/title apiRef/apiName ">bottomScrollV</apiName><shortdesc class="- topic/shortdesc ">
An integer (1-based index) that indicates the bottommost line that is currently visible in
the specified text field.</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="Flash" version="9" class="+ topic/ph adobe-api-d/apiPlatform "/><apiPlatform description="" name="Lite" version="4" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata><asCustoms class="+ topic/metadata adobe-api-d/asCustoms "><keyword class="- topic/keyword ">TextField, TextField.bottomScrollV, bottomScrollV
</keyword></asCustoms></prolog><apiValueDetail class="- topic/body reference/refbody apiRef/apiDetail apiValue/apiValueDetail "><apiValueDef class="- topic/section reference/section apiRef/apiDef apiValue/apiValueDef "><apiProperty class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiProperty "/><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiDynamic class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiDynamic "/><apiValueAccess value="read" class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiValueAccess "/><apiValueClassifier class="- topic/xref reference/xref apiRef/apiRelation apiValue/apiValueClassifier ">int</apiValueClassifier><apiTipTexts><apiTipText class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiTipText ">An integer that indicates the bottommost line in a text field.
</apiTipText></apiTipTexts></apiValueDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
An integer (1-based index) that indicates the bottommost line that is currently visible in
the specified text field. Think of the text field as a window onto a block of text.
The <codeph class="+ topic/ph pr-d/codeph ">scrollV</codeph> property is the 1-based index of the topmost visible line
in the window.
<p class="- topic/p ">All the text between the lines indicated by <codeph class="+ topic/ph pr-d/codeph ">scrollV</codeph> and <codeph class="+ topic/ph pr-d/codeph ">bottomScrollV</codeph>
is currently visible in the text field.</p>
</apiDesc></apiValueDetail><related-links class="- topic/related-links "><link href="flash.text.xml#TextField/scrollV" class="- topic/link "><linktext class="- topic/linktext ">flash.text.TextField.scrollV</linktext></link></related-links></apiValue><apiValue id="flash.text:TextField:caretIndex:get" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiValue/apiValue "><apiName class="- topic/title reference/title apiRef/apiName ">caretIndex</apiName><shortdesc class="- topic/shortdesc ">
The index of the insertion point (caret) position.</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="Flash" version="9" class="+ topic/ph adobe-api-d/apiPlatform "/><apiPlatform description="" name="Lite" version="4" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata></prolog><apiValueDetail class="- topic/body reference/refbody apiRef/apiDetail apiValue/apiValueDetail "><apiValueDef class="- topic/section reference/section apiRef/apiDef apiValue/apiValueDef "><apiProperty class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiProperty "/><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiDynamic class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiDynamic "/><apiValueAccess value="read" class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiValueAccess "/><apiValueClassifier class="- topic/xref reference/xref apiRef/apiRelation apiValue/apiValueClassifier ">int</apiValueClassifier><apiTipTexts><apiTipText class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiTipText ">Returns the zero-based index value of the blinking insertion point.
</apiTipText></apiTipTexts></apiValueDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
The index of the insertion point (caret) position. If no insertion point is displayed,
the value is the position the insertion point would be if you restored focus to the field (typically where the
insertion point last was, or 0 if the field has not had focus).
<p class="- topic/p ">Selection span indexes are zero-based (for example, the first position is 0,
the second position is 1, and so on).</p>
</apiDesc><example conref="examples\TextField_caretIndex.as" class="- topic/example "> In this example, a TextField instance is created and populated with text.
An event listener is assigned so that when the user clicks on the TextField, the
<codeph class="+ topic/ph pr-d/codeph ">printCursorPosition</codeph> method is called. In that case, the values of the
<codeph class="+ topic/ph pr-d/codeph ">caretIndex</codeph>, <codeph class="+ topic/ph pr-d/codeph ">selectionBeginIndex</codeph>, and
<codeph class="+ topic/ph pr-d/codeph ">selectionEndIndex</codeph> properties are output.
<p class="- topic/p ">Run this example and try clicking in the TextField to select text. Then click in the field without
selecting text. When you click in the text without making a selection, the
<codeph class="+ topic/ph pr-d/codeph ">caretIndex</codeph> property indicates where the insertion point occurs, and the <codeph class="+ topic/ph pr-d/codeph ">selectionBeginIndex</codeph>
and <codeph class="+ topic/ph pr-d/codeph ">selectionEndIndex</codeph> properties equal the <codeph class="+ topic/ph pr-d/codeph ">caretIndex</codeph> property value.</p>
<codeblock xml:space="preserve" class="+ topic/pre pr-d/codeblock ">
package {
import flash.display.Sprite;
import flash.events.MouseEvent;
import flash.text.TextField;
import flash.text.TextFieldType;
public class TextField_caretIndex extends Sprite {
public function TextField_caretIndex() {
var tf:TextField = createCustomTextField(10, 10, 100, 100);
tf.wordWrap = true;
tf.type = TextFieldType.INPUT;
tf.text = "Click in this text field. Compare the difference between clicking without selecting versus clicking and selecting text.";
tf.addEventListener(MouseEvent.CLICK, printCursorPosition);
}
private function printCursorPosition(event:MouseEvent):void {
var tf:TextField = TextField(event.target);
trace("caretIndex:", tf.caretIndex);
trace("selectionBeginIndex:", tf.selectionBeginIndex);
trace("selectionEndIndex:", tf.selectionEndIndex);
}
private function createCustomTextField(x:Number, y:Number, width:Number, height:Number):TextField {
var result:TextField = new TextField();
result.x = x;
result.y = y;
result.width = width;
result.height = height;
addChild(result);
return result;
}
}
}
</codeblock></example></apiValueDetail><related-links class="- topic/related-links "><link href="flash.text.xml#TextField/selectable" class="- topic/link "><linktext class="- topic/linktext ">selectable</linktext></link><link href="flash.text.xml#TextField/selectionBeginIndex" class="- topic/link "><linktext class="- topic/linktext ">selectionBeginIndex</linktext></link><link href="flash.text.xml#TextField/selectionEndIndex" class="- topic/link "><linktext class="- topic/linktext ">selectionEndIndex</linktext></link></related-links></apiValue><apiValue id="flash.text:TextField:condenseWhite:get" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiValue/apiValue "><apiName class="- topic/title reference/title apiRef/apiName ">condenseWhite</apiName><shortdesc class="- topic/shortdesc ">
A Boolean value that specifies whether extra white space (spaces, line breaks, and so on)
in a text field with HTML text is removed.</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="Flash" version="9" class="+ topic/ph adobe-api-d/apiPlatform "/><apiPlatform description="" name="Lite" version="4" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata><asCustoms class="+ topic/metadata adobe-api-d/asCustoms "><keyword class="- topic/keyword ">textfield, text, HTML
</keyword></asCustoms></prolog><apiValueDetail class="- topic/body reference/refbody apiRef/apiDetail apiValue/apiValueDetail "><apiValueDef class="- topic/section reference/section apiRef/apiDef apiValue/apiValueDef "><apiProperty class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiProperty "/><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiDynamic class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiDynamic "/><apiValueAccess value="readwrite" class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiValueAccess "/><apiValueClassifier class="- topic/xref reference/xref apiRef/apiRelation apiValue/apiValueClassifier ">Boolean</apiValueClassifier><apiTipTexts><apiTipText class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiTipText ">A Boolean value that specifies whether extra white space is removed in a text field
with HTML text.
</apiTipText></apiTipTexts></apiValueDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
A Boolean value that specifies whether extra white space (spaces, line breaks, and so on)
in a text field with HTML text is removed. The default value is <codeph class="+ topic/ph pr-d/codeph ">false</codeph>.
The <codeph class="+ topic/ph pr-d/codeph ">condenseWhite</codeph> property only affects text set with
the <codeph class="+ topic/ph pr-d/codeph ">htmlText</codeph> property, not the <codeph class="+ topic/ph pr-d/codeph ">text</codeph> property. If you set
text with the <codeph class="+ topic/ph pr-d/codeph ">text</codeph> property, <codeph class="+ topic/ph pr-d/codeph ">condenseWhite</codeph> is ignored.
<p class="- topic/p ">If <codeph class="+ topic/ph pr-d/codeph ">condenseWhite</codeph> is set to <codeph class="+ topic/ph pr-d/codeph ">true</codeph>, use standard HTML commands such as
<codeph class="+ topic/ph pr-d/codeph ">&lt;BR&gt;</codeph> and <codeph class="+ topic/ph pr-d/codeph ">&lt;P&gt;</codeph> to place line breaks in the text field.</p>
<p class="- topic/p ">Set the <codeph class="+ topic/ph pr-d/codeph ">condenseWhite</codeph> property before setting the <codeph class="+ topic/ph pr-d/codeph ">htmlText</codeph> property.</p>
</apiDesc><example conref="examples\TextField_condenseWhite.as" class="- topic/example "> The following shows the difference between setting the <codeph class="+ topic/ph pr-d/codeph ">condenseWhite</codeph>
setting to <codeph class="+ topic/ph pr-d/codeph ">false</codeph> and setting it to <codeph class="+ topic/ph pr-d/codeph ">true</codeph>:
<codeblock xml:space="preserve" class="+ topic/pre pr-d/codeblock ">
package {
import flash.display.Sprite;
import flash.text.TextField;
public class TextField_condenseWhite extends Sprite {
public function TextField_condenseWhite() {
var tf1:TextField = createCustomTextField(0, 0, 200, 50);
tf1.condenseWhite = false;
tf1.htmlText = "keep on\n\ttruckin'";
var tf2:TextField = createCustomTextField(0, 120, 200, 50);
tf2.condenseWhite = true;
tf2.htmlText = "keep on\n\ttruckin'";
}
private function createCustomTextField(x:Number, y:Number, width:Number, height:Number):TextField {
var result:TextField = new TextField();
result.x = x;
result.y = y;
result.width = width;
result.height = height;
result.border = true;
addChild(result);
return result;
}
}
}
</codeblock></example></apiValueDetail><related-links class="- topic/related-links "><link href="flash.text.xml#TextField/htmlText" class="- topic/link "><linktext class="- topic/linktext ">flash.text.TextField.htmlText</linktext></link></related-links></apiValue><apiValue id="flash.text:TextField:defaultTextFormat:get" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiValue/apiValue "><apiName class="- topic/title reference/title apiRef/apiName ">defaultTextFormat</apiName><shortdesc class="- topic/shortdesc ">
Specifies the format applied to newly inserted text, such as text entered by a user or text inserted with the
replaceSelectedText() method.</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="Flash" version="9" class="+ topic/ph adobe-api-d/apiPlatform "/><apiPlatform description="" name="Lite" version="4" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata><asCustoms class="+ topic/metadata adobe-api-d/asCustoms "><keyword class="- topic/keyword ">TextField, TextField.defaultTextFormat, defaultTextFormat
</keyword></asCustoms></prolog><apiValueDetail class="- topic/body reference/refbody apiRef/apiDetail apiValue/apiValueDetail "><apiValueDef class="- topic/section reference/section apiRef/apiDef apiValue/apiValueDef "><apiProperty class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiProperty "/><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiDynamic class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiDynamic "/><apiValueAccess value="readwrite" class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiValueAccess "/><apiValueClassifier class="- topic/xref reference/xref apiRef/apiRelation apiValue/apiValueClassifier ">flash.text:TextFormat</apiValueClassifier><apiException class="+ topic/ph reference/ph apiRef/apiDefItem apiOperation/apiEvent adobe-api-d/apiException "><apiDesc class="- topic/section reference/section apiRef/apiDesc ">This method cannot be used on a text field with a style sheet.
</apiDesc><apiItemName class="- topic/keyword reference/keyword apiRef/apiItemName ">Error</apiItemName><apiOperationClassifier class="- topic/xref reference/xref apiRef/apiRelation apiOperation/apiOperationClassifier ">Error</apiOperationClassifier></apiException><apiTipTexts><apiTipText class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiTipText ">Specifies the text format for newly inserted text.
</apiTipText></apiTipTexts></apiValueDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
Specifies the format applied to newly inserted text, such as text entered by a user or text inserted with the
<codeph class="+ topic/ph pr-d/codeph ">replaceSelectedText()</codeph> method.
<p class="- topic/p "><b class="+ topic/ph hi-d/b ">Note:</b> When selecting characters to be replaced with <codeph class="+ topic/ph pr-d/codeph ">setSelection()</codeph> and
<codeph class="+ topic/ph pr-d/codeph ">replaceSelectedText()</codeph>, the <codeph class="+ topic/ph pr-d/codeph ">defaultTextFormat</codeph> will be applied only if the
text has been selected up to and including the last character. Here is an example:</p>
<pre xml:space="preserve" class="- topic/pre ">
var my_txt:TextField new TextField();
my_txt.text = "Flash Macintosh version";
var my_fmt:TextFormat = new TextFormat();
my_fmt.color = 0xFF0000;
my_txt.defaultTextFormat = my_fmt;
my_txt.setSelection(6,15); // partial text selected - defaultTextFormat not applied
my_txt.setSelection(6,23); // text selected to end - defaultTextFormat applied
my_txt.replaceSelectedText("Windows version");
</pre>
<p class="- topic/p ">When you access the <codeph class="+ topic/ph pr-d/codeph ">defaultTextFormat</codeph> property, the returned TextFormat object has all
of its properties defined. No property is <codeph class="+ topic/ph pr-d/codeph ">null</codeph>.</p>
<p class="- topic/p "><b class="+ topic/ph hi-d/b ">Note:</b> You can't set this property if a style sheet is applied to the text field.</p>
</apiDesc></apiValueDetail><related-links class="- topic/related-links "><link href="flash.text.xml#TextField/replaceSelectedText()" class="- topic/link "><linktext class="- topic/linktext ">flash.text.TextField.replaceSelectedText()</linktext></link><link href="flash.text.xml#TextField/getTextFormat()" class="- topic/link "><linktext class="- topic/linktext ">flash.text.TextField.getTextFormat()</linktext></link><link href="flash.text.xml#TextField/setTextFormat()" class="- topic/link "><linktext class="- topic/linktext ">flash.text.TextField.setTextFormat()</linktext></link></related-links></apiValue><apiValue id="flash.text:TextField:displayAsPassword:get" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiValue/apiValue "><apiName class="- topic/title reference/title apiRef/apiName ">displayAsPassword</apiName><shortdesc class="- topic/shortdesc ">
Specifies whether the text field is a password text field.</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="Flash" version="9" class="+ topic/ph adobe-api-d/apiPlatform "/><apiPlatform description="" name="Lite" version="4" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata><asCustoms class="+ topic/metadata adobe-api-d/asCustoms "><keyword class="- topic/keyword ">TextField, TextField.password, password
</keyword></asCustoms></prolog><apiValueDetail class="- topic/body reference/refbody apiRef/apiDetail apiValue/apiValueDetail "><apiValueDef class="- topic/section reference/section apiRef/apiDef apiValue/apiValueDef "><apiProperty class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiProperty "/><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiDynamic class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiDynamic "/><apiValueAccess value="readwrite" class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiValueAccess "/><apiValueClassifier class="- topic/xref reference/xref apiRef/apiRelation apiValue/apiValueClassifier ">Boolean</apiValueClassifier><apiDefaultValue>false
</apiDefaultValue><apiTipTexts><apiTipText class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiTipText ">Specifies whether input characters are hidden.
</apiTipText></apiTipTexts></apiValueDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
Specifies whether the text field is a password text field. If the value of this property is <codeph class="+ topic/ph pr-d/codeph ">true</codeph>,
the text field is treated as a password text field and hides the input characters using asterisks instead of the
actual characters. If <codeph class="+ topic/ph pr-d/codeph ">false</codeph>, the text field is not treated as a password text field. When password mode
is enabled, the Cut and Copy commands and their corresponding keyboard shortcuts will
not function. This security mechanism prevents an unscrupulous user from using the shortcuts to discover
a password on an unattended computer.
</apiDesc></apiValueDetail></apiValue><apiValue id="flash.text:TextField:embedFonts:get" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiValue/apiValue "><apiName class="- topic/title reference/title apiRef/apiName ">embedFonts</apiName><shortdesc class="- topic/shortdesc ">
Specifies whether to render by using embedded font outlines.</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="Flash" version="9" class="+ topic/ph adobe-api-d/apiPlatform "/><apiPlatform description="" name="Lite" version="4" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata><asCustoms class="+ topic/metadata adobe-api-d/asCustoms "><keyword class="- topic/keyword ">TextField, TextField.embedFonts, embedFonts
</keyword></asCustoms></prolog><apiValueDetail class="- topic/body reference/refbody apiRef/apiDetail apiValue/apiValueDetail "><apiValueDef class="- topic/section reference/section apiRef/apiDef apiValue/apiValueDef "><apiProperty class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiProperty "/><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiDynamic class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiDynamic "/><apiValueAccess value="readwrite" class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiValueAccess "/><apiValueClassifier class="- topic/xref reference/xref apiRef/apiRelation apiValue/apiValueClassifier ">Boolean</apiValueClassifier><apiDefaultValue>false
</apiDefaultValue><apiTipTexts><apiTipText class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiTipText ">Renders the text field with font outlines or device fonts.
</apiTipText></apiTipTexts></apiValueDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
Specifies whether to render by using embedded font outlines.
If <codeph class="+ topic/ph pr-d/codeph ">false</codeph>, Flash Player renders the text field by using
device fonts.
<p class="- topic/p ">If you set the <codeph class="+ topic/ph pr-d/codeph ">embedFonts</codeph> property to <codeph class="+ topic/ph pr-d/codeph ">true</codeph> for a text field,
you must specify a font for that text by using the <codeph class="+ topic/ph pr-d/codeph ">font</codeph> property of
a TextFormat object applied to the text field.
If the specified font is not embedded in the SWF file, the text is not displayed.</p>
</apiDesc></apiValueDetail><related-links class="- topic/related-links "><link href="flash.text.xml#Font/enumerateFonts()" class="- topic/link "><linktext class="- topic/linktext ">Font.enumerateFonts()</linktext></link></related-links></apiValue><apiValue id="flash.text:TextField:gridFitType:get" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiValue/apiValue "><apiName class="- topic/title reference/title apiRef/apiName ">gridFitType</apiName><shortdesc class="- topic/shortdesc ">
The type of grid fitting used for this text field.</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="Flash" version="9" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata><asCustoms class="+ topic/metadata adobe-api-d/asCustoms "><oldexample>This example shows three text fields that use the
different <code>flash.text.GridFitType</code> settings. It assumes that you have a font
embedded in the Library with the linkage identifier set to <code>"Times-12"</code>.
To embed the font, follow these steps:
<ol class="- topic/ol "><li class="- topic/li ">Open your Library</li><li class="- topic/li ">Click the Library options menu in the upper right corner of the Library</li><li class="- topic/li ">Select "New Font" from the dropdown list</li><li class="- topic/li ">Name the font "Times-12"</li><li class="- topic/li ">Select "Times New Roman" from the font dropdown list</li><li class="- topic/li ">Press the "OK" button</li><li class="- topic/li ">Right-click on the newly created font and select "Linkage..."</li><li class="- topic/li ">Check the "Export for ActionScript" box</li><li class="- topic/li ">Accept the default identifier "Times-12" by pressing the "OK" button</li></ol>
<listing version="2.0">
var my_format:TextFormat = new TextFormat();
my_format.font = "Times-12";
var my_text1:TextField = this.createTextField("my_text1", this.getNextHighestDepth(), 9.5, 10, 400, 100);
my_text1.text = "this.gridFitType = none";
my_text1.embedFonts = true;
my_text1.antiAliasType = "advanced";
my_text1.gridFitType = "none";
my_text1.setTextFormat(my_format);
var my_text2:TextField = this.createTextField("my_text2", this.getNextHighestDepth(), 9.5, 40, 400, 100);
my_text2.text = "this.gridFitType = advanced";
my_text2.embedFonts = true;
my_text2.antiAliasType = "advanced";
my_text2.gridFitType = "pixel";
my_text2.setTextFormat(my_format);
var my_text3:TextField = this.createTextField("my_text3", this.getNextHighestDepth(), 9.5, 70, 400, 100);
my_text3.text = "this.gridFitType = subpixel";
my_text3.embedFonts = true;
my_text3.antiAliasType = "advanced";
my_text3.gridFitType = "subpixel";
my_text3.setTextFormat(my_format);
</listing>
</oldexample></asCustoms></prolog><apiValueDetail class="- topic/body reference/refbody apiRef/apiDetail apiValue/apiValueDetail "><apiValueDef class="- topic/section reference/section apiRef/apiDef apiValue/apiValueDef "><apiProperty class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiProperty "/><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiDynamic class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiDynamic "/><apiValueAccess value="readwrite" class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiValueAccess "/><apiValueClassifier class="- topic/xref reference/xref apiRef/apiRelation apiValue/apiValueClassifier ">String</apiValueClassifier><apiDefaultValue>pixel
</apiDefaultValue><apiTipTexts><apiTipText class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiTipText ">The type of grid fitting used.
</apiTipText></apiTipTexts></apiValueDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
The type of grid fitting used for this text field. This property applies only if the
<codeph class="+ topic/ph pr-d/codeph ">flash.text.AntiAliasType</codeph> property of the text field is set to <codeph class="+ topic/ph pr-d/codeph ">flash.text.AntiAliasType.ADVANCED</codeph>.
<p class="- topic/p ">The type of grid fitting used determines whether Flash Player forces strong horizontal and
vertical lines to fit to a pixel or subpixel grid, or not at all.</p>
<p class="- topic/p ">For the <codeph class="+ topic/ph pr-d/codeph ">flash.text.GridFitType</codeph> property, you can use the following string values:</p>
<adobetable class="innertable"><tgroup cols="2" class="- topic/tgroup "><thead class="- topic/thead "><row class="- topic/row "><entry class="- topic/entry ">String value</entry><entry class="- topic/entry ">Description</entry></row></thead><tbody class="- topic/tbody "><row class="- topic/row "><entry class="- topic/entry "><codeph class="+ topic/ph pr-d/codeph ">flash.text.GridFitType.NONE</codeph></entry><entry class="- topic/entry ">Specifies no grid fitting. Horizontal and vertical lines in the glyphs are not
forced to the pixel grid. This setting is recommended for animation or
for large font sizes.</entry></row><row class="- topic/row "><entry class="- topic/entry "><codeph class="+ topic/ph pr-d/codeph ">flash.text.GridFitType.PIXEL</codeph></entry><entry class="- topic/entry ">Specifies that strong horizontal and vertical lines are fit to the
pixel grid. This setting works only for left-aligned text fields.
To use this setting, the <codeph class="+ topic/ph pr-d/codeph ">flash.dispaly.AntiAliasType</codeph> property of the text field
must be set to <codeph class="+ topic/ph pr-d/codeph ">flash.text.AntiAliasType.ADVANCED</codeph>.
This setting generally provides the best legibility for
left-aligned text.</entry></row><row class="- topic/row "><entry class="- topic/entry "><codeph class="+ topic/ph pr-d/codeph ">flash.text.GridFitType.SUBPIXEL</codeph></entry><entry class="- topic/entry ">Specifies that strong horizontal and vertical lines are fit to the subpixel grid on
an LCD monitor. To use this setting, the
<codeph class="+ topic/ph pr-d/codeph ">flash.text.AntiAliasType</codeph> property of the text field must be set to
<codeph class="+ topic/ph pr-d/codeph ">flash.text.AntiAliasType.ADVANCED</codeph>. The <codeph class="+ topic/ph pr-d/codeph ">flash.text.GridFitType.SUBPIXEL</codeph> setting is often good
for right-aligned or centered
dynamic text, and it is sometimes a useful trade-off for animation versus text quality.</entry></row></tbody></tgroup></adobetable>
</apiDesc><example conref="examples\TextField_gridFitType.as" class="- topic/example "> The following example shows three text fields with different
settings for the <codeph class="+ topic/ph pr-d/codeph ">gridFitType</codeph> property. When you use this example,
notice the difference in legibility for the first two lines. Also note the optimal use of
<codeph class="+ topic/ph pr-d/codeph ">GridFitType.PIXEL</codeph> for left-aligned text and <codeph class="+ topic/ph pr-d/codeph ">GridFitType.SUBPIXEL</codeph>
for right-aligned text.
<codeblock xml:space="preserve" class="+ topic/pre pr-d/codeblock ">
package
{
import flash.display.Sprite;
import flash.text.TextField;
import flash.text.TextFormat;
import flash.text.TextFieldAutoSize;
import flash.text.AntiAliasType;
import flash.text.GridFitType;
public class gridFitTypeExample extends Sprite
{
public function gridFitTypeExample()
{
var format1:TextFormat = new TextFormat();
format1.font="Arial";
format1.size=12;
var tf1:TextField = createCustomTextField(0,0,format1,"NONE",TextFieldAutoSize.LEFT,GridFitType.NONE);
var tf2:TextField = createCustomTextField(0,30,format1,"PIXEL",TextFieldAutoSize.LEFT,GridFitType.PIXEL);
var tf3:TextField = createCustomTextField(300,60,format1,"SUBPIXEL",TextFieldAutoSize.RIGHT,GridFitType.SUBPIXEL);
}
private function createCustomTextField(x:Number,y:Number,fm:TextFormat,tl:String,tfs:String,gft:String):TextField
{
var result:TextField = new TextField();
result.x=x;
result.y=y;
result.embedFonts=true;
result.antiAliasType=AntiAliasType.ADVANCED;
result.text="This text uses a gridFitType of " + tl;
result.autoSize=tfs;
result.gridFitType=gft;
result.setTextFormat(fm);
addChild(result);
return result;
}
}
}
</codeblock></example></apiValueDetail><related-links class="- topic/related-links "><link href="flash.text.xml#GridFitType" class="- topic/link "><linktext class="- topic/linktext ">flash.text.GridFitType</linktext></link><link href="flash.text.xml#TextField/antiAliasType" class="- topic/link "><linktext class="- topic/linktext ">flash.text.TextField.antiAliasType</linktext></link><link href="flash.text.xml#AntiAliasType" class="- topic/link "><linktext class="- topic/linktext ">flash.text.AntiAliasType</linktext></link></related-links></apiValue><apiValue id="flash.text:TextField:htmlText:get" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiValue/apiValue "><apiName class="- topic/title reference/title apiRef/apiName ">htmlText</apiName><shortdesc class="- topic/shortdesc ">
Contains the HTML representation of the text field contents.</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="Flash" version="9" class="+ topic/ph adobe-api-d/apiPlatform "/><apiPlatform description="" name="Lite" version="4" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata><asCustoms class="+ topic/metadata adobe-api-d/asCustoms "><keyword class="- topic/keyword ">TextField, TextField.htmlText, htmlText
</keyword></asCustoms></prolog><apiValueDetail class="- topic/body reference/refbody apiRef/apiDetail apiValue/apiValueDetail "><apiValueDef class="- topic/section reference/section apiRef/apiDef apiValue/apiValueDef "><apiProperty class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiProperty "/><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiDynamic class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiDynamic "/><apiValueAccess value="readwrite" class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiValueAccess "/><apiValueClassifier class="- topic/xref reference/xref apiRef/apiRelation apiValue/apiValueClassifier ">String</apiValueClassifier><apiTipTexts><apiTipText class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiTipText ">The HTML representation of the text field contents.
</apiTipText></apiTipTexts></apiValueDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
Contains the HTML representation of the text field contents.
<p class="- topic/p ">Flash Player supports the following HTML tags:</p>
<adobetable class="innertable"><tgroup cols="2" class="- topic/tgroup "><thead class="- topic/thead "><row class="- topic/row "><entry class="- topic/entry ">
Tag
</entry><entry class="- topic/entry ">
Description
</entry></row></thead><tbody class="- topic/tbody "><row class="- topic/row "><entry class="- topic/entry ">
Anchor tag
</entry><entry class="- topic/entry ">
The <codeph class="+ topic/ph pr-d/codeph ">&lt;a&gt;</codeph> tag creates a hypertext link and supports the following attributes:
<ul class="- topic/ul "><li class="- topic/li ">
<codeph class="+ topic/ph pr-d/codeph ">target</codeph>: Specifies the name of the target window where you load the page.
Options include <codeph class="+ topic/ph pr-d/codeph ">_self</codeph>, <codeph class="+ topic/ph pr-d/codeph ">_blank</codeph>, <codeph class="+ topic/ph pr-d/codeph ">_parent</codeph>, and
<codeph class="+ topic/ph pr-d/codeph ">_top</codeph>. The <codeph class="+ topic/ph pr-d/codeph ">_self</codeph> option specifies the current frame in the current window,
<codeph class="+ topic/ph pr-d/codeph ">_blank</codeph> specifies a new window, <codeph class="+ topic/ph pr-d/codeph ">_parent</codeph> specifies the parent of the
current frame, and <codeph class="+ topic/ph pr-d/codeph ">_top</codeph> specifies the top-level frame in the current window.
</li><li class="- topic/li ">
<codeph class="+ topic/ph pr-d/codeph ">href</codeph>: Specifies a URL or an ActionScript <codeph class="+ topic/ph pr-d/codeph ">link</codeph> event.The URL can
be either absolute or relative to the location of the SWF file that
is loading the page. An example of an absolute reference to a URL is
<codeph class="+ topic/ph pr-d/codeph ">http://www.adobe.com</codeph>; an example of a relative reference is
<codeph class="+ topic/ph pr-d/codeph ">/index.html</codeph>. Absolute URLs must be prefixed with
http://; otherwise, Flash Player or AIR treats them as relative URLs.
You can use the <codeph class="+ topic/ph pr-d/codeph ">link</codeph> event to cause the link to execute an ActionScript
function in a SWF file instead of opening a URL. To specify a <codeph class="+ topic/ph pr-d/codeph ">link</codeph> event, use
the event scheme instead of the http scheme in your <codeph class="+ topic/ph pr-d/codeph ">href</codeph> attribute. An example
is <codeph class="+ topic/ph pr-d/codeph ">href="event:myText"</codeph> instead of <codeph class="+ topic/ph pr-d/codeph ">href="http://myURL"</codeph>; when the
user clicks a hypertext link that contains the event scheme, the text field dispatches a
<codeph class="+ topic/ph pr-d/codeph ">link</codeph> TextEvent with its <codeph class="+ topic/ph pr-d/codeph ">text</codeph> property set to "<codeph class="+ topic/ph pr-d/codeph ">myText</codeph>". You can then create an ActionScript
function that executes whenever the link TextEvent is dispatched.
You can also define <codeph class="+ topic/ph pr-d/codeph ">a:link</codeph>, <codeph class="+ topic/ph pr-d/codeph ">a:hover</codeph>, and <codeph class="+ topic/ph pr-d/codeph ">a:active</codeph>
styles for anchor tags by using style sheets.
</li></ul>
</entry></row><row class="- topic/row "><entry class="- topic/entry ">
Bold tag
</entry><entry class="- topic/entry ">
The <codeph class="+ topic/ph pr-d/codeph ">&lt;b&gt;</codeph> tag renders text as bold. A bold typeface must be available for the font used.
</entry></row><row class="- topic/row "><entry class="- topic/entry ">
Break tag
</entry><entry class="- topic/entry ">
The <codeph class="+ topic/ph pr-d/codeph ">&lt;br&gt;</codeph> tag creates a line break in the text field. Set the text field to
be a multiline text field to use this tag.
</entry></row><row class="- topic/row "><entry class="- topic/entry ">
Font tag
</entry><entry class="- topic/entry ">
The <codeph class="+ topic/ph pr-d/codeph ">&lt;font&gt;</codeph> tag specifies a font or list of fonts to display the text.The font tag
supports the following attributes:
<ul class="- topic/ul "><li class="- topic/li ">
<codeph class="+ topic/ph pr-d/codeph ">color</codeph>: Only hexadecimal color (<codeph class="+ topic/ph pr-d/codeph ">#FFFFFF</codeph>) values are supported.
</li><li class="- topic/li ">
<codeph class="+ topic/ph pr-d/codeph ">face</codeph>: Specifies the name of the font to use. As shown in the following example,
you can specify a list of comma-delimited font names, in which case Flash Player selects the first available
font. If the specified font is not installed on the local computer system or isn't embedded in the SWF file,
Flash Player selects a substitute font.
</li><li class="- topic/li ">
<codeph class="+ topic/ph pr-d/codeph ">size</codeph>: Specifies the size of the font. You can use absolute pixel sizes, such as 16 or 18,
or relative point sizes, such as +2 or -4.
</li></ul>
</entry></row><row class="- topic/row "><entry class="- topic/entry ">
Image tag
</entry><entry class="- topic/entry ">
The <codeph class="+ topic/ph pr-d/codeph ">&lt;img&gt;</codeph> tag lets you embed external image files (JPEG, GIF, PNG), SWF files, and
movie clips inside text fields. Text automatically flows around images you embed in text fields. You
must set the text field to be multiline to wrap text around an image.
<p class="- topic/p ">The <codeph class="+ topic/ph pr-d/codeph ">&lt;img&gt;</codeph> tag supports the following attributes: </p>
<ul class="- topic/ul "><li class="- topic/li ">
<codeph class="+ topic/ph pr-d/codeph ">src</codeph>: Specifies the URL to an image or SWF file, or the linkage identifier for a movie clip
symbol in the library. This attribute is required; all other attributes are optional. External files (JPEG, GIF, PNG,
and SWF files) do not show until they are downloaded completely.
</li><li class="- topic/li ">
<codeph class="+ topic/ph pr-d/codeph ">width</codeph>: The width of the image, SWF file, or movie clip being inserted, in pixels.
</li><li class="- topic/li ">
<codeph class="+ topic/ph pr-d/codeph ">height</codeph>: The height of the image, SWF file, or movie clip being inserted, in pixels.
</li><li class="- topic/li ">
<codeph class="+ topic/ph pr-d/codeph ">align</codeph>: Specifies the horizontal alignment of the embedded image within the text field.
Valid values are <codeph class="+ topic/ph pr-d/codeph ">left</codeph> and <codeph class="+ topic/ph pr-d/codeph ">right</codeph>. The default value is <codeph class="+ topic/ph pr-d/codeph ">left</codeph>.
</li><li class="- topic/li ">
<codeph class="+ topic/ph pr-d/codeph ">hspace</codeph>: Specifies the amount of horizontal space that surrounds the image where
no text appears. The default value is 8.
</li><li class="- topic/li ">
<codeph class="+ topic/ph pr-d/codeph ">vspace</codeph>: Specifies the amount of vertical space that surrounds the image where no
text appears. The default value is 8.
</li><li class="- topic/li ">
<codeph class="+ topic/ph pr-d/codeph ">id</codeph>: Specifies the name for the movie clip instance (created by Flash Player) that contains
the embedded image file, SWF file, or movie clip. This approach is used to control the embedded content with
ActionScript.
</li><li class="- topic/li ">
<codeph class="+ topic/ph pr-d/codeph ">checkPolicyFile</codeph>: Specifies that Flash Player checks for a URL policy file
on the server associated with the image domain. If a policy file exists, SWF files in the domains
listed in the file can access the data of the loaded image, for example, by calling the
<codeph class="+ topic/ph pr-d/codeph ">BitmapData.draw()</codeph> method with this image as the <codeph class="+ topic/ph pr-d/codeph ">source</codeph> parameter.
For more information related to security, see the Flash Player Developer Center Topic:
<xref href="http://www.adobe.com/go/devnet_security_en" scope="external" class="- topic/xref ">Security</xref>.
</li></ul>
<p class="- topic/p ">Flash displays media embedded in a text field at full size. To specify the dimensions of the media
you are embedding, use the <codeph class="+ topic/ph pr-d/codeph ">&lt;img&gt;</codeph> tag <codeph class="+ topic/ph pr-d/codeph ">height</codeph> and <codeph class="+ topic/ph pr-d/codeph ">width</codeph>
attributes. </p>
<p class="- topic/p ">In general, an image embedded in a text field appears on the line following the
<codeph class="+ topic/ph pr-d/codeph ">&lt;img&gt;</codeph> tag. However, when the <codeph class="+ topic/ph pr-d/codeph ">&lt;img&gt;</codeph> tag
is the first character in the text field, the image appears on the first line of the text field. </p>
<p class="- topic/p ">For AIR content in the application security sandbox, AIR ignores <codeph class="+ topic/ph pr-d/codeph ">img</codeph> tags in
HTML content in ActionScript TextField objects. This is to prevent possible phishing attacks,</p>
</entry></row><row class="- topic/row "><entry class="- topic/entry ">
Italic tag
</entry><entry class="- topic/entry ">
The <codeph class="+ topic/ph pr-d/codeph ">&lt;i&gt;</codeph> tag displays the tagged text in italics. An italic typeface must be available
for the font used.
</entry></row><row class="- topic/row "><entry class="- topic/entry ">
List item tag
</entry><entry class="- topic/entry ">
The <codeph class="+ topic/ph pr-d/codeph ">&lt;li&gt;</codeph> tag places a bullet in front of the text that it encloses.
<b class="+ topic/ph hi-d/b ">Note:</b> Because Flash Player and AIR do not recognize ordered and unordered list tags (<codeph class="+ topic/ph pr-d/codeph ">&lt;ol&gt;</codeph>
and <codeph class="+ topic/ph pr-d/codeph ">&lt;ul&gt;</codeph>, they do not modify how your list is rendered. All lists are unordered and all
list items use bullets.
</entry></row><row class="- topic/row "><entry class="- topic/entry ">
Paragraph tag
</entry><entry class="- topic/entry ">
The <codeph class="+ topic/ph pr-d/codeph ">&lt;p&gt;</codeph> tag creates a new paragraph. The text field must be set to be a multiline
text field to use this tag.
The <codeph class="+ topic/ph pr-d/codeph ">&lt;p&gt;</codeph> tag supports the following attributes:
<ul class="- topic/ul "><li class="- topic/li ">
align: Specifies alignment of text within the paragraph; valid values are <codeph class="+ topic/ph pr-d/codeph ">left</codeph>, <codeph class="+ topic/ph pr-d/codeph ">right</codeph>, <codeph class="+ topic/ph pr-d/codeph ">justify</codeph>, and <codeph class="+ topic/ph pr-d/codeph ">center</codeph>.
</li><li class="- topic/li ">
class: Specifies a CSS style class defined by a flash.text.StyleSheet object.
</li></ul>
</entry></row><row class="- topic/row "><entry class="- topic/entry ">
Span tag
</entry><entry class="- topic/entry ">
The <codeph class="+ topic/ph pr-d/codeph ">&lt;span&gt;</codeph> tag is available only for use with CSS text styles. It supports the
following attribute:
<ul class="- topic/ul "><li class="- topic/li ">
class: Specifies a CSS style class defined by a flash.text.StyleSheet object.
</li></ul>
</entry></row><row class="- topic/row "><entry class="- topic/entry ">
Text format tag
</entry><entry class="- topic/entry ">
<p class="- topic/p ">The <codeph class="+ topic/ph pr-d/codeph ">&lt;textformat&gt;</codeph> tag lets you use a subset of paragraph formatting
properties of the TextFormat class within text fields, including line leading, indentation,
margins, and tab stops. You can combine <codeph class="+ topic/ph pr-d/codeph ">&lt;textformat&gt;</codeph> tags with the
built-in HTML tags. </p>
<p class="- topic/p ">The <codeph class="+ topic/ph pr-d/codeph ">&lt;textformat&gt;</codeph> tag has the following attributes: </p>
<ul class="- topic/ul "><li class="- topic/li ">
<codeph class="+ topic/ph pr-d/codeph ">blockindent</codeph>: Specifies the block indentation in points; corresponds to
<codeph class="+ topic/ph pr-d/codeph ">TextFormat.blockIndent</codeph>.
</li><li class="- topic/li ">
<codeph class="+ topic/ph pr-d/codeph ">indent</codeph>: Specifies the indentation from the left margin to the first character
in the paragraph; corresponds to <codeph class="+ topic/ph pr-d/codeph ">TextFormat.indent</codeph>. Both positive and negative
numbers are acceptable.
</li><li class="- topic/li ">
<codeph class="+ topic/ph pr-d/codeph ">leading</codeph>: Specifies the amount of leading (vertical space) between lines;
corresponds to <codeph class="+ topic/ph pr-d/codeph ">TextFormat.leading</codeph>. Both positive and negative numbers are acceptable.
</li><li class="- topic/li ">
<codeph class="+ topic/ph pr-d/codeph ">leftmargin</codeph>: Specifies the left margin of the paragraph, in points; corresponds
to <codeph class="+ topic/ph pr-d/codeph ">TextFormat.leftMargin</codeph>.
</li><li class="- topic/li ">
<codeph class="+ topic/ph pr-d/codeph ">rightmargin</codeph>: Specifies the right margin of the paragraph, in points; corresponds
to <codeph class="+ topic/ph pr-d/codeph ">TextFormat.rightMargin</codeph>.
</li><li class="- topic/li ">
<codeph class="+ topic/ph pr-d/codeph ">tabstops</codeph>: Specifies custom tab stops as an array of non-negative integers;
corresponds to <codeph class="+ topic/ph pr-d/codeph ">TextFormat.tabStops</codeph>.
</li></ul>
</entry></row><row class="- topic/row "><entry class="- topic/entry ">
Underline tag
</entry><entry class="- topic/entry ">
The <codeph class="+ topic/ph pr-d/codeph ">&lt;u&gt;</codeph> tag underlines the tagged text.
</entry></row></tbody></tgroup></adobetable>
<p class="- topic/p ">Flash Player and AIR support the following HTML entities:</p>
<adobetable class="innertable"><tgroup cols="2" class="- topic/tgroup "><thead class="- topic/thead "><row class="- topic/row "><entry class="- topic/entry ">
Entity
</entry><entry class="- topic/entry ">
Description
</entry></row></thead><tbody class="- topic/tbody "><row class="- topic/row "><entry class="- topic/entry ">
&amp;amp;lt;
</entry><entry class="- topic/entry ">
&lt; (less than)
</entry></row><row class="- topic/row "><entry class="- topic/entry ">
&amp;amp;gt;
</entry><entry class="- topic/entry ">
&gt; (greater than)
</entry></row><row class="- topic/row "><entry class="- topic/entry ">
&amp;amp;amp;
</entry><entry class="- topic/entry ">
&amp; (ampersand)
</entry></row><row class="- topic/row "><entry class="- topic/entry ">
&amp;amp;quot;
</entry><entry class="- topic/entry ">
" (double quotes)
</entry></row><row class="- topic/row "><entry class="- topic/entry ">
&amp;amp;apos;
</entry><entry class="- topic/entry ">
' (apostrophe, single quote)
</entry></row></tbody></tgroup></adobetable>
<p class="- topic/p ">Flash Player and AIR also support explicit character codes, such as
&amp;#38; (ASCII ampersand) and &amp;#x20AC; (Unicode € symbol). </p>
</apiDesc><example conref="examples\TextField_text.as" class="- topic/example "> The following example creates a TextField called <codeph class="+ topic/ph pr-d/codeph ">tf1</codeph>, and assigns an
HTML-formatted String to its <codeph class="+ topic/ph pr-d/codeph ">text</codeph> property. When its <codeph class="+ topic/ph pr-d/codeph ">htmlText</codeph> property
is traced, the output is the HTML-formatted String, with additional tags (such as &lt;P&gt; and
&lt;FONT&gt;) automatically added by Flash Player. When the value of the <codeph class="+ topic/ph pr-d/codeph ">text</codeph>
property is traced, the unformatted string without HTML tags is displayed.
<p class="- topic/p ">By way of comparison, the same steps are performed on another TextField object named
<codeph class="+ topic/ph pr-d/codeph ">tf2</codeph>, with the addition that a StyleSheet object is assigned to <codeph class="+ topic/ph pr-d/codeph ">tf2</codeph>'s
<codeph class="+ topic/ph pr-d/codeph ">styleSheet</codeph> property before its <codeph class="+ topic/ph pr-d/codeph ">htmlText</codeph> property is set. In that case,
when the <codeph class="+ topic/ph pr-d/codeph ">htmlText</codeph> property is traced, it only includes the exact HTML text that was
originally assigned to the <codeph class="+ topic/ph pr-d/codeph ">htmlText</codeph> property, showing that no additional tags were
added by Flash Player.</p>
<codeblock xml:space="preserve" class="+ topic/pre pr-d/codeblock ">
package {
import flash.display.Sprite;
import flash.text.StyleSheet;
import flash.text.TextField;
public class TextField_text extends Sprite {
public function TextField_text() {
var tf1:TextField = createCustomTextField(10, 10, 400, 22);
tf1.htmlText = "&lt;b&gt;Lorem ipsum dolor sit amet.&lt;/b&gt;";
// htmlText: &lt;P ALIGN="LEFT"&gt;&lt;FONT FACE="Times New Roman" SIZE="12" COLOR="#000000" LETTERSPACING="0" KERNING="0"&gt;&amp;lt;b&amp;gt;Lorem ipsum dolor sit amet.&amp;lt;/b&amp;gt;&lt;/FONT&gt;&lt;/P&gt;
trace("htmlText: " + tf1.htmlText);
// text: Lorem ipsum dolor sit amet.
trace("text: " + tf1.text);
var tf2:TextField = createCustomTextField(10, 50, 400, 22);
tf2.styleSheet = new StyleSheet();
tf2.htmlText = "&lt;b&gt;Lorem ipsum dolor sit amet.&lt;/b&gt;";
// htmlText: &lt;b&gt;Lorem ipsum dolor sit amet.&lt;/b&gt;
trace("htmlText: " + tf2.htmlText);
// text: Lorem ipsum dolor sit amet.
trace("text: " + tf2.text);
}
private function createCustomTextField(x:Number, y:Number, width:Number, height:Number):TextField {
var result:TextField = new TextField();
result.x = x;
result.y = y;
result.width = width;
result.height = height;
addChild(result);
return result;
}
}
}
</codeblock></example></apiValueDetail><related-links class="- topic/related-links "><link href="flash.text.xml#TextField/text" class="- topic/link "><linktext class="- topic/linktext ">flash.text.TextField.text</linktext></link><link href="flash.text.xml#StyleSheet" class="- topic/link "><linktext class="- topic/linktext ">flash.text.StyleSheet</linktext></link><link href="flash.events.xml#TextEvent" class="- topic/link "><linktext class="- topic/linktext ">flash.events.TextEvent</linktext></link></related-links></apiValue><apiValue id="flash.text:TextField:length:get" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiValue/apiValue "><apiName class="- topic/title reference/title apiRef/apiName ">length</apiName><shortdesc class="- topic/shortdesc ">
The number of characters in a text field.</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="Flash" version="9" class="+ topic/ph adobe-api-d/apiPlatform "/><apiPlatform description="" name="Lite" version="4" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata><asCustoms class="+ topic/metadata adobe-api-d/asCustoms "><keyword class="- topic/keyword ">TextField, TextField.length, length
</keyword></asCustoms></prolog><apiValueDetail class="- topic/body reference/refbody apiRef/apiDetail apiValue/apiValueDetail "><apiValueDef class="- topic/section reference/section apiRef/apiDef apiValue/apiValueDef "><apiProperty class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiProperty "/><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiDynamic class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiDynamic "/><apiValueAccess value="read" class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiValueAccess "/><apiValueClassifier class="- topic/xref reference/xref apiRef/apiRelation apiValue/apiValueClassifier ">int</apiValueClassifier><apiTipTexts><apiTipText class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiTipText ">The number of characters in a text field.
</apiTipText></apiTipTexts></apiValueDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
The number of characters in a text field. A character such as tab (<codeph class="+ topic/ph pr-d/codeph ">\t</codeph>) counts as one
character.
</apiDesc></apiValueDetail></apiValue><apiValue id="flash.text:TextField:maxChars:get" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiValue/apiValue "><apiName class="- topic/title reference/title apiRef/apiName ">maxChars</apiName><shortdesc class="- topic/shortdesc ">
The maximum number of characters that the text field can contain, as entered by a user.</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="Flash" version="9" class="+ topic/ph adobe-api-d/apiPlatform "/><apiPlatform description="" name="Lite" version="4" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata><asCustoms class="+ topic/metadata adobe-api-d/asCustoms "><keyword class="- topic/keyword ">TextField, TextField.maxChars, maxChars
</keyword></asCustoms></prolog><apiValueDetail class="- topic/body reference/refbody apiRef/apiDetail apiValue/apiValueDetail "><apiValueDef class="- topic/section reference/section apiRef/apiDef apiValue/apiValueDef "><apiProperty class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiProperty "/><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiDynamic class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiDynamic "/><apiValueAccess value="readwrite" class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiValueAccess "/><apiValueClassifier class="- topic/xref reference/xref apiRef/apiRelation apiValue/apiValueClassifier ">int</apiValueClassifier><apiDefaultValue>0
</apiDefaultValue><apiTipTexts><apiTipText class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiTipText ">The maximum number of characters that the text field can contain.
</apiTipText></apiTipTexts></apiValueDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
The maximum number of characters that the text field can contain, as entered by a user.
A script can insert more text than <codeph class="+ topic/ph pr-d/codeph ">maxChars</codeph> allows; the <codeph class="+ topic/ph pr-d/codeph ">maxChars</codeph> property
indicates only how much text a user can enter. If the value of this property is <codeph class="+ topic/ph pr-d/codeph ">0</codeph>,
a user can enter an unlimited amount of text.
</apiDesc></apiValueDetail></apiValue><apiValue id="flash.text:TextField:maxScrollH:get" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiValue/apiValue "><apiName class="- topic/title reference/title apiRef/apiName ">maxScrollH</apiName><shortdesc class="- topic/shortdesc ">
The maximum value of scrollH.</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="Flash" version="9" class="+ topic/ph adobe-api-d/apiPlatform "/><apiPlatform description="" name="Lite" version="4" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata><asCustoms class="+ topic/metadata adobe-api-d/asCustoms "><keyword class="- topic/keyword ">TextField, TextField.maxScrollH, maxScrollH
</keyword></asCustoms></prolog><apiValueDetail class="- topic/body reference/refbody apiRef/apiDetail apiValue/apiValueDetail "><apiValueDef class="- topic/section reference/section apiRef/apiDef apiValue/apiValueDef "><apiProperty class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiProperty "/><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiDynamic class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiDynamic "/><apiValueAccess value="read" class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiValueAccess "/><apiValueClassifier class="- topic/xref reference/xref apiRef/apiRelation apiValue/apiValueClassifier ">int</apiValueClassifier><apiTipTexts><apiTipText class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiTipText ">The maximum value of scrollH.
</apiTipText></apiTipTexts></apiValueDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
The maximum value of <codeph class="+ topic/ph pr-d/codeph ">scrollH</codeph>.
</apiDesc></apiValueDetail><related-links class="- topic/related-links "><link href="flash.text.xml#TextField/scrollH" class="- topic/link "><linktext class="- topic/linktext ">flash.text.TextField.scrollH</linktext></link></related-links></apiValue><apiValue id="flash.text:TextField:maxScrollV:get" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiValue/apiValue "><apiName class="- topic/title reference/title apiRef/apiName ">maxScrollV</apiName><shortdesc class="- topic/shortdesc ">
The maximum value of scrollV.</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="Flash" version="9" class="+ topic/ph adobe-api-d/apiPlatform "/><apiPlatform description="" name="Lite" version="4" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata><asCustoms class="+ topic/metadata adobe-api-d/asCustoms "><keyword class="- topic/keyword ">TextField, TextField.maxScrollV, maxScrollV
</keyword></asCustoms></prolog><apiValueDetail class="- topic/body reference/refbody apiRef/apiDetail apiValue/apiValueDetail "><apiValueDef class="- topic/section reference/section apiRef/apiDef apiValue/apiValueDef "><apiProperty class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiProperty "/><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiDynamic class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiDynamic "/><apiValueAccess value="read" class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiValueAccess "/><apiValueClassifier class="- topic/xref reference/xref apiRef/apiRelation apiValue/apiValueClassifier ">int</apiValueClassifier><apiTipTexts><apiTipText class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiTipText ">The maximum value of <codeph class="+ topic/ph pr-d/codeph ">scrollV</codeph>.
</apiTipText></apiTipTexts></apiValueDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
The maximum value of <codeph class="+ topic/ph pr-d/codeph ">scrollV</codeph>.
</apiDesc></apiValueDetail><related-links class="- topic/related-links "><link href="flash.text.xml#TextField/scrollV" class="- topic/link "><linktext class="- topic/linktext ">flash.text.TextField.scrollV</linktext></link></related-links></apiValue><apiValue id="flash.text:TextField:mouseWheelEnabled:get" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiValue/apiValue "><apiName class="- topic/title reference/title apiRef/apiName ">mouseWheelEnabled</apiName><shortdesc class="- topic/shortdesc ">
A Boolean value that indicates whether Flash Player automatically scrolls multiline
text fields when the user clicks a text field and rolls the mouse wheel.</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="Flash" version="9" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata><asCustoms class="+ topic/metadata adobe-api-d/asCustoms "><keyword class="- topic/keyword ">TextField, TextField.mouseWheelEnabled, mouseWheelEnabled
</keyword></asCustoms></prolog><apiValueDetail class="- topic/body reference/refbody apiRef/apiDetail apiValue/apiValueDetail "><apiValueDef class="- topic/section reference/section apiRef/apiDef apiValue/apiValueDef "><apiProperty class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiProperty "/><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiDynamic class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiDynamic "/><apiValueAccess value="readwrite" class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiValueAccess "/><apiValueClassifier class="- topic/xref reference/xref apiRef/apiRelation apiValue/apiValueClassifier ">Boolean</apiValueClassifier><apiTipTexts><apiTipText class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiTipText ">Indicates whether Flash Player automatically scrolls multiline text fields.
</apiTipText></apiTipTexts></apiValueDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
A Boolean value that indicates whether Flash Player automatically scrolls multiline
text fields when the user clicks a text field and rolls the mouse wheel.
By default, this value is <codeph class="+ topic/ph pr-d/codeph ">true</codeph>. This property is useful if you want to prevent
mouse wheel scrolling of text fields, or implement your own text field scrolling.
</apiDesc></apiValueDetail></apiValue><apiValue id="flash.text:TextField:multiline:get" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiValue/apiValue "><apiName class="- topic/title reference/title apiRef/apiName ">multiline</apiName><shortdesc class="- topic/shortdesc ">
Indicates whether field is a multiline text field.</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="Flash" version="9" class="+ topic/ph adobe-api-d/apiPlatform "/><apiPlatform description="" name="Lite" version="4" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata><asCustoms class="+ topic/metadata adobe-api-d/asCustoms "><keyword class="- topic/keyword ">TextField, TextField.multiline, multiline
</keyword></asCustoms></prolog><apiValueDetail class="- topic/body reference/refbody apiRef/apiDetail apiValue/apiValueDetail "><apiValueDef class="- topic/section reference/section apiRef/apiDef apiValue/apiValueDef "><apiProperty class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiProperty "/><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiDynamic class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiDynamic "/><apiValueAccess value="readwrite" class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiValueAccess "/><apiValueClassifier class="- topic/xref reference/xref apiRef/apiRelation apiValue/apiValueClassifier ">Boolean</apiValueClassifier><apiDefaultValue>false
</apiDefaultValue><apiTipTexts><apiTipText class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiTipText ">Indicates whether the text field is a multiline text field.
</apiTipText></apiTipTexts></apiValueDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
Indicates whether field is a multiline text field. If the value is <codeph class="+ topic/ph pr-d/codeph ">true</codeph>,
the text field is multiline; if the value is <codeph class="+ topic/ph pr-d/codeph ">false</codeph>, the text field is a single-line
text field. In a field of type <codeph class="+ topic/ph pr-d/codeph ">TextFieldType.INPUT</codeph>, the <codeph class="+ topic/ph pr-d/codeph ">multiline</codeph> value
determines whether the <codeph class="+ topic/ph pr-d/codeph ">Enter</codeph> key creates a new line (a value of <codeph class="+ topic/ph pr-d/codeph ">false</codeph>,
and the <codeph class="+ topic/ph pr-d/codeph ">Enter</codeph> key is ignored).
If you paste text into a <codeph class="+ topic/ph pr-d/codeph ">TextField</codeph> with a <codeph class="+ topic/ph pr-d/codeph ">multiline</codeph> value of <codeph class="+ topic/ph pr-d/codeph ">false</codeph>,
newlines are stripped out of the text.
</apiDesc></apiValueDetail><related-links class="- topic/related-links "><link href="flash.text.xml#TextField/numLines" class="- topic/link "><linktext class="- topic/linktext ">numLines</linktext></link></related-links></apiValue><apiValue id="flash.text:TextField:numLines:get" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiValue/apiValue "><apiName class="- topic/title reference/title apiRef/apiName ">numLines</apiName><shortdesc class="- topic/shortdesc ">
Defines the number of text lines in a multiline text field.</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="Flash" version="9" class="+ topic/ph adobe-api-d/apiPlatform "/><apiPlatform description="" name="Lite" version="4" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata><asCustoms class="+ topic/metadata adobe-api-d/asCustoms "><keyword class="- topic/keyword ">TextField, TextField.numLines, numLines
</keyword></asCustoms></prolog><apiValueDetail class="- topic/body reference/refbody apiRef/apiDetail apiValue/apiValueDetail "><apiValueDef class="- topic/section reference/section apiRef/apiDef apiValue/apiValueDef "><apiProperty class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiProperty "/><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiDynamic class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiDynamic "/><apiValueAccess value="read" class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiValueAccess "/><apiValueClassifier class="- topic/xref reference/xref apiRef/apiRelation apiValue/apiValueClassifier ">int</apiValueClassifier><apiTipTexts><apiTipText class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiTipText ">Defines the number of text lines in a multiline text field.
</apiTipText></apiTipTexts></apiValueDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
Defines the number of text lines in a multiline text field.
If <codeph class="+ topic/ph pr-d/codeph ">wordWrap</codeph> property is set to <codeph class="+ topic/ph pr-d/codeph ">true</codeph>,
the number of lines increases when text wraps.
</apiDesc></apiValueDetail><related-links class="- topic/related-links "><link href="flash.text.xml#TextField/multiline" class="- topic/link "><linktext class="- topic/linktext ">multiline</linktext></link><link href="flash.text.xml#TextField/wordWrap" class="- topic/link "><linktext class="- topic/linktext ">wordWrap</linktext></link></related-links></apiValue><apiValue id="flash.text:TextField:restrict:get" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiValue/apiValue "><apiName class="- topic/title reference/title apiRef/apiName ">restrict</apiName><shortdesc class="- topic/shortdesc ">
Indicates the set of characters that a user can enter into the text field.</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="Flash" version="9" class="+ topic/ph adobe-api-d/apiPlatform "/><apiPlatform description="" name="Lite" version="4" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata><asCustoms class="+ topic/metadata adobe-api-d/asCustoms "><keyword class="- topic/keyword ">TextField, TextField.restrict, restrict
</keyword></asCustoms></prolog><apiValueDetail class="- topic/body reference/refbody apiRef/apiDetail apiValue/apiValueDetail "><apiValueDef class="- topic/section reference/section apiRef/apiDef apiValue/apiValueDef "><apiProperty class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiProperty "/><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiDynamic class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiDynamic "/><apiValueAccess value="readwrite" class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiValueAccess "/><apiValueClassifier class="- topic/xref reference/xref apiRef/apiRelation apiValue/apiValueClassifier ">String</apiValueClassifier><apiDefaultValue>null
</apiDefaultValue><apiTipTexts><apiTipText class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiTipText ">A set of characters that a user can enter into a text field.
</apiTipText></apiTipTexts></apiValueDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
Indicates the set of characters that a user can enter into the text field. If the value of the
<codeph class="+ topic/ph pr-d/codeph ">restrict</codeph> property is <codeph class="+ topic/ph pr-d/codeph ">null</codeph>, you can enter any character. If the value of
the <codeph class="+ topic/ph pr-d/codeph ">restrict</codeph> property is an empty string, you cannot enter any character. If the value
of the <codeph class="+ topic/ph pr-d/codeph ">restrict</codeph> property is a string of characters, you can enter only characters in
the string into the text field. The string is scanned from left to right. You can specify a range by
using the hyphen (-) character. Only user interaction is restricted; a script can put any text into the
text field. <ph outputclass="flashonly" class="- topic/ph ">This property does not synchronize with the Embed font options
in the Property inspector.</ph>
<p class="- topic/p ">If the string begins with a caret (^) character, all characters are initially accepted and
succeeding characters in the string are excluded from the set of accepted characters. If the string does
not begin with a caret (^) character, no characters are initially accepted and succeeding characters in the
string are included in the set of accepted characters.</p>
<p class="- topic/p ">The following example allows only uppercase characters, spaces, and numbers to be entered into
a text field:</p>
<pre xml:space="preserve" class="- topic/pre ">
my_txt.restrict = "A-Z 0-9";
</pre>
<p class="- topic/p ">The following example includes all characters, but excludes lowercase letters:</p>
<pre xml:space="preserve" class="- topic/pre ">
my_txt.restrict = "^a-z";
</pre>
<p class="- topic/p ">You can use a backslash to enter a ^ or - verbatim. The accepted backslash sequences are \-, \^ or \\.
The backslash must be an actual character in the string, so when specified in ActionScript, a double backslash
must be used. For example, the following code includes only the dash (-) and caret (^):</p>
<pre xml:space="preserve" class="- topic/pre ">
my_txt.restrict = "\\-\\^";
</pre>
<p class="- topic/p ">The ^ can be used anywhere in the string to toggle between including characters and excluding characters.
The following code includes only uppercase letters, but excludes the uppercase letter Q:</p>
<pre xml:space="preserve" class="- topic/pre ">
my_txt.restrict = "A-Z^Q";
</pre>
<p class="- topic/p ">You can use the <codeph class="+ topic/ph pr-d/codeph ">\u</codeph> escape sequence to construct <codeph class="+ topic/ph pr-d/codeph ">restrict</codeph> strings.
The following code includes only the characters from ASCII 32 (space) to ASCII 126 (tilde).</p>
<pre xml:space="preserve" class="- topic/pre ">
my_txt.restrict = "\u0020-\u007E";
</pre>
</apiDesc></apiValueDetail></apiValue><apiValue id="flash.text:TextField:scrollH:get" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiValue/apiValue "><apiName class="- topic/title reference/title apiRef/apiName ">scrollH</apiName><shortdesc class="- topic/shortdesc ">
The current horizontal scrolling position.</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="Flash" version="9" class="+ topic/ph adobe-api-d/apiPlatform "/><apiPlatform description="" name="Lite" version="4" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata><asCustoms class="+ topic/metadata adobe-api-d/asCustoms "><keyword class="- topic/keyword ">TextField, TextField.scrollH, scrollH
</keyword></asCustoms></prolog><apiValueDetail class="- topic/body reference/refbody apiRef/apiDetail apiValue/apiValueDetail "><apiValueDef class="- topic/section reference/section apiRef/apiDef apiValue/apiValueDef "><apiProperty class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiProperty "/><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiDynamic class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiDynamic "/><apiValueAccess value="readwrite" class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiValueAccess "/><apiValueClassifier class="- topic/xref reference/xref apiRef/apiRelation apiValue/apiValueClassifier ">int</apiValueClassifier><apiTipTexts><apiTipText class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiTipText ">The current horizontal scrolling position.
</apiTipText></apiTipTexts></apiValueDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
The current horizontal scrolling position. If the <codeph class="+ topic/ph pr-d/codeph ">scrollH</codeph> property is 0, the text
is not horizontally scrolled. This property value is an integer that represents the horizontal
position in pixels.
<p class="- topic/p ">The units of horizontal scrolling are pixels, whereas the units of vertical scrolling are lines.
Horizontal scrolling is measured in pixels because most fonts you typically use are proportionally
spaced; that is, the characters can have different widths. Flash Player performs vertical scrolling by
line because users usually want to see a complete line of text rather than a
partial line. Even if a line uses multiple fonts, the height of the line adjusts to fit
the largest font in use.</p>
<p class="- topic/p "><b class="+ topic/ph hi-d/b ">Note: </b>The <codeph class="+ topic/ph pr-d/codeph ">scrollH</codeph> property is zero-based, not 1-based like
the <codeph class="+ topic/ph pr-d/codeph ">scrollV</codeph> vertical scrolling property.</p>
</apiDesc></apiValueDetail><related-links class="- topic/related-links "><link href="flash.text.xml#TextField/maxScrollH" class="- topic/link "><linktext class="- topic/linktext ">flash.text.TextField.maxScrollH</linktext></link><link href="flash.text.xml#TextField/scrollV" class="- topic/link "><linktext class="- topic/linktext ">flash.text.TextField.scrollV</linktext></link></related-links></apiValue><apiValue id="flash.text:TextField:scrollV:get" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiValue/apiValue "><apiName class="- topic/title reference/title apiRef/apiName ">scrollV</apiName><shortdesc class="- topic/shortdesc ">
The vertical position of text in a text field.</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="Flash" version="9" class="+ topic/ph adobe-api-d/apiPlatform "/><apiPlatform description="" name="Lite" version="4" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata><asCustoms class="+ topic/metadata adobe-api-d/asCustoms "><keyword class="- topic/keyword ">TextField, TextField.scrollV, scroll
</keyword></asCustoms></prolog><apiValueDetail class="- topic/body reference/refbody apiRef/apiDetail apiValue/apiValueDetail "><apiValueDef class="- topic/section reference/section apiRef/apiDef apiValue/apiValueDef "><apiProperty class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiProperty "/><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiDynamic class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiDynamic "/><apiValueAccess value="readwrite" class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiValueAccess "/><apiValueClassifier class="- topic/xref reference/xref apiRef/apiRelation apiValue/apiValueClassifier ">int</apiValueClassifier><apiTipTexts><apiTipText class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiTipText ">The vertical position of text in a text field.
</apiTipText></apiTipTexts></apiValueDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
The vertical position of text in a text field. The <codeph class="+ topic/ph pr-d/codeph ">scrollV</codeph> property is useful for
directing users to a specific paragraph in a long passage, or creating scrolling text fields.
<p class="- topic/p ">The units of vertical scrolling are lines, whereas the units of horizontal scrolling are pixels.
If the first line displayed is the first line in the text field, scrollV is set to 1 (not 0).
Horizontal scrolling is measured in pixels because most fonts are proportionally
spaced; that is, the characters can have different widths. Flash performs vertical scrolling by line
because users usually want to see a complete line of text rather than a partial line.
Even if there are multiple fonts on a line, the height of the line adjusts to fit the largest font in
use.</p>
</apiDesc></apiValueDetail><related-links class="- topic/related-links "><link href="flash.text.xml#TextField/scrollH" class="- topic/link "><linktext class="- topic/linktext ">flash.text.TextField.scrollH</linktext></link><link href="flash.text.xml#TextField/maxScrollV" class="- topic/link "><linktext class="- topic/linktext ">flash.text.TextField.maxScrollV</linktext></link></related-links></apiValue><apiValue id="flash.text:TextField:selectable:get" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiValue/apiValue "><apiName class="- topic/title reference/title apiRef/apiName ">selectable</apiName><shortdesc class="- topic/shortdesc ">
A Boolean value that indicates whether the text field is selectable.</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="Flash" version="9" class="+ topic/ph adobe-api-d/apiPlatform "/><apiPlatform description="" name="Lite" version="4" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata><asCustoms class="+ topic/metadata adobe-api-d/asCustoms "><keyword class="- topic/keyword ">TextField, TextField.selectable, selectable
</keyword></asCustoms></prolog><apiValueDetail class="- topic/body reference/refbody apiRef/apiDetail apiValue/apiValueDetail "><apiValueDef class="- topic/section reference/section apiRef/apiDef apiValue/apiValueDef "><apiProperty class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiProperty "/><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiDynamic class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiDynamic "/><apiValueAccess value="readwrite" class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiValueAccess "/><apiValueClassifier class="- topic/xref reference/xref apiRef/apiRelation apiValue/apiValueClassifier ">Boolean</apiValueClassifier><apiDefaultValue>true
</apiDefaultValue><apiTipTexts><apiTipText class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiTipText ">Indicates whether the text field is selectable.
</apiTipText></apiTipTexts></apiValueDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
A Boolean value that indicates whether the text field is selectable. The value <codeph class="+ topic/ph pr-d/codeph ">true</codeph>
indicates that the text is selectable. The <codeph class="+ topic/ph pr-d/codeph ">selectable</codeph> property controls whether
a text field is selectable, not whether a text field is editable. A dynamic text field can
be selectable even if it is not editable. If a dynamic text field is not selectable, the user
cannot select its text.
<p class="- topic/p ">If <codeph class="+ topic/ph pr-d/codeph ">selectable</codeph> is set to <codeph class="+ topic/ph pr-d/codeph ">false</codeph>, the text in the text field does not
respond to selection commands from the mouse or keyboard, and the text cannot be copied with the
Copy command. If <codeph class="+ topic/ph pr-d/codeph ">selectable</codeph> is set to <codeph class="+ topic/ph pr-d/codeph ">true</codeph>, the text in the text field
can be selected with the mouse or keyboard, and the text can be copied with the Copy command.
You can select text this way even if the text field is a dynamic text field instead of an input text field. </p>
</apiDesc><example conref="examples\TextField_selectable.as" class="- topic/example "> The following example creates two dynamic text fields: one text field with the <codeph class="+ topic/ph pr-d/codeph ">selectable</codeph>
property set to <codeph class="+ topic/ph pr-d/codeph ">true</codeph>, and the other text field with the <codeph class="+ topic/ph pr-d/codeph ">selectable</codeph> property set to <codeph class="+ topic/ph pr-d/codeph ">false</codeph>.
When you use this example, try to select the text in these fields with the mouse or the keyboard.
<codeblock xml:space="preserve" class="+ topic/pre pr-d/codeblock ">
package
{
import flash.display.Sprite;
import flash.text.TextField;
import flash.text.TextFieldAutoSize;
public class selectableExample extends Sprite
{
public function selectableExample()
{
var tf1:TextField = createCustomTextField(10, 10);
tf1.text="This text can be selected";
tf1.selectable=true;
var tf2:TextField = createCustomTextField(10, 30);
tf2.text="This text cannot be selected";
tf2.selectable=false;
}
private function createCustomTextField(x:Number, y:Number):TextField
{
var result:TextField = new TextField();
result.x = x;
result.y = y;
result.autoSize=TextFieldAutoSize.LEFT;
addChild(result);
return result;
}
}
}
</codeblock></example></apiValueDetail><related-links class="- topic/related-links "><link href="flash.text.xml#TextField/setSelection()" class="- topic/link "><linktext class="- topic/linktext ">setSelection()</linktext></link><link href="flash.text.xml#TextField/selectionBeginIndex" class="- topic/link "><linktext class="- topic/linktext ">selectionBeginIndex</linktext></link><link href="flash.text.xml#TextField/selectionEndIndex" class="- topic/link "><linktext class="- topic/linktext ">selectionEndIndex</linktext></link><link href="flash.text.xml#TextField/setSelection()" class="- topic/link "><linktext class="- topic/linktext ">setSelection()</linktext></link><link href="flash.text.xml#TextField/caretIndex" class="- topic/link "><linktext class="- topic/linktext ">caretIndex</linktext></link></related-links></apiValue><apiValue id="flash.text:TextField:selectionBeginIndex:get" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiValue/apiValue "><apiName class="- topic/title reference/title apiRef/apiName ">selectionBeginIndex</apiName><shortdesc class="- topic/shortdesc ">
The zero-based character index value of the first character in the current selection.</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="Flash" version="9" class="+ topic/ph adobe-api-d/apiPlatform "/><apiPlatform description="" name="Lite" version="4" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata></prolog><apiValueDetail class="- topic/body reference/refbody apiRef/apiDetail apiValue/apiValueDetail "><apiValueDef class="- topic/section reference/section apiRef/apiDef apiValue/apiValueDef "><apiProperty class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiProperty "/><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiDynamic class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiDynamic "/><apiValueAccess value="read" class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiValueAccess "/><apiValueClassifier class="- topic/xref reference/xref apiRef/apiRelation apiValue/apiValueClassifier ">int</apiValueClassifier><apiTipTexts><apiTipText class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiTipText ">The zero-based index value of the first character in the selection.
</apiTipText></apiTipTexts></apiValueDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
The zero-based character index value of the first character in the current selection.
For example, the first character is 0, the second character is 1, and so on. If no
text is selected, this property is the value of <codeph class="+ topic/ph pr-d/codeph ">caretIndex</codeph>.
</apiDesc><example conref="examples\TextField_caretIndex.as" class="- topic/example "> In this example, a TextField instance is created and populated with text.
An event listener is assigned so that when the user clicks on the TextField, the
<codeph class="+ topic/ph pr-d/codeph ">printCursorPosition</codeph> method is called. In that case, the values of the
<codeph class="+ topic/ph pr-d/codeph ">caretIndex</codeph>, <codeph class="+ topic/ph pr-d/codeph ">selectionBeginIndex</codeph>, and
<codeph class="+ topic/ph pr-d/codeph ">selectionEndIndex</codeph> properties are output.
<p class="- topic/p ">Run this example and try clicking in the TextField to select text. Then click in the field without
selecting text. When you click in the text without making a selection, the
<codeph class="+ topic/ph pr-d/codeph ">caretIndex</codeph> property indicates where the insertion point occurs, and the <codeph class="+ topic/ph pr-d/codeph ">selectionBeginIndex</codeph>
and <codeph class="+ topic/ph pr-d/codeph ">selectionEndIndex</codeph> properties equal the <codeph class="+ topic/ph pr-d/codeph ">caretIndex</codeph> property value.</p>
<codeblock xml:space="preserve" class="+ topic/pre pr-d/codeblock ">
package {
import flash.display.Sprite;
import flash.events.MouseEvent;
import flash.text.TextField;
import flash.text.TextFieldType;
public class TextField_caretIndex extends Sprite {
public function TextField_caretIndex() {
var tf:TextField = createCustomTextField(10, 10, 100, 100);
tf.wordWrap = true;
tf.type = TextFieldType.INPUT;
tf.text = "Click in this text field. Compare the difference between clicking without selecting versus clicking and selecting text.";
tf.addEventListener(MouseEvent.CLICK, printCursorPosition);
}
private function printCursorPosition(event:MouseEvent):void {
var tf:TextField = TextField(event.target);
trace("caretIndex:", tf.caretIndex);
trace("selectionBeginIndex:", tf.selectionBeginIndex);
trace("selectionEndIndex:", tf.selectionEndIndex);
}
private function createCustomTextField(x:Number, y:Number, width:Number, height:Number):TextField {
var result:TextField = new TextField();
result.x = x;
result.y = y;
result.width = width;
result.height = height;
addChild(result);
return result;
}
}
}
</codeblock></example></apiValueDetail><related-links class="- topic/related-links "><link href="flash.text.xml#TextField/selectable" class="- topic/link "><linktext class="- topic/linktext ">selectable</linktext></link><link href="flash.text.xml#TextField/selectionEndIndex" class="- topic/link "><linktext class="- topic/linktext ">selectionEndIndex</linktext></link><link href="flash.text.xml#TextField/setSelection()" class="- topic/link "><linktext class="- topic/linktext ">setSelection()</linktext></link><link href="flash.text.xml#TextField/caretIndex" class="- topic/link "><linktext class="- topic/linktext ">caretIndex</linktext></link></related-links></apiValue><apiValue id="flash.text:TextField:selectionEndIndex:get" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiValue/apiValue "><apiName class="- topic/title reference/title apiRef/apiName ">selectionEndIndex</apiName><shortdesc class="- topic/shortdesc ">
The zero-based character index value of the last character in the current selection.</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="Flash" version="9" class="+ topic/ph adobe-api-d/apiPlatform "/><apiPlatform description="" name="Lite" version="4" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata></prolog><apiValueDetail class="- topic/body reference/refbody apiRef/apiDetail apiValue/apiValueDetail "><apiValueDef class="- topic/section reference/section apiRef/apiDef apiValue/apiValueDef "><apiProperty class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiProperty "/><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiDynamic class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiDynamic "/><apiValueAccess value="read" class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiValueAccess "/><apiValueClassifier class="- topic/xref reference/xref apiRef/apiRelation apiValue/apiValueClassifier ">int</apiValueClassifier><apiTipTexts><apiTipText class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiTipText ">The zero-based index value of the last character in the selection.
</apiTipText></apiTipTexts></apiValueDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
The zero-based character index value of the last character in the current selection.
For example, the first character is 0, the second character is 1, and so on. If no
text is selected, this property is the value of <codeph class="+ topic/ph pr-d/codeph ">caretIndex</codeph>.
</apiDesc><example conref="examples\TextField_caretIndex.as" class="- topic/example "> In this example, a TextField instance is created and populated with text.
An event listener is assigned so that when the user clicks on the TextField, the
<codeph class="+ topic/ph pr-d/codeph ">printCursorPosition</codeph> method is called. In that case, the values of the
<codeph class="+ topic/ph pr-d/codeph ">caretIndex</codeph>, <codeph class="+ topic/ph pr-d/codeph ">selectionBeginIndex</codeph>, and
<codeph class="+ topic/ph pr-d/codeph ">selectionEndIndex</codeph> properties are output.
<p class="- topic/p ">Run this example and try clicking in the TextField to select text. Then click in the field without
selecting text. When you click in the text without making a selection, the
<codeph class="+ topic/ph pr-d/codeph ">caretIndex</codeph> property indicates where the insertion point occurs, and the <codeph class="+ topic/ph pr-d/codeph ">selectionBeginIndex</codeph>
and <codeph class="+ topic/ph pr-d/codeph ">selectionEndIndex</codeph> properties equal the <codeph class="+ topic/ph pr-d/codeph ">caretIndex</codeph> property value.</p>
<codeblock xml:space="preserve" class="+ topic/pre pr-d/codeblock ">
package {
import flash.display.Sprite;
import flash.events.MouseEvent;
import flash.text.TextField;
import flash.text.TextFieldType;
public class TextField_caretIndex extends Sprite {
public function TextField_caretIndex() {
var tf:TextField = createCustomTextField(10, 10, 100, 100);
tf.wordWrap = true;
tf.type = TextFieldType.INPUT;
tf.text = "Click in this text field. Compare the difference between clicking without selecting versus clicking and selecting text.";
tf.addEventListener(MouseEvent.CLICK, printCursorPosition);
}
private function printCursorPosition(event:MouseEvent):void {
var tf:TextField = TextField(event.target);
trace("caretIndex:", tf.caretIndex);
trace("selectionBeginIndex:", tf.selectionBeginIndex);
trace("selectionEndIndex:", tf.selectionEndIndex);
}
private function createCustomTextField(x:Number, y:Number, width:Number, height:Number):TextField {
var result:TextField = new TextField();
result.x = x;
result.y = y;
result.width = width;
result.height = height;
addChild(result);
return result;
}
}
}
</codeblock></example></apiValueDetail><related-links class="- topic/related-links "><link href="flash.text.xml#TextField/selectable" class="- topic/link "><linktext class="- topic/linktext ">selectable</linktext></link><link href="flash.text.xml#TextField/selectionBeginIndex" class="- topic/link "><linktext class="- topic/linktext ">selectionBeginIndex</linktext></link><link href="flash.text.xml#TextField/setSelection()" class="- topic/link "><linktext class="- topic/linktext ">setSelection()</linktext></link><link href="flash.text.xml#TextField/caretIndex" class="- topic/link "><linktext class="- topic/linktext ">caretIndex</linktext></link></related-links></apiValue><apiValue id="flash.text:TextField:sharpness:get" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiValue/apiValue "><apiName class="- topic/title reference/title apiRef/apiName ">sharpness</apiName><shortdesc class="- topic/shortdesc ">
The sharpness of the glyph edges in this text field.</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="Flash" version="9" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata><asCustoms class="+ topic/metadata adobe-api-d/asCustoms "><oldexample>This example creates three text fields with
<code>sharpness</code> set to <code>400</code>, <code>0</code>, and <code>-400</code>.
It assumes that you have a font
embedded in the Library with the linkage identifier set to <code>"Times-12"</code>.
To embed the font, follow these steps:
<ol class="- topic/ol "><li class="- topic/li ">Open your Library</li><li class="- topic/li ">Click the Library options menu in the upper right corner of the Library</li><li class="- topic/li ">Select "New Font" from the dropdown list</li><li class="- topic/li ">Name the font "Times-12"</li><li class="- topic/li ">Select "Times New Roman" from the font dropdown list</li><li class="- topic/li ">Press the "OK" button</li><li class="- topic/li ">Right-click on the newly created font and select "Linkage..."</li><li class="- topic/li ">Check the "Export for ActionScript" box</li><li class="- topic/li ">Accept the default identifier "Times-12" by pressing the "OK" button</li></ol>
<listing version="2.0">
var my_format:TextFormat = new TextFormat();
my_format.font = "Times-12";
var my_text1:TextField = this.createTextField("my_text1", this.getNextHighestDepth(), 10, 10, 400, 100);
my_text1.text = "This text has sharpness set to 400."
my_text1.embedFonts = true;
my_text1.antiAliasType = "advanced";
my_text1.gridFitType = "pixel";
my_text1.sharpness = 400;
my_text1.setTextFormat(my_format);
var my_text2:TextField = this.createTextField("my_text2", this.getNextHighestDepth(), 10, 40, 400, 100);
my_text2.text = "This text has sharpness set to 0."
my_text2.embedFonts = true;
my_text2.antiAliasType = "advanced";
my_text2.gridFitType = "pixel";
my_text2.sharpness = 0;
my_text2.setTextFormat(my_format);
var my_text3:TextField = this.createTextField("my_text3", this.getNextHighestDepth(), 10, 70, 400, 100);
my_text3.text = "This text has sharpness set to -400."
my_text3.embedFonts = true;
my_text3.antiAliasType = "advanced";
my_text3.gridFitType = "pixel";
my_text3.sharpness = -400;
my_text3.setTextFormat(my_format);
</listing>
</oldexample></asCustoms></prolog><apiValueDetail class="- topic/body reference/refbody apiRef/apiDetail apiValue/apiValueDetail "><apiValueDef class="- topic/section reference/section apiRef/apiDef apiValue/apiValueDef "><apiProperty class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiProperty "/><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiDynamic class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiDynamic "/><apiValueAccess value="readwrite" class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiValueAccess "/><apiValueClassifier class="- topic/xref reference/xref apiRef/apiRelation apiValue/apiValueClassifier ">Number</apiValueClassifier><apiDefaultValue>0
</apiDefaultValue><apiTipTexts><apiTipText class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiTipText ">The sharpness of the glyph edges.
</apiTipText></apiTipTexts></apiValueDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
The sharpness of the glyph edges in this text field. This property applies
only if the <codeph class="+ topic/ph pr-d/codeph ">flash.text.AntiAliasType</codeph> property of the text field is set to
<codeph class="+ topic/ph pr-d/codeph ">flash.text.AntiAliasType.ADVANCED</codeph>. The range for
<codeph class="+ topic/ph pr-d/codeph ">sharpness</codeph> is a number from -400 to 400. If you attempt to set
<codeph class="+ topic/ph pr-d/codeph ">sharpness</codeph> to a value outside that range, Flash sets the property to
the nearest value in the range (either -400 or 400).
</apiDesc><example conref="examples\TextField_sharpness.as" class="- topic/example "> The following example shows the effect of changing the <codeph class="+ topic/ph pr-d/codeph ">sharpness</codeph>
property for a TextField object. You need to embed the font, and set the
<codeph class="+ topic/ph pr-d/codeph ">antiAliasType</codeph> property to <codeph class="+ topic/ph pr-d/codeph ">ADVANCED</codeph>.
<codeblock xml:space="preserve" class="+ topic/pre pr-d/codeblock ">
package
{
import flash.display.Sprite;
import flash.text.TextField;
import flash.text.TextFieldAutoSize;
import flash.text.AntiAliasType;
import flash.text.GridFitType;
import flash.text.TextFormat;
public class sharpnessExample extends Sprite
{
public function sharpnessExample()
{
var format1:TextFormat = new TextFormat();
format1.font="Arial";
format1.size=24;
var lTxt:String = "The quick brown fox";
var tf1:TextField=createCustomTextField(0,lTxt,format1,-400);
var tf2:TextField=createCustomTextField(30,lTxt,format1,0);
var tf3:TextField=createCustomTextField(60,lTxt,format1,400);
}
private function createCustomTextField(y:Number,fldTxt:String,format:TextFormat,fldSharpness:Number):TextField
{
var result:TextField = new TextField();
result.y=y;
result.text=fldTxt;
result.embedFonts=true;
result.autoSize=TextFieldAutoSize.LEFT;
result.antiAliasType=AntiAliasType.ADVANCED;
result.gridFitType=GridFitType.PIXEL;
result.sharpness=fldSharpness;
result..setTextFormat(format);
addChild(result);
return result;
}
}
}
</codeblock></example></apiValueDetail><related-links class="- topic/related-links "><link href="flash.text.xml#TextField/antiAliasType" class="- topic/link "><linktext class="- topic/linktext ">flash.text.TextField.antiAliasType</linktext></link><link href="flash.text.xml#AntiAliasType" class="- topic/link "><linktext class="- topic/linktext ">flash.text.AntiAliasType</linktext></link></related-links></apiValue><apiValue id="flash.text:TextField:styleSheet:get" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiValue/apiValue "><apiName class="- topic/title reference/title apiRef/apiName ">styleSheet</apiName><shortdesc class="- topic/shortdesc ">
Attaches a style sheet to the text field.</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="Flash" version="9" class="+ topic/ph adobe-api-d/apiPlatform "/><apiPlatform description="" name="Lite" version="4" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata><asCustoms class="+ topic/metadata adobe-api-d/asCustoms "><keyword class="- topic/keyword ">TextField, StyleSheet, style sheet, stylesheet
</keyword></asCustoms></prolog><apiValueDetail class="- topic/body reference/refbody apiRef/apiDetail apiValue/apiValueDetail "><apiValueDef class="- topic/section reference/section apiRef/apiDef apiValue/apiValueDef "><apiProperty class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiProperty "/><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiDynamic class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiDynamic "/><apiValueAccess value="readwrite" class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiValueAccess "/><apiValueClassifier class="- topic/xref reference/xref apiRef/apiRelation apiValue/apiValueClassifier ">flash.text:StyleSheet</apiValueClassifier><apiTipTexts><apiTipText class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiTipText ">Attaches a style sheet to the text field.
</apiTipText></apiTipTexts></apiValueDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
Attaches a style sheet to the text field. For information on creating style sheets, see the StyleSheet class
and the <i class="+ topic/ph hi-d/i ">ActionScript 3.0 Developer's Guide</i>.
<p class="- topic/p ">You can change the style sheet associated with a text field at any time. If you change
the style sheet in use, the text field is redrawn with the new style sheet.
You can set the style sheet to <codeph class="+ topic/ph pr-d/codeph ">null</codeph> or <codeph class="+ topic/ph pr-d/codeph ">undefined</codeph>
to remove the style sheet. If the style sheet in use is removed, the text field is redrawn without a style sheet. </p>
<p class="- topic/p "><b class="+ topic/ph hi-d/b ">Note:</b> If the style sheet is removed, the contents of both <codeph class="+ topic/ph pr-d/codeph ">TextField.text</codeph> and <codeph class="+ topic/ph pr-d/codeph ">
TextField.htmlText</codeph> change to incorporate the formatting previously applied by the style sheet. To preserve
the original <codeph class="+ topic/ph pr-d/codeph ">TextField.htmlText</codeph> contents without the formatting, save the value in a variable before
removing the style sheet.</p>
</apiDesc><example conref="examples\TextField_styleSheet.as" class="- topic/example "> The following example defines a simple StyleSheet object
and assigns it to a text field with HTML content. Set the
<codeph class="+ topic/ph pr-d/codeph ">stylesheet</codeph> property before setting the content.
<codeblock xml:space="preserve" class="+ topic/pre pr-d/codeblock ">
package {
import flash.display.Sprite;
import flash.text.TextField;
import flash.text.StyleSheet;
public class TextStylesheetExample extends Sprite {
var myLabel:TextField = new TextField();
var labelText:String = "Hello world.";
var newStyle:StyleSheet = new StyleSheet();
public function TextStylesheetExample()
{
var styleObj:Object = new Object();
styleObj.fontWeight = "bold";
styleObj.color = "#660066";
newStyle.setStyle(".defStyle", styleObj);
myLabel.styleSheet=newStyle;
myLabel.htmlText=labelText;
addChild(myLabel);
}
}
}
</codeblock></example></apiValueDetail><related-links class="- topic/related-links "><link href="flash.text.xml#StyleSheet" class="- topic/link "><linktext class="- topic/linktext ">flash.text.StyleSheet</linktext></link></related-links></apiValue><apiValue id="flash.text:TextField:textColor:get" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiValue/apiValue "><apiName class="- topic/title reference/title apiRef/apiName ">textColor</apiName><shortdesc class="- topic/shortdesc ">
The color of the text in a text field, in hexadecimal format.</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="Flash" version="9" class="+ topic/ph adobe-api-d/apiPlatform "/><apiPlatform description="" name="Lite" version="4" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata><asCustoms class="+ topic/metadata adobe-api-d/asCustoms "><keyword class="- topic/keyword ">TextField, TextField.textColor, textColor
</keyword></asCustoms></prolog><apiValueDetail class="- topic/body reference/refbody apiRef/apiDetail apiValue/apiValueDetail "><apiValueDef class="- topic/section reference/section apiRef/apiDef apiValue/apiValueDef "><apiProperty class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiProperty "/><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiDynamic class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiDynamic "/><apiValueAccess value="readwrite" class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiValueAccess "/><apiValueClassifier class="- topic/xref reference/xref apiRef/apiRelation apiValue/apiValueClassifier ">uint</apiValueClassifier><apiDefaultValue>0 (0x000000)
</apiDefaultValue><apiTipTexts><apiTipText class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiTipText ">The color of the text in a text field, in hexadecimal format.
</apiTipText></apiTipTexts></apiValueDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
The color of the text in a text field, in hexadecimal format.
The hexadecimal color system uses six digits to represent
color values. Each digit has 16 possible values or characters. The characters range from
0-9 and then A-F. For example, black is <codeph class="+ topic/ph pr-d/codeph ">0x000000</codeph>; white is
<codeph class="+ topic/ph pr-d/codeph ">0xFFFFFF</codeph>.
</apiDesc><example conref="examples\TextField_textColor.as" class="- topic/example "> The following ActionScript creates a TextField object and changes its
<codeph class="+ topic/ph pr-d/codeph ">textColor</codeph> property to red (<codeph class="+ topic/ph pr-d/codeph ">0xFF0000</codeph>).
<codeblock xml:space="preserve" class="+ topic/pre pr-d/codeblock ">
package {
import flash.display.Sprite;
import flash.text.TextField;
public class TextField_textColor extends Sprite {
public function TextField_textColor() {
var tf:TextField = createCustomTextField(10, 10, 100, 300);
tf.text = "This will be red text";
tf.textColor = 0xFF0000;
}
private function createCustomTextField(x:Number, y:Number, width:Number, height:Number):TextField {
var result:TextField = new TextField();
result.x = x;
result.y = y;
result.width = width;
result.height = height;
addChild(result);
return result;
}
}
}
</codeblock></example></apiValueDetail></apiValue><apiValue id="flash.text:TextField:textHeight:get" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiValue/apiValue "><apiName class="- topic/title reference/title apiRef/apiName ">textHeight</apiName><shortdesc class="- topic/shortdesc ">
The height of the text in pixels.</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="Flash" version="9" class="+ topic/ph adobe-api-d/apiPlatform "/><apiPlatform description="" name="Lite" version="4" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata><asCustoms class="+ topic/metadata adobe-api-d/asCustoms "><keyword class="- topic/keyword ">TextField, TextField.textHeight, textHeight
</keyword></asCustoms></prolog><apiValueDetail class="- topic/body reference/refbody apiRef/apiDetail apiValue/apiValueDetail "><apiValueDef class="- topic/section reference/section apiRef/apiDef apiValue/apiValueDef "><apiProperty class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiProperty "/><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiDynamic class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiDynamic "/><apiValueAccess value="read" class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiValueAccess "/><apiValueClassifier class="- topic/xref reference/xref apiRef/apiRelation apiValue/apiValueClassifier ">Number</apiValueClassifier><apiTipTexts><apiTipText class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiTipText ">The height of the text in pixels.
</apiTipText></apiTipTexts></apiValueDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
The height of the text in pixels.
</apiDesc><example conref="examples\TextField_textHeight.as" class="- topic/example "> The following example creates a TextField object and assigns text to it.
The <codeph class="+ topic/ph pr-d/codeph ">trace</codeph> statements display the values of the <codeph class="+ topic/ph pr-d/codeph ">textWidth</codeph> and
<codeph class="+ topic/ph pr-d/codeph ">textHeight</codeph> properties. For comparison, the <codeph class="+ topic/ph pr-d/codeph ">width</codeph> and <codeph class="+ topic/ph pr-d/codeph ">height</codeph>
properties are also displayed. (Note that the values you see for <codeph class="+ topic/ph pr-d/codeph ">textHeight</codeph> and <codeph class="+ topic/ph pr-d/codeph ">textWidth</codeph> might
vary depending on the font that is used on your machine).
<codeblock xml:space="preserve" class="+ topic/pre pr-d/codeblock ">
package {
import flash.display.Sprite;
import flash.text.TextField;
public class TextField_textHeight extends Sprite {
public function TextField_textHeight() {
var tf:TextField = createCustomTextField(10, 10, 100, 150);
tf.text = "Sample text";
trace("textWidth: " + tf.textWidth); // textWidth: 55.75
trace("textHeight: " + tf.textHeight); // textHeight: 13.450000000000001
trace("width: " + tf.width); // width: 100
trace("height: " + tf.height); // height: 150
}
private function createCustomTextField(x:Number, y:Number, width:Number, height:Number):TextField {
var result:TextField = new TextField();
result.x = x;
result.y = y;
result.width = width;
result.height = height;
result.border = true;
result.background = true;
addChild(result);
return result;
}
}
}
</codeblock></example></apiValueDetail><related-links class="- topic/related-links "><link href="flash.text.xml#TextField/textWidth" class="- topic/link "><linktext class="- topic/linktext ">flash.text.TextField.textWidth</linktext></link></related-links></apiValue><apiValue id="flash.text:TextField:textInteractionMode:get" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiValue/apiValue "><apiName class="- topic/title reference/title apiRef/apiName ">textInteractionMode</apiName><shortdesc class="- topic/shortdesc ">
The interaction mode property, Default value is TextInteractionMode.NORMAL.</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="Flash" version="11" class="+ topic/ph adobe-api-d/apiPlatform "/><apiPlatform description="" name="Lite" version="4" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata></prolog><apiValueDetail class="- topic/body reference/refbody apiRef/apiDetail apiValue/apiValueDetail "><apiValueDef class="- topic/section reference/section apiRef/apiDef apiValue/apiValueDef "><apiProperty class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiProperty "/><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiDynamic class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiDynamic "/><apiValueAccess value="read" class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiValueAccess "/><apiValueClassifier class="- topic/xref reference/xref apiRef/apiRelation apiValue/apiValueClassifier ">String</apiValueClassifier></apiValueDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
The interaction mode property, Default value is TextInteractionMode.NORMAL.
On mobile platforms, the normal mode implies that the text can be scrolled but not selected.
One can switch to the selectable mode through the in-built context menu on the text field.
On Desktop, the normal mode implies that the text is in scrollable as well as selection mode.
</apiDesc></apiValueDetail></apiValue><apiValue id="flash.text:TextField:textWidth:get" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiValue/apiValue "><apiName class="- topic/title reference/title apiRef/apiName ">textWidth</apiName><shortdesc class="- topic/shortdesc ">
The width of the text in pixels.</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="Flash" version="9" class="+ topic/ph adobe-api-d/apiPlatform "/><apiPlatform description="" name="Lite" version="4" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata><asCustoms class="+ topic/metadata adobe-api-d/asCustoms "><keyword class="- topic/keyword ">TextField, TextField.textWidth, textWidth
</keyword></asCustoms></prolog><apiValueDetail class="- topic/body reference/refbody apiRef/apiDetail apiValue/apiValueDetail "><apiValueDef class="- topic/section reference/section apiRef/apiDef apiValue/apiValueDef "><apiProperty class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiProperty "/><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiDynamic class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiDynamic "/><apiValueAccess value="read" class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiValueAccess "/><apiValueClassifier class="- topic/xref reference/xref apiRef/apiRelation apiValue/apiValueClassifier ">Number</apiValueClassifier><apiTipTexts><apiTipText class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiTipText ">The width of the text in pixels.
</apiTipText></apiTipTexts></apiValueDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
The width of the text in pixels.
</apiDesc><example conref="examples\TextField_textHeight.as" class="- topic/example "> The following example creates a TextField object and assigns text to it.
The <codeph class="+ topic/ph pr-d/codeph ">trace</codeph> statements display the values of the <codeph class="+ topic/ph pr-d/codeph ">textWidth</codeph> and
<codeph class="+ topic/ph pr-d/codeph ">textHeight</codeph> properties. For comparison, the <codeph class="+ topic/ph pr-d/codeph ">width</codeph> and <codeph class="+ topic/ph pr-d/codeph ">height</codeph>
properties are also displayed. (Note that the values you see for <codeph class="+ topic/ph pr-d/codeph ">textHeight</codeph> and <codeph class="+ topic/ph pr-d/codeph ">textWidth</codeph> might
vary depending on the font that is used on your machine).
<codeblock xml:space="preserve" class="+ topic/pre pr-d/codeblock ">
package {
import flash.display.Sprite;
import flash.text.TextField;
public class TextField_textHeight extends Sprite {
public function TextField_textHeight() {
var tf:TextField = createCustomTextField(10, 10, 100, 150);
tf.text = "Sample text";
trace("textWidth: " + tf.textWidth); // textWidth: 55.75
trace("textHeight: " + tf.textHeight); // textHeight: 13.450000000000001
trace("width: " + tf.width); // width: 100
trace("height: " + tf.height); // height: 150
}
private function createCustomTextField(x:Number, y:Number, width:Number, height:Number):TextField {
var result:TextField = new TextField();
result.x = x;
result.y = y;
result.width = width;
result.height = height;
result.border = true;
result.background = true;
addChild(result);
return result;
}
}
}
</codeblock></example></apiValueDetail><related-links class="- topic/related-links "><link href="flash.text.xml#TextField/textHeight" class="- topic/link "><linktext class="- topic/linktext ">flash.text.TextField.textHeight</linktext></link></related-links></apiValue><apiValue id="flash.text:TextField:text:get" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiValue/apiValue "><apiName class="- topic/title reference/title apiRef/apiName ">text</apiName><shortdesc class="- topic/shortdesc ">
A string that is the current text in the text field.</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="Flash" version="9" class="+ topic/ph adobe-api-d/apiPlatform "/><apiPlatform description="" name="Lite" version="4" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata><asCustoms class="+ topic/metadata adobe-api-d/asCustoms "><keyword class="- topic/keyword ">TextField, TextField.text, text
</keyword></asCustoms></prolog><apiValueDetail class="- topic/body reference/refbody apiRef/apiDetail apiValue/apiValueDetail "><apiValueDef class="- topic/section reference/section apiRef/apiDef apiValue/apiValueDef "><apiProperty class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiProperty "/><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiDynamic class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiDynamic "/><apiValueAccess value="readwrite" class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiValueAccess "/><apiValueClassifier class="- topic/xref reference/xref apiRef/apiRelation apiValue/apiValueClassifier ">String</apiValueClassifier><apiTipTexts><apiTipText class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiTipText ">A string that is the current text in the text field.
</apiTipText></apiTipTexts></apiValueDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
A string that is the current text in the text field. Lines are separated by the carriage
return character (<codeph class="+ topic/ph pr-d/codeph ">'\r'</codeph>, ASCII 13). This property contains unformatted text in the text
field, without HTML tags.
<p class="- topic/p ">To get the text in HTML form, use the <codeph class="+ topic/ph pr-d/codeph ">htmlText</codeph> property.</p>
</apiDesc><example conref="examples\TextField_text.as" class="- topic/example "> The following example creates a TextField called <codeph class="+ topic/ph pr-d/codeph ">tf1</codeph>, and assigns an
HTML-formatted String to its <codeph class="+ topic/ph pr-d/codeph ">text</codeph> property. When its <codeph class="+ topic/ph pr-d/codeph ">htmlText</codeph> property
is traced, the output is the HTML-formatted String, with additional tags (such as &lt;P&gt; and
&lt;FONT&gt;) automatically added by Flash Player. When the value of the <codeph class="+ topic/ph pr-d/codeph ">text</codeph>
property is traced, the unformatted string without HTML tags is displayed.
<p class="- topic/p ">By way of comparison, the same steps are performed on another TextField object named
<codeph class="+ topic/ph pr-d/codeph ">tf2</codeph>, with the addition that a StyleSheet object is assigned to <codeph class="+ topic/ph pr-d/codeph ">tf2</codeph>'s
<codeph class="+ topic/ph pr-d/codeph ">styleSheet</codeph> property before its <codeph class="+ topic/ph pr-d/codeph ">htmlText</codeph> property is set. In that case,
when the <codeph class="+ topic/ph pr-d/codeph ">htmlText</codeph> property is traced, it only includes the exact HTML text that was
originally assigned to the <codeph class="+ topic/ph pr-d/codeph ">htmlText</codeph> property, showing that no additional tags were
added by Flash Player.</p>
<codeblock xml:space="preserve" class="+ topic/pre pr-d/codeblock ">
package {
import flash.display.Sprite;
import flash.text.StyleSheet;
import flash.text.TextField;
public class TextField_text extends Sprite {
public function TextField_text() {
var tf1:TextField = createCustomTextField(10, 10, 400, 22);
tf1.htmlText = "&lt;b&gt;Lorem ipsum dolor sit amet.&lt;/b&gt;";
// htmlText: &lt;P ALIGN="LEFT"&gt;&lt;FONT FACE="Times New Roman" SIZE="12" COLOR="#000000" LETTERSPACING="0" KERNING="0"&gt;&amp;lt;b&amp;gt;Lorem ipsum dolor sit amet.&amp;lt;/b&amp;gt;&lt;/FONT&gt;&lt;/P&gt;
trace("htmlText: " + tf1.htmlText);
// text: Lorem ipsum dolor sit amet.
trace("text: " + tf1.text);
var tf2:TextField = createCustomTextField(10, 50, 400, 22);
tf2.styleSheet = new StyleSheet();
tf2.htmlText = "&lt;b&gt;Lorem ipsum dolor sit amet.&lt;/b&gt;";
// htmlText: &lt;b&gt;Lorem ipsum dolor sit amet.&lt;/b&gt;
trace("htmlText: " + tf2.htmlText);
// text: Lorem ipsum dolor sit amet.
trace("text: " + tf2.text);
}
private function createCustomTextField(x:Number, y:Number, width:Number, height:Number):TextField {
var result:TextField = new TextField();
result.x = x;
result.y = y;
result.width = width;
result.height = height;
addChild(result);
return result;
}
}
}
</codeblock></example></apiValueDetail><related-links class="- topic/related-links "><link href="flash.text.xml#TextField/htmlText" class="- topic/link "><linktext class="- topic/linktext ">flash.text.TextField.htmlText</linktext></link></related-links></apiValue><apiValue id="flash.text:TextField:thickness:get" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiValue/apiValue "><apiName class="- topic/title reference/title apiRef/apiName ">thickness</apiName><shortdesc class="- topic/shortdesc ">
The thickness of the glyph edges in this text field.</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="Flash" version="9" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata><asCustoms class="+ topic/metadata adobe-api-d/asCustoms "><oldexample>This example creates two text fields and applies a <code>thickness</code> of -200 to one
and 200 to the other. It assumes that you have a font
embedded in the Library with the linkage identifier set to <code>"Times-12"</code>.
To embed the font, follow these steps:
<ol class="- topic/ol "><li class="- topic/li ">Open your Library</li><li class="- topic/li ">Click the Library options menu in the upper right corner of the Library</li><li class="- topic/li ">Select "New Font" from the dropdown list</li><li class="- topic/li ">Name the font "Times-12"</li><li class="- topic/li ">Select "Times New Roman" from the font dropdown list</li><li class="- topic/li ">Press the "OK" button</li><li class="- topic/li ">Right-click on the newly created font and select "Linkage..."</li><li class="- topic/li ">Check the "Export for ActionScript" box</li><li class="- topic/li ">Accept the default identifier "Times-12" by pressing the "OK" button</li></ol>
<listing version="2.0">
var my_format:TextFormat = new TextFormat();
my_format.font = "Times-12";
var my_text1:TextField = this.createTextField("my_text1", this.getNextHighestDepth(), 10, 10, 300, 30);
my_text1.text = "thickness = 200";
my_text1.antiAliasType = "advanced";
my_text1.border = true;
my_text1.thickness = 200;
my_text1.embedFonts = true;
my_text1.setTextFormat(my_format);
var my_text2:TextField = this.createTextField("my_text2", this.getNextHighestDepth(), 10, 50, 300, 30);
my_text2.text = "thickness = -200."
my_text2.antiAliasType = "advanced";
my_text2.thickness = -200;
my_text2.border = true;
my_text2.embedFonts = true;
my_text2.setTextFormat(my_format);
</listing>
</oldexample></asCustoms></prolog><apiValueDetail class="- topic/body reference/refbody apiRef/apiDetail apiValue/apiValueDetail "><apiValueDef class="- topic/section reference/section apiRef/apiDef apiValue/apiValueDef "><apiProperty class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiProperty "/><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiDynamic class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiDynamic "/><apiValueAccess value="readwrite" class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiValueAccess "/><apiValueClassifier class="- topic/xref reference/xref apiRef/apiRelation apiValue/apiValueClassifier ">Number</apiValueClassifier><apiDefaultValue>0
</apiDefaultValue><apiTipTexts><apiTipText class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiTipText ">The thickness of the glyph edges.
</apiTipText></apiTipTexts></apiValueDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
The thickness of the glyph edges in this text field. This property applies only
when <codeph class="+ topic/ph pr-d/codeph ">flash.text.AntiAliasType</codeph> is set to <codeph class="+ topic/ph pr-d/codeph ">flash.text.AntiAliasType.ADVANCED</codeph>.
<p class="- topic/p ">The range for <codeph class="+ topic/ph pr-d/codeph ">thickness</codeph> is a number from -200 to 200. If you attempt to
set <codeph class="+ topic/ph pr-d/codeph ">thickness</codeph> to a value outside that range, the property is set to the
nearest value in the range (either -200 or 200).</p>
</apiDesc><example conref="examples\TextField_thickness.as" class="- topic/example "> The following example shows the effect of changing the <codeph class="+ topic/ph pr-d/codeph ">thickness</codeph>
property for a TextField object. You need to embed the font, and set the <codeph class="+ topic/ph pr-d/codeph ">antiAliasType</codeph>
property to <codeph class="+ topic/ph pr-d/codeph ">ADVANCED</codeph>.
<codeblock xml:space="preserve" class="+ topic/pre pr-d/codeblock ">
package
{
import flash.display.Sprite;
import flash.text.TextField;
import flash.text.TextFieldAutoSize;
import flash.text.AntiAliasType;
import flash.text.GridFitType;
import flash.text.TextFormat;
public class thicknessExample extends Sprite
{
public function thicknessExample()
{
var format1:TextFormat = new TextFormat();
format1.font="Arial";
format1.size=24;
var lTxt:String = "The quick brown fox";
var tf1:TextField=createCustomTextField(0,lTxt,format1,-200);
var tf2:TextField=createCustomTextField(30,lTxt,format1,0);
var tf3:TextField=createCustomTextField(60,lTxt,format1,200);
}
private function createCustomTextField(y:Number,fldTxt:String,format:TextFormat,fldThickness:Number):TextField
{
var result:TextField = new TextField();
result.y=y;
result.text=fldTxt;
result.embedFonts=true;
result.autoSize=TextFieldAutoSize.LEFT;
result.antiAliasType=AntiAliasType.ADVANCED;
result.gridFitType=GridFitType.PIXEL;
result.thickness=fldThickness;
result.setTextFormat(format);
addChild(result);
return result;
}
}
}
</codeblock></example></apiValueDetail><related-links class="- topic/related-links "><link href="flash.text.xml#TextField/antiAliasType" class="- topic/link "><linktext class="- topic/linktext ">flash.text.TextField.antiAliasType</linktext></link><link href="flash.text.xml#AntiAliasType" class="- topic/link "><linktext class="- topic/linktext ">flash.text.AntiAliasType</linktext></link></related-links></apiValue><apiValue id="flash.text:TextField:type:get" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiValue/apiValue "><apiName class="- topic/title reference/title apiRef/apiName ">type</apiName><shortdesc class="- topic/shortdesc ">
The type of the text field.</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="Flash" version="9" class="+ topic/ph adobe-api-d/apiPlatform "/><apiPlatform description="" name="Lite" version="4" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata><asCustoms class="+ topic/metadata adobe-api-d/asCustoms "><keyword class="- topic/keyword ">TextField, TextField.type, type
</keyword></asCustoms></prolog><apiValueDetail class="- topic/body reference/refbody apiRef/apiDetail apiValue/apiValueDetail "><apiValueDef class="- topic/section reference/section apiRef/apiDef apiValue/apiValueDef "><apiProperty class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiProperty "/><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiDynamic class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiDynamic "/><apiValueAccess value="readwrite" class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiValueAccess "/><apiValueClassifier class="- topic/xref reference/xref apiRef/apiRelation apiValue/apiValueClassifier ">String</apiValueClassifier><apiException class="+ topic/ph reference/ph apiRef/apiDefItem apiOperation/apiEvent adobe-api-d/apiException "><apiDesc class="- topic/section reference/section apiRef/apiDesc ">The <codeph class="+ topic/ph pr-d/codeph ">type</codeph> specified is not a member of flash.text.TextFieldType.
</apiDesc><apiItemName class="- topic/keyword reference/keyword apiRef/apiItemName ">ArgumentError</apiItemName><apiOperationClassifier class="- topic/xref reference/xref apiRef/apiRelation apiOperation/apiOperationClassifier ">ArgumentError</apiOperationClassifier></apiException><apiDefaultValue>dynamic
</apiDefaultValue><apiTipTexts><apiTipText class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiTipText ">The type of the text field.
</apiTipText></apiTipTexts></apiValueDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
The type of the text field.
Either one of the following TextFieldType constants: <codeph class="+ topic/ph pr-d/codeph ">TextFieldType.DYNAMIC</codeph>,
which specifies a dynamic text field, which a user cannot edit, or <codeph class="+ topic/ph pr-d/codeph ">TextFieldType.INPUT</codeph>,
which specifies an input text field, which a user can edit.
</apiDesc><example conref="examples\TextField_type.as" class="- topic/example "> The following example creates two text fields: <codeph class="+ topic/ph pr-d/codeph ">tfDynamic</codeph> and
<codeph class="+ topic/ph pr-d/codeph ">tfInput</codeph>. Text is entered into both text fields. However,
<codeph class="+ topic/ph pr-d/codeph ">tfDynamic</codeph> has its <codeph class="+ topic/ph pr-d/codeph ">type</codeph> property set to
<codeph class="+ topic/ph pr-d/codeph ">TextFieldType.DYNAMIC</codeph>, and <codeph class="+ topic/ph pr-d/codeph ">tfInput</codeph> has its
<codeph class="+ topic/ph pr-d/codeph ">type</codeph> property set to <codeph class="+ topic/ph pr-d/codeph ">TextFieldType.INPUT</codeph>, so the user can
modify the text in <codeph class="+ topic/ph pr-d/codeph ">tfInput</codeph> but can only view the text in <codeph class="+ topic/ph pr-d/codeph ">tfDynamic</codeph>.
<codeblock xml:space="preserve" class="+ topic/pre pr-d/codeblock ">
package {
import flash.display.Sprite;
import flash.text.TextField;
import flash.text.TextFieldType;
public class TextField_type extends Sprite {
public function TextField_type() {
var tfDynamic:TextField = createCustomTextField(10, 10, 100, 20);
tfDynamic.type = TextFieldType.DYNAMIC;
tfDynamic.text = "hello";
var tfInput:TextField = createCustomTextField(10, 45, 100, 20);
tfInput.type = TextFieldType.INPUT;
tfInput.text = "world";
}
private function createCustomTextField(x:Number, y:Number, width:Number, height:Number):TextField {
var result:TextField = new TextField();
result.x = x;
result.y = y;
result.width = width;
result.height = height;
result.background = true;
result.border = true;
addChild(result);
return result;
}
}
}
</codeblock></example></apiValueDetail><related-links class="- topic/related-links "><link href="flash.text.xml#TextFieldType" class="- topic/link "><linktext class="- topic/linktext ">flash.text.TextFieldType</linktext></link></related-links></apiValue><apiValue id="flash.text:TextField:useRichTextClipboard:get" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiValue/apiValue "><apiName class="- topic/title reference/title apiRef/apiName ">useRichTextClipboard</apiName><shortdesc class="- topic/shortdesc ">
Specifies whether to copy and paste the text formatting along with the text.</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="Flash" version="9" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata></prolog><apiValueDetail class="- topic/body reference/refbody apiRef/apiDetail apiValue/apiValueDetail "><apiValueDef class="- topic/section reference/section apiRef/apiDef apiValue/apiValueDef "><apiProperty class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiProperty "/><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiDynamic class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiDynamic "/><apiValueAccess value="readwrite" class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiValueAccess "/><apiValueClassifier class="- topic/xref reference/xref apiRef/apiRelation apiValue/apiValueClassifier ">Boolean</apiValueClassifier></apiValueDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
Specifies whether to copy and paste the text formatting along with the text. When set to <codeph class="+ topic/ph pr-d/codeph ">true</codeph>,
Flash Player copies and pastes formatting (such as alignment, bold, and italics) when you copy and paste between text fields. Both the origin and destination text fields for the copy and paste procedure must have
<codeph class="+ topic/ph pr-d/codeph ">useRichTextClipboard</codeph> set to <codeph class="+ topic/ph pr-d/codeph ">true</codeph>. The default value
is <codeph class="+ topic/ph pr-d/codeph ">false</codeph>.
</apiDesc><example conref="examples\TextField_useRichTextClipboard.as" class="- topic/example "> This example creates an input text field (<codeph class="+ topic/ph pr-d/codeph ">tf1</codeph>) and two dynamic
text fields (<codeph class="+ topic/ph pr-d/codeph ">tf2</codeph> and <codeph class="+ topic/ph pr-d/codeph ">tf3</codeph>).
The code assigns each dynamic text field a TextFormat object (Courier Bold font).
The <codeph class="+ topic/ph pr-d/codeph ">tf2</codeph> text field has <codeph class="+ topic/ph pr-d/codeph ">useRichTextClipboard</codeph> property set to
<codeph class="+ topic/ph pr-d/codeph ">false</codeph>. The <codeph class="+ topic/ph pr-d/codeph ">tf3</codeph> text field has the
<codeph class="+ topic/ph pr-d/codeph ">useRichTextClipboard</codeph> property set to <codeph class="+ topic/ph pr-d/codeph ">true</codeph>.
When you copy the text from the <codeph class="+ topic/ph pr-d/codeph ">tf2</codeph> text field
and paste it into the <codeph class="+ topic/ph pr-d/codeph ">tf1</codeph> text field, the pasted text does not include
the formatting. When you copy the text from the <codeph class="+ topic/ph pr-d/codeph ">tf3</codeph> text field (which has
<codeph class="+ topic/ph pr-d/codeph ">useRichTextClipboard</codeph> set to <codeph class="+ topic/ph pr-d/codeph ">true</codeph>) and paste it into the
<codeph class="+ topic/ph pr-d/codeph ">tf1</codeph> text field, the pasted text includes the formatting.
<codeblock xml:space="preserve" class="+ topic/pre pr-d/codeblock ">
package
{
import flash.display.Sprite;
import flash.text.TextField;
import flash.text.TextFieldType;
import flash.text.TextFormat;
public class useRichTextClipboard extends Sprite
{
public function useRichTextClipboard()
{
var format1:TextFormat = new TextFormat();
format1.font="Courier";
format1.bold=true;
var tf1:TextField = createCustomTextField(10, 10, 200, 20);
tf1.type=TextFieldType.INPUT;
tf1.useRichTextClipboard=true;
var tf2:TextField = createCustomTextField(220, 10, 200, 20);
tf2.text="1.Text loses format";
tf2.setTextFormat(format1);
tf2.useRichTextClipboard=false;
var tf3:TextField = createCustomTextField(220, 50, 200, 20);
tf3.text="2.Text includes format";
tf3.setTextFormat(format1);
tf3.useRichTextClipboard=true;
}
private function createCustomTextField(x:Number, y:Number, width:Number, height:Number):TextField
{
var result:TextField = new TextField();
result.x = x;
result.y = y;
result.width = width;
result.height = height;
result.background = true;
result.border = true;
addChild(result);
return result;
}
}
}
</codeblock></example></apiValueDetail></apiValue><apiValue id="flash.text:TextField:wordWrap:get" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiValue/apiValue "><apiName class="- topic/title reference/title apiRef/apiName ">wordWrap</apiName><shortdesc class="- topic/shortdesc ">
A Boolean value that indicates whether the text field has word wrap.</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="Flash" version="9" class="+ topic/ph adobe-api-d/apiPlatform "/><apiPlatform description="" name="Lite" version="4" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata><asCustoms class="+ topic/metadata adobe-api-d/asCustoms "><keyword class="- topic/keyword ">TextField, TextField.wordWrap, wordWrap
</keyword></asCustoms></prolog><apiValueDetail class="- topic/body reference/refbody apiRef/apiDetail apiValue/apiValueDetail "><apiValueDef class="- topic/section reference/section apiRef/apiDef apiValue/apiValueDef "><apiProperty class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiProperty "/><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiDynamic class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiDynamic "/><apiValueAccess value="readwrite" class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiValueAccess "/><apiValueClassifier class="- topic/xref reference/xref apiRef/apiRelation apiValue/apiValueClassifier ">Boolean</apiValueClassifier><apiTipTexts><apiTipText class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiTipText ">Indicates whether the text field has word wrap.
</apiTipText></apiTipTexts></apiValueDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
A Boolean value that indicates whether the text field has word wrap. If the value of
<codeph class="+ topic/ph pr-d/codeph ">wordWrap</codeph> is <codeph class="+ topic/ph pr-d/codeph ">true</codeph>, the text field has word wrap;
if the value is <codeph class="+ topic/ph pr-d/codeph ">false</codeph>, the text field does not have word wrap. The default
value is <codeph class="+ topic/ph pr-d/codeph ">false</codeph>.
</apiDesc><example conref="examples\TextField_wordWrap.as" class="- topic/example "> This example demonstrates the difference between setting the <codeph class="+ topic/ph pr-d/codeph ">wordWrap</codeph>
property to <codeph class="+ topic/ph pr-d/codeph ">true</codeph> and setting it to <codeph class="+ topic/ph pr-d/codeph ">false</codeph>. Two TextField instances are
created whose contents are too large for their widths. The <codeph class="+ topic/ph pr-d/codeph ">wordWrap</codeph> property of
the first (named <codeph class="+ topic/ph pr-d/codeph ">tfWrap</codeph>) is set to <codeph class="+ topic/ph pr-d/codeph ">true</codeph>; it is set to <codeph class="+ topic/ph pr-d/codeph ">false</codeph>
for the second (<codeph class="+ topic/ph pr-d/codeph ">tfNoWrap</codeph>).
<codeblock xml:space="preserve" class="+ topic/pre pr-d/codeblock ">
package {
import flash.display.Sprite;
import flash.text.TextField;
public class TextField_wordWrap extends Sprite {
public function TextField_wordWrap() {
var tfWrap:TextField = createCustomTextField(10, 10, 100, 100);
tfWrap.wordWrap = true;
tfWrap.text = "(wordWrap = true):\nThis is very long text that will certainly extend beyond the width of this text field";
var tfNoWrap:TextField = createCustomTextField(10, 150, 100, 100);
tfNoWrap.wordWrap = false;
tfNoWrap.text = "(wordWrap = false):\nThis is very long text that will certainly extend beyond the width of this text field";
}
private function createCustomTextField(x:Number, y:Number, width:Number, height:Number):TextField {
var result:TextField = new TextField();
result.x = x;
result.y = y;
result.width = width;
result.height = height;
result.background = true;
result.border = true;
addChild(result);
return result;
}
}
}
</codeblock></example></apiValueDetail></apiValue></apiClassifier><apiClassifier languages="" id="flash.text:TextFormat" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiClassifier/apiClassifier "><apiName class="- topic/title reference/title apiRef/apiName ">TextFormat</apiName><shortdesc class="- topic/shortdesc ">
The TextFormat class represents character formatting information.</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="Flash" version="9" class="+ topic/ph adobe-api-d/apiPlatform "/><apiPlatform description="" name="Lite" version="4" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata><asCustoms class="+ topic/metadata adobe-api-d/asCustoms "><internal>Insure the above example is correct and meets example standards
</internal></asCustoms></prolog><apiClassifierDetail class="- topic/body reference/refbody apiRef/apiDetail apiClassifier/apiClassifierDetail "><apiClassifierDef class="- topic/section reference/section apiRef/apiDef apiClassifier/apiClassifierDef "><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiStatic class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiStatic "/><apiTipTexts><apiTipText class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiTipText ">Creates text formatting for text fields.
</apiTipText></apiTipTexts><apiBaseClassifier class="- topic/xref reference/xref apiRef/apiRelation apiClassifier/apiBaseClassifier ">Object</apiBaseClassifier></apiClassifierDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
The TextFormat class represents character formatting information. Use the TextFormat class
to create specific text formatting for text fields. You can apply text formatting
to both static and dynamic text fields. The properties of the TextFormat class apply to device and
embedded fonts. However, for embedded fonts, bold and italic text actually require specific fonts. If you
want to display bold or italic text with an embedded font, you need to embed the bold and italic variations
of that font.
<p class="- topic/p "> You must use the constructor <codeph class="+ topic/ph pr-d/codeph ">new TextFormat()</codeph> to create a TextFormat object
before setting its properties.
When you apply a TextFormat object to a text field using the <codeph class="+ topic/ph pr-d/codeph ">TextField.defaultTextFormat</codeph> property
or the <codeph class="+ topic/ph pr-d/codeph ">TextField.setTextFormat()</codeph> method, only its defined properties are applied. Use
the <codeph class="+ topic/ph pr-d/codeph ">TextField.defaultTextFormat</codeph> property to apply formatting BEFORE you add text to the <codeph class="+ topic/ph pr-d/codeph ">TextField</codeph>,
and the <codeph class="+ topic/ph pr-d/codeph ">setTextFormat()</codeph> method to add formatting AFTER you add text to the <codeph class="+ topic/ph pr-d/codeph ">TextField</codeph>.
The TextFormat properties are <codeph class="+ topic/ph pr-d/codeph ">null</codeph> by default
because if you don't provide values for the properties, Flash Player uses its own default formatting.
The default formatting that Flash Player uses for each property (if property's value is <codeph class="+ topic/ph pr-d/codeph ">null</codeph>)
is as follows:</p>
<adobetable class="innertable"><tgroup cols="1" class="- topic/tgroup "><tbody class="- topic/tbody "><row class="- topic/row "><entry class="- topic/entry ">align = "left"</entry></row><row class="- topic/row "><entry class="- topic/entry ">blockIndent = 0</entry></row><row class="- topic/row "><entry class="- topic/entry ">bold = false</entry></row><row class="- topic/row "><entry class="- topic/entry ">bullet = false</entry></row><row class="- topic/row "><entry class="- topic/entry ">color = 0x000000</entry></row><row class="- topic/row "><entry class="- topic/entry ">font = "Times New Roman" (default font is Times on Mac OS X)</entry></row><row class="- topic/row "><entry class="- topic/entry ">indent = 0</entry></row><row class="- topic/row "><entry class="- topic/entry ">italic = false</entry></row><row class="- topic/row "><entry class="- topic/entry ">kerning = false</entry></row><row class="- topic/row "><entry class="- topic/entry ">leading = 0</entry></row><row class="- topic/row "><entry class="- topic/entry ">leftMargin = 0</entry></row><row class="- topic/row "><entry class="- topic/entry ">letterSpacing = 0</entry></row><row class="- topic/row "><entry class="- topic/entry ">rightMargin = 0</entry></row><row class="- topic/row "><entry class="- topic/entry ">size = 12</entry></row><row class="- topic/row "><entry class="- topic/entry ">tabStops = [] (empty array)</entry></row><row class="- topic/row "><entry class="- topic/entry ">target = "" (empty string)</entry></row><row class="- topic/row "><entry class="- topic/entry ">underline = false</entry></row><row class="- topic/row "><entry class="- topic/entry ">url = "" (empty string)</entry></row></tbody></tgroup></adobetable>
<p class="- topic/p ">The default formatting for each property is also described in each property description.</p>
</apiDesc><example conref="examples\TextFormatExample.as" class="- topic/example "> The following example creates the TextFieldExample class to display a text message with
the default location (x = 0, y = 0). This is accomplished using the following steps:
<ol class="- topic/ol "><li class="- topic/li ">A property <codeph class="+ topic/ph pr-d/codeph ">label</codeph> of type TextField is created.</li><li class="- topic/li ">The class constructor calls the function <codeph class="+ topic/ph pr-d/codeph ">configureLabel()</codeph></li><li class="- topic/li ">The <codeph class="+ topic/ph pr-d/codeph ">configureLabel()</codeph> function first creates a new TextField object and assigns it to
<codeph class="+ topic/ph pr-d/codeph ">label</codeph> then sets its parameters to
<ul class="- topic/ul "><li class="- topic/li ">Left-justify the text field</li><li class="- topic/li ">Enable the background fill</li><li class="- topic/li ">Enable the border.</li></ul>
</li><li class="- topic/li ">Next, <codeph class="+ topic/ph pr-d/codeph ">configureLabel()</codeph> creates the local variable, <codeph class="+ topic/ph pr-d/codeph ">format</codeph>, and assigns it to
a new TextFormat instance with its parameters set to:
<ul class="- topic/ul "><li class="- topic/li ">Font type = Verdana</li><li class="- topic/li ">Font Color = solid red</li><li class="- topic/li ">Font size = 10</li><li class="- topic/li ">Font underline = true.</li></ul>
</li><li class="- topic/li ">The label's <codeph class="+ topic/ph pr-d/codeph ">defaultTextFormat</codeph> property is set to <codeph class="+ topic/ph pr-d/codeph ">format</codeph>, and the
<codeph class="+ topic/ph pr-d/codeph ">label</codeph> instance is added to the display list, which initially displays a text field with
no text (as tiny box with a white background) on the stage.</li><li class="- topic/li ">Finally (back in the constructor), the label's text is then set to display "Hello
World and welcome to the show", at coordinates x = 0, y = 0 by calling <codeph class="+ topic/ph pr-d/codeph ">setLabel()</codeph>.</li></ol>
<codeblock xml:space="preserve" class="+ topic/pre pr-d/codeblock ">
package {
import flash.display.Sprite;
import flash.text.TextField;
import flash.text.TextFieldAutoSize;
import flash.text.TextFormat;
public class TextFormatExample extends Sprite {
private var label:TextField;
public function TextFormatExample() {
configureLabel();
setLabel("Hello World and welcome to the show");
}
public function setLabel(str:String):void {
label.text = str;
}
private function configureLabel():void {
label = new TextField();
label.autoSize = TextFieldAutoSize.LEFT;
label.background = true;
label.border = true;
var format:TextFormat = new TextFormat();
format.font = "Verdana";
format.color = 0xFF0000;
format.size = 10;
format.underline = true;
label.defaultTextFormat = format;
addChild(label);
}
}
}
</codeblock></example></apiClassifierDetail><related-links class="- topic/related-links "><link href="flash.text.xml#TextField/setTextFormat()" class="- topic/link "><linktext class="- topic/linktext ">flash.text.TextField.setTextFormat()</linktext></link><link href="flash.text.xml#TextField/defaultTextFormat" class="- topic/link "><linktext class="- topic/linktext ">flash.text.TextField.defaultTextFormat</linktext></link><link href="flash.text.xml#TextField/getTextFormat()" class="- topic/link "><linktext class="- topic/linktext ">flash.text.TextField.getTextFormat()</linktext></link></related-links><apiConstructor id="flash.text:TextFormat:TextFormat" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiOperation/apiOperation apiOperation/apiConstructor"><apiName class="- topic/title reference/title apiRef/apiName ">TextFormat</apiName><shortdesc class="- topic/shortdesc ">
Creates a TextFormat object with the specified properties.</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="Flash" version="9." class="+ topic/ph adobe-api-d/apiPlatform "/><apiPlatform description="" name="Lite" version="4" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata><asCustoms class="+ topic/metadata adobe-api-d/asCustoms "><keyword class="- topic/keyword ">TextFormat
</keyword></asCustoms></prolog><apiConstructorDetail class="- topic/body reference/refbody apiRef/apiDetail apiOperation/apiOperationDetail apiOperation/apiConstructorDetail"><apiConstructorDef class="- topic/section reference/section apiRef/apiDef apiOperation/apiConstructorDef "><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiParam class="- topic/ph reference/ph apiRef/apiDefItem apiOperation/apiParam "><apiItemName class="- topic/keyword reference/keyword apiRef/apiItemName ">font</apiItemName><apiOperationClassifier class="- topic/xref reference/xref apiRef/apiRelation apiOperation/apiOperationClassifier ">String</apiOperationClassifier><apiData class="- topic/ph reference/ph apiRef/apiData ">null</apiData><apiDesc class="- topic/section reference/section apiRef/apiDesc ">The name of a font for text as a string.
</apiDesc></apiParam><apiParam class="- topic/ph reference/ph apiRef/apiDefItem apiOperation/apiParam "><apiItemName class="- topic/keyword reference/keyword apiRef/apiItemName ">size</apiItemName><apiOperationClassifier class="- topic/xref reference/xref apiRef/apiRelation apiOperation/apiOperationClassifier ">Object</apiOperationClassifier><apiData class="- topic/ph reference/ph apiRef/apiData ">null</apiData><apiDesc class="- topic/section reference/section apiRef/apiDesc ">An integer that indicates the size in pixels.
</apiDesc></apiParam><apiParam class="- topic/ph reference/ph apiRef/apiDefItem apiOperation/apiParam "><apiItemName class="- topic/keyword reference/keyword apiRef/apiItemName ">color</apiItemName><apiOperationClassifier class="- topic/xref reference/xref apiRef/apiRelation apiOperation/apiOperationClassifier ">Object</apiOperationClassifier><apiData class="- topic/ph reference/ph apiRef/apiData ">null</apiData><apiDesc class="- topic/section reference/section apiRef/apiDesc ">The color of text using this text format. A number containing three 8-bit RGB
components; for example, 0xFF0000 is red, and 0x00FF00 is green.
</apiDesc></apiParam><apiParam class="- topic/ph reference/ph apiRef/apiDefItem apiOperation/apiParam "><apiItemName class="- topic/keyword reference/keyword apiRef/apiItemName ">bold</apiItemName><apiOperationClassifier class="- topic/xref reference/xref apiRef/apiRelation apiOperation/apiOperationClassifier ">Object</apiOperationClassifier><apiData class="- topic/ph reference/ph apiRef/apiData ">null</apiData><apiDesc class="- topic/section reference/section apiRef/apiDesc ">A Boolean value that indicates whether the text is boldface.
</apiDesc></apiParam><apiParam class="- topic/ph reference/ph apiRef/apiDefItem apiOperation/apiParam "><apiItemName class="- topic/keyword reference/keyword apiRef/apiItemName ">italic</apiItemName><apiOperationClassifier class="- topic/xref reference/xref apiRef/apiRelation apiOperation/apiOperationClassifier ">Object</apiOperationClassifier><apiData class="- topic/ph reference/ph apiRef/apiData ">null</apiData><apiDesc class="- topic/section reference/section apiRef/apiDesc ">A Boolean value that indicates whether the text is italicized.
</apiDesc></apiParam><apiParam class="- topic/ph reference/ph apiRef/apiDefItem apiOperation/apiParam "><apiItemName class="- topic/keyword reference/keyword apiRef/apiItemName ">underline</apiItemName><apiOperationClassifier class="- topic/xref reference/xref apiRef/apiRelation apiOperation/apiOperationClassifier ">Object</apiOperationClassifier><apiData class="- topic/ph reference/ph apiRef/apiData ">null</apiData><apiDesc class="- topic/section reference/section apiRef/apiDesc ">A Boolean value that indicates whether the text is underlined.
</apiDesc></apiParam><apiParam class="- topic/ph reference/ph apiRef/apiDefItem apiOperation/apiParam "><apiItemName class="- topic/keyword reference/keyword apiRef/apiItemName ">url</apiItemName><apiOperationClassifier class="- topic/xref reference/xref apiRef/apiRelation apiOperation/apiOperationClassifier ">String</apiOperationClassifier><apiData class="- topic/ph reference/ph apiRef/apiData ">null</apiData><apiDesc class="- topic/section reference/section apiRef/apiDesc ">The URL to which the text in this text format hyperlinks. If <codeph class="+ topic/ph pr-d/codeph ">url</codeph> is
an empty string, the text does not have a hyperlink.
</apiDesc></apiParam><apiParam class="- topic/ph reference/ph apiRef/apiDefItem apiOperation/apiParam "><apiItemName class="- topic/keyword reference/keyword apiRef/apiItemName ">target</apiItemName><apiOperationClassifier class="- topic/xref reference/xref apiRef/apiRelation apiOperation/apiOperationClassifier ">String</apiOperationClassifier><apiData class="- topic/ph reference/ph apiRef/apiData ">null</apiData><apiDesc class="- topic/section reference/section apiRef/apiDesc ">The target window where the hyperlink is displayed. If the target window is an empty
string, the text is displayed in the default target window <codeph class="+ topic/ph pr-d/codeph ">_self</codeph>. If the
<codeph class="+ topic/ph pr-d/codeph ">url</codeph> parameter is set to an empty string or to the value <codeph class="+ topic/ph pr-d/codeph ">null</codeph>, you can get or
set this property, but the property will have no effect.
</apiDesc></apiParam><apiParam class="- topic/ph reference/ph apiRef/apiDefItem apiOperation/apiParam "><apiItemName class="- topic/keyword reference/keyword apiRef/apiItemName ">align</apiItemName><apiOperationClassifier class="- topic/xref reference/xref apiRef/apiRelation apiOperation/apiOperationClassifier ">String</apiOperationClassifier><apiData class="- topic/ph reference/ph apiRef/apiData ">null</apiData><apiDesc class="- topic/section reference/section apiRef/apiDesc ">The alignment of the paragraph, as a TextFormatAlign value.
</apiDesc></apiParam><apiParam class="- topic/ph reference/ph apiRef/apiDefItem apiOperation/apiParam "><apiItemName class="- topic/keyword reference/keyword apiRef/apiItemName ">leftMargin</apiItemName><apiOperationClassifier class="- topic/xref reference/xref apiRef/apiRelation apiOperation/apiOperationClassifier ">Object</apiOperationClassifier><apiData class="- topic/ph reference/ph apiRef/apiData ">null</apiData><apiDesc class="- topic/section reference/section apiRef/apiDesc ">Indicates the left margin of the paragraph, in pixels.
</apiDesc></apiParam><apiParam class="- topic/ph reference/ph apiRef/apiDefItem apiOperation/apiParam "><apiItemName class="- topic/keyword reference/keyword apiRef/apiItemName ">rightMargin</apiItemName><apiOperationClassifier class="- topic/xref reference/xref apiRef/apiRelation apiOperation/apiOperationClassifier ">Object</apiOperationClassifier><apiData class="- topic/ph reference/ph apiRef/apiData ">null</apiData><apiDesc class="- topic/section reference/section apiRef/apiDesc ">Indicates the right margin of the paragraph, in pixels.
</apiDesc></apiParam><apiParam class="- topic/ph reference/ph apiRef/apiDefItem apiOperation/apiParam "><apiItemName class="- topic/keyword reference/keyword apiRef/apiItemName ">indent</apiItemName><apiOperationClassifier class="- topic/xref reference/xref apiRef/apiRelation apiOperation/apiOperationClassifier ">Object</apiOperationClassifier><apiData class="- topic/ph reference/ph apiRef/apiData ">null</apiData><apiDesc class="- topic/section reference/section apiRef/apiDesc ">An integer that indicates the indentation from the left margin to the first character
in the paragraph.
</apiDesc></apiParam><apiParam class="- topic/ph reference/ph apiRef/apiDefItem apiOperation/apiParam "><apiItemName class="- topic/keyword reference/keyword apiRef/apiItemName ">leading</apiItemName><apiOperationClassifier class="- topic/xref reference/xref apiRef/apiRelation apiOperation/apiOperationClassifier ">Object</apiOperationClassifier><apiData class="- topic/ph reference/ph apiRef/apiData ">null</apiData><apiDesc class="- topic/section reference/section apiRef/apiDesc ">A number that indicates the amount of leading vertical space between lines.
</apiDesc></apiParam></apiConstructorDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
Creates a TextFormat object with the specified properties. You can then change the
properties of the TextFormat object to change the formatting of text fields.
<p class="- topic/p ">Any parameter may be set to <codeph class="+ topic/ph pr-d/codeph ">null</codeph> to indicate that it is not defined. All of the
parameters are optional; any omitted parameters are treated as <codeph class="+ topic/ph pr-d/codeph ">null</codeph>.</p>
</apiDesc><example conref="examples\TextFormat_constructorExample.as" class="- topic/example "> In the following example, a user can select different text formatting
options from a list that is applied to the content of another text field. If the user
clicks on the text field's content, the formatting reverts to the default (original) format.
<p class="- topic/p ">The <codeph class="+ topic/ph pr-d/codeph ">formatTextField</codeph> text field lists all the TextField class property options
(with the exception of <codeph class="+ topic/ph pr-d/codeph ">kerning</codeph>) in a separate line. When a user clicks a
line in the <codeph class="+ topic/ph pr-d/codeph ">formatTextField</codeph> text field, the <codeph class="+ topic/ph pr-d/codeph ">formatTextFieldClickHandler()</codeph>
method is triggered.</p>
<p class="- topic/p ">The <codeph class="+ topic/ph pr-d/codeph ">formatTextFieldClickHandler()</codeph> method calls the <codeph class="+ topic/ph pr-d/codeph ">TextField.getLineIndexAtPoint()</codeph>
method to get the index of the line that was clicked, and then calls the <codeph class="+ topic/ph pr-d/codeph ">TextField.getLineText()</codeph>
method to get the content of the line. The switch statement checks the content of the line and sets
a property of the <codeph class="+ topic/ph pr-d/codeph ">newformat</codeph> TextFormat object accordingly. The <codeph class="+ topic/ph pr-d/codeph ">setTextFormat()</codeph>
method then sets the text format of the <codeph class="+ topic/ph pr-d/codeph ">contentTextField</codeph> text field to the new format. By clicking
different <codeph class="+ topic/ph pr-d/codeph ">formatTextField</codeph> lines, a user can apply a different formatting
to the <codeph class="+ topic/ph pr-d/codeph ">contentTextField</codeph> text field. (The tab setting is an array that defines
a separate tab stop for each tab in the line.) If the <codeph class="+ topic/ph pr-d/codeph ">url</codeph> or <codeph class="+ topic/ph pr-d/codeph ">target</codeph> line
is selected, the user must click the <codeph class="+ topic/ph pr-d/codeph ">contentTextField</codeph> text field to activate the link
and display the content of the target URL (Flex home page). The default value of the <codeph class="+ topic/ph pr-d/codeph ">target</codeph>
property is "_self", which means that the content is displayed in the current window if the user
selects the <codeph class="+ topic/ph pr-d/codeph ">url</codeph> line. For the <codeph class="+ topic/ph pr-d/codeph ">target</codeph> property to work, a URL must be
set already in the <codeph class="+ topic/ph pr-d/codeph ">url</codeph> property.</p>
<p class="- topic/p ">If a user clicks the <codeph class="+ topic/ph pr-d/codeph ">contentTextField</codeph> text field, the <codeph class="+ topic/ph pr-d/codeph ">contentTextFieldClickHandler()</codeph>
method is triggered, which sets the field's format and the <codeph class="+ topic/ph pr-d/codeph ">newFormat</codeph> TextFormat
object to the default (original) format of the text field. This clears all the formatting changes
that the user made.</p>
<codeblock xml:space="preserve" class="+ topic/pre pr-d/codeblock ">
package {
import flash.display.Sprite;
import flash.text.TextField;
import flash.text.TextFormat;
import flash.text.TextFieldAutoSize;
import flash.events.MouseEvent;
import flash.text.TextFormatAlign;
public class TextFormat_constructorExample extends Sprite {
private var contentTextField:TextField = new TextField();
private var formatTextField:TextField = new TextField();
private var newFormat:TextFormat = new TextFormat();
public function TextFormat_constructorExample() {
contentTextField.x = 10;
contentTextField.y = 10;
contentTextField.background = true;
contentTextField.border = true;
contentTextField.multiline = true;
contentTextField.wordWrap = true;
contentTextField.selectable = false;
contentTextField.width = 250;
contentTextField.height = 120;
contentTextField.htmlText = "&lt;p&gt;The TextFormat class represents character formatting "
+ "information. Use the TextFormat class to create specific text formatting "
+ "for text fields." +
" &lt;/p&gt;&lt;br&gt;" + "\tTab One" + "\tTab Two&lt;br&gt;";
formatTextField.x = 10;
formatTextField.y = 140;
formatTextField.background = true;
formatTextField.border = true;
formatTextField.autoSize = TextFieldAutoSize.LEFT;
formatTextField.text = "align: right\n" + "blockIndent: 10 pixels\n" + "bold:\n" + "bullet:\n" + "color: red\n"
+ "font: Arial\n" + "indent: 20 pixels\n" + "italic:\n" + "leading: 5 spaces\n"
+ "leftMargin: 20 pixels\n" + "letterSpacing: 4 pixels\n" + "rightMargin: 20 pixels\n"
+ "size: 16 point\n" + "target: new window\n" + "tabStops: 50 and 150 pixel\n"
+ "underline:\n" + "url: Apache Flex page\n";
formatTextField.addEventListener(MouseEvent.CLICK, formatTextFieldClickHandler);
contentTextField.addEventListener(MouseEvent.CLICK, contentTextFieldClickHandler);
this.addChild(contentTextField);
this.addChild(formatTextField);
}
private function formatTextFieldClickHandler(e:MouseEvent):void {
var value:String= "";
var i:uint = 0;
var index:int = formatTextField.getLineIndexAtPoint(e.localX, e.localY);
var line:String = formatTextField.getLineText(index);;
line = line.substr(0, (line.indexOf(":")));
switch(line) {
case "align":
newFormat.align = TextFormatAlign.RIGHT;
break;
case "blockIndent":
newFormat.blockIndent = 10;
break;
case "bold":
newFormat.bold = true;
break;
case "bullet":
newFormat.bullet = true;
break;
case "color":
newFormat.color = 0xFF0000;
break;
case "font":
newFormat.font = "Arial";
break;
case "indent":
newFormat.indent = 20;
break;
case "italic":
newFormat.italic = true;
break;
case "leading":
newFormat.leading = 5;
break;
case "leftMargin":
newFormat.leftMargin = 20;
break;
case "letterSpacing":
newFormat.letterSpacing = 4;
break;
case "rightMargin":
newFormat.rightMargin = 20;
break;
case "size":
newFormat.size = 16;
break;
case "tabStops":
newFormat.tabStops = [50, 150];
break;
case "target":
newFormat.url = "http://www.adobe.com/products/flex/";
newFormat.target = "_blank";
break;
case "underline":
newFormat.underline = true;
break;
case "url":
newFormat.url = "http://www.adobe.com/products/flex/";
break;
}
contentTextField.setTextFormat(newFormat);
}
private function contentTextFieldClickHandler(e:MouseEvent):void {
contentTextField.setTextFormat(contentTextField.defaultTextFormat);
newFormat = contentTextField.defaultTextFormat;
}
}
}
</codeblock></example></apiConstructorDetail></apiConstructor><apiValue id="flash.text:TextFormat:align:get" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiValue/apiValue "><apiName class="- topic/title reference/title apiRef/apiName ">align</apiName><shortdesc class="- topic/shortdesc ">
Indicates the alignment of the paragraph.</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="Flash" version="9." class="+ topic/ph adobe-api-d/apiPlatform "/><apiPlatform description="" name="Lite" version="4" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata><asCustoms class="+ topic/metadata adobe-api-d/asCustoms "><keyword class="- topic/keyword ">TextFormat, TextFormat.align, align
</keyword></asCustoms></prolog><apiValueDetail class="- topic/body reference/refbody apiRef/apiDetail apiValue/apiValueDetail "><apiValueDef class="- topic/section reference/section apiRef/apiDef apiValue/apiValueDef "><apiProperty class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiProperty "/><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiDynamic class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiDynamic "/><apiValueAccess value="readwrite" class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiValueAccess "/><apiValueClassifier class="- topic/xref reference/xref apiRef/apiRelation apiValue/apiValueClassifier ">String</apiValueClassifier><apiException class="+ topic/ph reference/ph apiRef/apiDefItem apiOperation/apiEvent adobe-api-d/apiException "><apiDesc class="- topic/section reference/section apiRef/apiDesc ">The <codeph class="+ topic/ph pr-d/codeph ">align</codeph> specified is not a member of flash.text.TextFormatAlign.
</apiDesc><apiItemName class="- topic/keyword reference/keyword apiRef/apiItemName ">ArgumentError</apiItemName><apiOperationClassifier class="- topic/xref reference/xref apiRef/apiRelation apiOperation/apiOperationClassifier ">ArgumentError</apiOperationClassifier></apiException><apiDefaultValue>TextFormatAlign.LEFT
</apiDefaultValue></apiValueDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
Indicates the alignment of the paragraph. Valid values are TextFormatAlign constants.
</apiDesc><example class="- topic/example ">Please see the <xref href="TextFormat.html#TextFormat()" class="- topic/xref ">TextFormat() constructor</xref> example
for an illustration of how to use this property.
</example></apiValueDetail><related-links class="- topic/related-links "><link href="flash.text.xml#TextFormatAlign" class="- topic/link "><linktext class="- topic/linktext ">flash.text.TextFormatAlign</linktext></link></related-links></apiValue><apiValue id="flash.text:TextFormat:blockIndent:get" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiValue/apiValue "><apiName class="- topic/title reference/title apiRef/apiName ">blockIndent</apiName><shortdesc class="- topic/shortdesc ">
Indicates the block indentation in pixels.</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="Flash" version="9." class="+ topic/ph adobe-api-d/apiPlatform "/><apiPlatform description="" name="Lite" version="4" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata><asCustoms class="+ topic/metadata adobe-api-d/asCustoms "><keyword class="- topic/keyword ">TextFormat, TextFormat.blockIndent, blockIndent
</keyword></asCustoms></prolog><apiValueDetail class="- topic/body reference/refbody apiRef/apiDetail apiValue/apiValueDetail "><apiValueDef class="- topic/section reference/section apiRef/apiDef apiValue/apiValueDef "><apiProperty class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiProperty "/><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiDynamic class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiDynamic "/><apiValueAccess value="readwrite" class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiValueAccess "/><apiValueClassifier class="- topic/xref reference/xref apiRef/apiRelation apiValue/apiValueClassifier ">Object</apiValueClassifier></apiValueDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
Indicates the block indentation in pixels. Block indentation is applied to
an entire block of text; that is, to all lines of the text. In contrast, normal indentation
(<codeph class="+ topic/ph pr-d/codeph ">TextFormat.indent</codeph>) affects only the first line of each paragraph.
If this property is <codeph class="+ topic/ph pr-d/codeph ">null</codeph>, the TextFormat object does not specify block indentation
(block indentation is 0).
</apiDesc><example class="- topic/example ">Please see the <xref href="TextFormat.html#TextFormat()" class="- topic/xref ">TextFormat() constructor</xref> example
for an illustration of how to use this property.
</example></apiValueDetail></apiValue><apiValue id="flash.text:TextFormat:bold:get" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiValue/apiValue "><apiName class="- topic/title reference/title apiRef/apiName ">bold</apiName><shortdesc class="- topic/shortdesc ">
Specifies whether the text is boldface.</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="Flash" version="9." class="+ topic/ph adobe-api-d/apiPlatform "/><apiPlatform description="" name="Lite" version="4" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata><asCustoms class="+ topic/metadata adobe-api-d/asCustoms "><keyword class="- topic/keyword ">TextFormat, TextFormat.bold, bold
</keyword></asCustoms></prolog><apiValueDetail class="- topic/body reference/refbody apiRef/apiDetail apiValue/apiValueDetail "><apiValueDef class="- topic/section reference/section apiRef/apiDef apiValue/apiValueDef "><apiProperty class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiProperty "/><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiDynamic class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiDynamic "/><apiValueAccess value="readwrite" class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiValueAccess "/><apiValueClassifier class="- topic/xref reference/xref apiRef/apiRelation apiValue/apiValueClassifier ">Object</apiValueClassifier></apiValueDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
Specifies whether the text is boldface. The default value is <codeph class="+ topic/ph pr-d/codeph ">null</codeph>,
which means no boldface is used.
If the value is <codeph class="+ topic/ph pr-d/codeph ">true</codeph>, then
the text is boldface.
</apiDesc><example class="- topic/example ">Please see the <xref href="TextFormat.html#TextFormat()" class="- topic/xref ">TextFormat() constructor</xref> example
for an illustration of how to use this property.
</example></apiValueDetail></apiValue><apiValue id="flash.text:TextFormat:bullet:get" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiValue/apiValue "><apiName class="- topic/title reference/title apiRef/apiName ">bullet</apiName><shortdesc class="- topic/shortdesc ">
Indicates that the text is part of a bulleted list.</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="Flash" version="9." class="+ topic/ph adobe-api-d/apiPlatform "/><apiPlatform description="" name="Lite" version="4" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata><asCustoms class="+ topic/metadata adobe-api-d/asCustoms "><keyword class="- topic/keyword ">TextFormat, TextFormat.bullet, bullet
</keyword></asCustoms></prolog><apiValueDetail class="- topic/body reference/refbody apiRef/apiDetail apiValue/apiValueDetail "><apiValueDef class="- topic/section reference/section apiRef/apiDef apiValue/apiValueDef "><apiProperty class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiProperty "/><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiDynamic class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiDynamic "/><apiValueAccess value="readwrite" class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiValueAccess "/><apiValueClassifier class="- topic/xref reference/xref apiRef/apiRelation apiValue/apiValueClassifier ">Object</apiValueClassifier></apiValueDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
Indicates that the text is part of a bulleted list. In a bulleted
list, each paragraph of text is indented. To the left of the first line of each paragraph, a bullet
symbol is displayed. The default value is <codeph class="+ topic/ph pr-d/codeph ">null</codeph>, which means no bulleted list
is used.
</apiDesc><example class="- topic/example ">Please see the <xref href="TextFormat.html#TextFormat()" class="- topic/xref ">TextFormat() constructor</xref> example
for an illustration of how to use this property.
</example></apiValueDetail></apiValue><apiValue id="flash.text:TextFormat:color:get" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiValue/apiValue "><apiName class="- topic/title reference/title apiRef/apiName ">color</apiName><shortdesc class="- topic/shortdesc ">
Indicates the color of the text.</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="Flash" version="9." class="+ topic/ph adobe-api-d/apiPlatform "/><apiPlatform description="" name="Lite" version="4" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata><asCustoms class="+ topic/metadata adobe-api-d/asCustoms "><keyword class="- topic/keyword ">TextFormat, TextFormat.color, color
</keyword></asCustoms></prolog><apiValueDetail class="- topic/body reference/refbody apiRef/apiDetail apiValue/apiValueDetail "><apiValueDef class="- topic/section reference/section apiRef/apiDef apiValue/apiValueDef "><apiProperty class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiProperty "/><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiDynamic class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiDynamic "/><apiValueAccess value="readwrite" class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiValueAccess "/><apiValueClassifier class="- topic/xref reference/xref apiRef/apiRelation apiValue/apiValueClassifier ">Object</apiValueClassifier></apiValueDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
Indicates the color of the text. A number containing three 8-bit RGB components; for example,
0xFF0000 is red, and 0x00FF00 is green. The default value is <codeph class="+ topic/ph pr-d/codeph ">null</codeph>,
which means that Flash Player uses the color black (0x000000).
</apiDesc><example class="- topic/example ">Please see the <xref href="TextFormat.html#TextFormat()" class="- topic/xref ">TextFormat() constructor</xref> example
for an illustration of how to use this property.
</example></apiValueDetail></apiValue><apiValue id="flash.text:TextFormat:font:get" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiValue/apiValue "><apiName class="- topic/title reference/title apiRef/apiName ">font</apiName><shortdesc class="- topic/shortdesc ">
The name of the font for text in this text format, as a string.</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="Flash" version="9." class="+ topic/ph adobe-api-d/apiPlatform "/><apiPlatform description="" name="Lite" version="4" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata><asCustoms class="+ topic/metadata adobe-api-d/asCustoms "><keyword class="- topic/keyword ">TextFormat, TextFormat.font, font
</keyword></asCustoms></prolog><apiValueDetail class="- topic/body reference/refbody apiRef/apiDetail apiValue/apiValueDetail "><apiValueDef class="- topic/section reference/section apiRef/apiDef apiValue/apiValueDef "><apiProperty class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiProperty "/><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiDynamic class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiDynamic "/><apiValueAccess value="readwrite" class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiValueAccess "/><apiValueClassifier class="- topic/xref reference/xref apiRef/apiRelation apiValue/apiValueClassifier ">String</apiValueClassifier></apiValueDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
The name of the font for text in this text format, as a string. The default value is
<codeph class="+ topic/ph pr-d/codeph ">null</codeph>, which means that Flash Player uses Times New Roman font for the text.
</apiDesc><example class="- topic/example ">Please see the <xref href="TextFormat.html#TextFormat()" class="- topic/xref ">TextFormat() constructor</xref> example
for an illustration of how to use this property.
</example></apiValueDetail></apiValue><apiValue id="flash.text:TextFormat:indent:get" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiValue/apiValue "><apiName class="- topic/title reference/title apiRef/apiName ">indent</apiName><shortdesc class="- topic/shortdesc ">
Indicates the indentation from the left
margin to the first character in the paragraph.</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="Flash" version="9." class="+ topic/ph adobe-api-d/apiPlatform "/><apiPlatform description="" name="Lite" version="4" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata><asCustoms class="+ topic/metadata adobe-api-d/asCustoms "><keyword class="- topic/keyword ">TextFormat, TextFormat.indent, indent
</keyword></asCustoms></prolog><apiValueDetail class="- topic/body reference/refbody apiRef/apiDetail apiValue/apiValueDetail "><apiValueDef class="- topic/section reference/section apiRef/apiDef apiValue/apiValueDef "><apiProperty class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiProperty "/><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiDynamic class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiDynamic "/><apiValueAccess value="readwrite" class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiValueAccess "/><apiValueClassifier class="- topic/xref reference/xref apiRef/apiRelation apiValue/apiValueClassifier ">Object</apiValueClassifier></apiValueDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
Indicates the indentation from the left
margin to the first character in the paragraph. The default value is <codeph class="+ topic/ph pr-d/codeph ">null</codeph>, which
indicates that no indentation is used.
</apiDesc><example class="- topic/example ">Please see the <xref href="TextFormat.html#TextFormat()" class="- topic/xref ">TextFormat() constructor</xref> example
for an illustration of how to use this property.
</example></apiValueDetail><related-links class="- topic/related-links "><link href="flash.text.xml#TextFormat/blockIndent" class="- topic/link "><linktext class="- topic/linktext ">flash.text.TextFormat.blockIndent</linktext></link></related-links></apiValue><apiValue id="flash.text:TextFormat:italic:get" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiValue/apiValue "><apiName class="- topic/title reference/title apiRef/apiName ">italic</apiName><shortdesc class="- topic/shortdesc ">
Indicates whether text in this text format is italicized.</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="Flash" version="9." class="+ topic/ph adobe-api-d/apiPlatform "/><apiPlatform description="" name="Lite" version="4" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata><asCustoms class="+ topic/metadata adobe-api-d/asCustoms "><keyword class="- topic/keyword ">TextFormat, TextFormat.italic, italic
</keyword></asCustoms></prolog><apiValueDetail class="- topic/body reference/refbody apiRef/apiDetail apiValue/apiValueDetail "><apiValueDef class="- topic/section reference/section apiRef/apiDef apiValue/apiValueDef "><apiProperty class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiProperty "/><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiDynamic class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiDynamic "/><apiValueAccess value="readwrite" class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiValueAccess "/><apiValueClassifier class="- topic/xref reference/xref apiRef/apiRelation apiValue/apiValueClassifier ">Object</apiValueClassifier></apiValueDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
Indicates whether text in this text format is italicized. The default
value is <codeph class="+ topic/ph pr-d/codeph ">null</codeph>, which means no italics are used.
</apiDesc><example class="- topic/example ">Please see the <xref href="TextFormat.html#TextFormat()" class="- topic/xref ">TextFormat() constructor</xref> example
for an illustration of how to use this property.
</example></apiValueDetail></apiValue><apiValue id="flash.text:TextFormat:kerning:get" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiValue/apiValue "><apiName class="- topic/title reference/title apiRef/apiName ">kerning</apiName><shortdesc class="- topic/shortdesc ">
A Boolean value that indicates whether kerning is enabled (true)
or disabled (false).</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="Flash" version="9." class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata><asCustoms class="+ topic/metadata adobe-api-d/asCustoms "><internal>Add better description and example.
</internal></asCustoms></prolog><apiValueDetail class="- topic/body reference/refbody apiRef/apiDetail apiValue/apiValueDetail "><apiValueDef class="- topic/section reference/section apiRef/apiDef apiValue/apiValueDef "><apiProperty class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiProperty "/><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiDynamic class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiDynamic "/><apiValueAccess value="readwrite" class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiValueAccess "/><apiValueClassifier class="- topic/xref reference/xref apiRef/apiRelation apiValue/apiValueClassifier ">Object</apiValueClassifier></apiValueDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
A Boolean value that indicates whether kerning is enabled (<codeph class="+ topic/ph pr-d/codeph ">true</codeph>)
or disabled (<codeph class="+ topic/ph pr-d/codeph ">false</codeph>). Kerning adjusts the pixels between certain character pairs to improve readability, and
should be used only when necessary, such as with headings in large fonts. Kerning is
supported for embedded fonts only.
<p class="- topic/p ">Certain fonts such as Verdana and monospaced fonts,
such as Courier New, do not support kerning.</p>
<p class="- topic/p ">The default value is <codeph class="+ topic/ph pr-d/codeph ">null</codeph>, which means that kerning is not enabled.</p>
</apiDesc></apiValueDetail></apiValue><apiValue id="flash.text:TextFormat:leading:get" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiValue/apiValue "><apiName class="- topic/title reference/title apiRef/apiName ">leading</apiName><shortdesc class="- topic/shortdesc ">
An integer representing the amount of vertical space (called leading)
between lines.</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="Flash" version="9." class="+ topic/ph adobe-api-d/apiPlatform "/><apiPlatform description="" name="Lite" version="4" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata><asCustoms class="+ topic/metadata adobe-api-d/asCustoms "><keyword class="- topic/keyword ">TextFormat, TextFormat.leading, leading
</keyword></asCustoms></prolog><apiValueDetail class="- topic/body reference/refbody apiRef/apiDetail apiValue/apiValueDetail "><apiValueDef class="- topic/section reference/section apiRef/apiDef apiValue/apiValueDef "><apiProperty class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiProperty "/><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiDynamic class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiDynamic "/><apiValueAccess value="readwrite" class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiValueAccess "/><apiValueClassifier class="- topic/xref reference/xref apiRef/apiRelation apiValue/apiValueClassifier ">Object</apiValueClassifier></apiValueDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
An integer representing the amount of vertical space (called <i class="+ topic/ph hi-d/i ">leading</i>)
between lines. The default value is <codeph class="+ topic/ph pr-d/codeph ">null</codeph>, which indicates that the
amount of leading used is 0.
</apiDesc><example class="- topic/example ">Please see the <xref href="TextFormat.html#TextFormat()" class="- topic/xref ">TextFormat() constructor</xref> example
for an illustration of how to use this property.
</example></apiValueDetail></apiValue><apiValue id="flash.text:TextFormat:leftMargin:get" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiValue/apiValue "><apiName class="- topic/title reference/title apiRef/apiName ">leftMargin</apiName><shortdesc class="- topic/shortdesc ">
The left margin of the paragraph, in pixels.</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="Flash" version="9." class="+ topic/ph adobe-api-d/apiPlatform "/><apiPlatform description="" name="Lite" version="4" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata><asCustoms class="+ topic/metadata adobe-api-d/asCustoms "><keyword class="- topic/keyword ">TextFormat, TextFormat.leftMargin, leftMargin
</keyword></asCustoms></prolog><apiValueDetail class="- topic/body reference/refbody apiRef/apiDetail apiValue/apiValueDetail "><apiValueDef class="- topic/section reference/section apiRef/apiDef apiValue/apiValueDef "><apiProperty class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiProperty "/><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiDynamic class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiDynamic "/><apiValueAccess value="readwrite" class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiValueAccess "/><apiValueClassifier class="- topic/xref reference/xref apiRef/apiRelation apiValue/apiValueClassifier ">Object</apiValueClassifier></apiValueDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
The left margin of the paragraph, in pixels. The default value is <codeph class="+ topic/ph pr-d/codeph ">null</codeph>, which
indicates that the left margin is 0 pixels.
</apiDesc><example class="- topic/example ">Please see the <xref href="TextFormat.html#TextFormat()" class="- topic/xref ">TextFormat() constructor</xref> example
for an illustration of how to use this property.
</example></apiValueDetail></apiValue><apiValue id="flash.text:TextFormat:letterSpacing:get" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiValue/apiValue "><apiName class="- topic/title reference/title apiRef/apiName ">letterSpacing</apiName><shortdesc class="- topic/shortdesc ">
A number representing the amount of space that is uniformly distributed between all characters.</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="Flash" version="9." class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata><asCustoms class="+ topic/metadata adobe-api-d/asCustoms "><internal>Add better description and example.
</internal></asCustoms></prolog><apiValueDetail class="- topic/body reference/refbody apiRef/apiDetail apiValue/apiValueDetail "><apiValueDef class="- topic/section reference/section apiRef/apiDef apiValue/apiValueDef "><apiProperty class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiProperty "/><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiDynamic class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiDynamic "/><apiValueAccess value="readwrite" class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiValueAccess "/><apiValueClassifier class="- topic/xref reference/xref apiRef/apiRelation apiValue/apiValueClassifier ">Object</apiValueClassifier></apiValueDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
A number representing the amount of space that is uniformly distributed between all characters.
The value specifies the number of pixels that are added to the advance after each character.
The default value is <codeph class="+ topic/ph pr-d/codeph ">null</codeph>, which means that 0 pixels of letter spacing is used.
You can use decimal values such as <codeph class="+ topic/ph pr-d/codeph ">1.75</codeph>.
</apiDesc><example class="- topic/example ">Please see the <xref href="TextFormat.html#TextFormat()" class="- topic/xref ">TextFormat() constructor</xref> example
for an illustration of how to use this property.
</example></apiValueDetail></apiValue><apiValue id="flash.text:TextFormat:rightMargin:get" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiValue/apiValue "><apiName class="- topic/title reference/title apiRef/apiName ">rightMargin</apiName><shortdesc class="- topic/shortdesc ">
The right margin of the paragraph, in pixels.</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="Flash" version="9." class="+ topic/ph adobe-api-d/apiPlatform "/><apiPlatform description="" name="Lite" version="4" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata><asCustoms class="+ topic/metadata adobe-api-d/asCustoms "><keyword class="- topic/keyword ">TextFormat, TextFormat.rightMargin, rightMargin
</keyword></asCustoms></prolog><apiValueDetail class="- topic/body reference/refbody apiRef/apiDetail apiValue/apiValueDetail "><apiValueDef class="- topic/section reference/section apiRef/apiDef apiValue/apiValueDef "><apiProperty class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiProperty "/><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiDynamic class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiDynamic "/><apiValueAccess value="readwrite" class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiValueAccess "/><apiValueClassifier class="- topic/xref reference/xref apiRef/apiRelation apiValue/apiValueClassifier ">Object</apiValueClassifier></apiValueDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
The right margin of the paragraph, in pixels. The default value is <codeph class="+ topic/ph pr-d/codeph ">null</codeph>,
which indicates that the right margin is 0 pixels.
</apiDesc><example class="- topic/example ">Please see the <xref href="TextFormat.html#TextFormat()" class="- topic/xref ">TextFormat() constructor</xref> example
for an illustration of how to use this property.
</example></apiValueDetail></apiValue><apiValue id="flash.text:TextFormat:size:get" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiValue/apiValue "><apiName class="- topic/title reference/title apiRef/apiName ">size</apiName><shortdesc class="- topic/shortdesc ">
The size in pixels of text in this text format.</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="Flash" version="9." class="+ topic/ph adobe-api-d/apiPlatform "/><apiPlatform description="" name="Lite" version="4" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata><asCustoms class="+ topic/metadata adobe-api-d/asCustoms "><keyword class="- topic/keyword ">TextFormat, TextFormat.size, size
</keyword></asCustoms></prolog><apiValueDetail class="- topic/body reference/refbody apiRef/apiDetail apiValue/apiValueDetail "><apiValueDef class="- topic/section reference/section apiRef/apiDef apiValue/apiValueDef "><apiProperty class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiProperty "/><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiDynamic class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiDynamic "/><apiValueAccess value="readwrite" class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiValueAccess "/><apiValueClassifier class="- topic/xref reference/xref apiRef/apiRelation apiValue/apiValueClassifier ">Object</apiValueClassifier></apiValueDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
The size in pixels of text in this text format. The default value is <codeph class="+ topic/ph pr-d/codeph ">null</codeph>, which
means that a size of 12 is used.
</apiDesc><example class="- topic/example ">Please see the <xref href="TextFormat.html#TextFormat()" class="- topic/xref ">TextFormat() constructor</xref> example
for an illustration of how to use this property.
</example></apiValueDetail></apiValue><apiValue id="flash.text:TextFormat:tabStops:get" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiValue/apiValue "><apiName class="- topic/title reference/title apiRef/apiName ">tabStops</apiName><shortdesc class="- topic/shortdesc ">
Specifies custom tab stops as an array of non-negative integers.</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="Flash" version="9." class="+ topic/ph adobe-api-d/apiPlatform "/><apiPlatform description="" name="Lite" version="4" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata><asCustoms class="+ topic/metadata adobe-api-d/asCustoms "><keyword class="- topic/keyword ">TextFormat, TextFormat.tabStops, tabStops
</keyword></asCustoms></prolog><apiValueDetail class="- topic/body reference/refbody apiRef/apiDetail apiValue/apiValueDetail "><apiValueDef class="- topic/section reference/section apiRef/apiDef apiValue/apiValueDef "><apiProperty class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiProperty "/><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiDynamic class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiDynamic "/><apiValueAccess value="readwrite" class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiValueAccess "/><apiValueClassifier class="- topic/xref reference/xref apiRef/apiRelation apiValue/apiValueClassifier ">Array</apiValueClassifier></apiValueDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
Specifies custom tab stops as an array of non-negative integers. Each tab stop is
specified in pixels. If custom tab stops are not specified (<codeph class="+ topic/ph pr-d/codeph ">null</codeph>), the default tab
stop is 4 (average character width).
</apiDesc><example class="- topic/example ">Please see the <xref href="TextFormat.html#TextFormat()" class="- topic/xref ">TextFormat() constructor</xref> example
for an illustration of how to use this property.
</example></apiValueDetail></apiValue><apiValue id="flash.text:TextFormat:target:get" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiValue/apiValue "><apiName class="- topic/title reference/title apiRef/apiName ">target</apiName><shortdesc class="- topic/shortdesc ">
Indicates the target window where the hyperlink is displayed.</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="Flash" version="9." class="+ topic/ph adobe-api-d/apiPlatform "/><apiPlatform description="" name="Lite" version="4" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata><asCustoms class="+ topic/metadata adobe-api-d/asCustoms "><keyword class="- topic/keyword ">TextFormat, TextFormat.target, target
</keyword></asCustoms></prolog><apiValueDetail class="- topic/body reference/refbody apiRef/apiDetail apiValue/apiValueDetail "><apiValueDef class="- topic/section reference/section apiRef/apiDef apiValue/apiValueDef "><apiProperty class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiProperty "/><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiDynamic class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiDynamic "/><apiValueAccess value="readwrite" class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiValueAccess "/><apiValueClassifier class="- topic/xref reference/xref apiRef/apiRelation apiValue/apiValueClassifier ">String</apiValueClassifier></apiValueDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
Indicates the target window where the hyperlink is displayed. If the target window is an
empty string, the text is displayed in the default target window <codeph class="+ topic/ph pr-d/codeph ">_self</codeph>. You can choose
a custom name or one of the following four names: <codeph class="+ topic/ph pr-d/codeph ">_self</codeph> specifies the current frame in
the current window, <codeph class="+ topic/ph pr-d/codeph ">_blank</codeph> specifies a new window, <codeph class="+ topic/ph pr-d/codeph ">_parent</codeph> specifies the
parent of the current frame, and <codeph class="+ topic/ph pr-d/codeph ">_top</codeph> specifies the top-level frame in the current
window. If the <codeph class="+ topic/ph pr-d/codeph ">TextFormat.url</codeph> property is an empty string or <codeph class="+ topic/ph pr-d/codeph ">null</codeph>,
you can get or set this property, but the property will have no effect.
</apiDesc><example class="- topic/example ">Please see the <xref href="TextFormat.html#TextFormat()" class="- topic/xref ">TextFormat() constructor</xref> example
for an illustration of how to use this property.
</example></apiValueDetail><related-links class="- topic/related-links "><link href="flash.text.xml#TextFormat/url" class="- topic/link "><linktext class="- topic/linktext ">flash.text.TextFormat.url</linktext></link></related-links></apiValue><apiValue id="flash.text:TextFormat:underline:get" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiValue/apiValue "><apiName class="- topic/title reference/title apiRef/apiName ">underline</apiName><shortdesc class="- topic/shortdesc ">
Indicates whether the text that uses this text format is underlined (true)
or not (false).</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="Flash" version="9." class="+ topic/ph adobe-api-d/apiPlatform "/><apiPlatform description="" name="Lite" version="4" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata><asCustoms class="+ topic/metadata adobe-api-d/asCustoms "><keyword class="- topic/keyword ">TextFormat, TextFormat.underline, underline
</keyword></asCustoms></prolog><apiValueDetail class="- topic/body reference/refbody apiRef/apiDetail apiValue/apiValueDetail "><apiValueDef class="- topic/section reference/section apiRef/apiDef apiValue/apiValueDef "><apiProperty class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiProperty "/><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiDynamic class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiDynamic "/><apiValueAccess value="readwrite" class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiValueAccess "/><apiValueClassifier class="- topic/xref reference/xref apiRef/apiRelation apiValue/apiValueClassifier ">Object</apiValueClassifier></apiValueDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
Indicates whether the text that uses this text format is underlined (<codeph class="+ topic/ph pr-d/codeph ">true</codeph>)
or not (<codeph class="+ topic/ph pr-d/codeph ">false</codeph>). This underlining is similar to that produced by the
<codeph class="+ topic/ph pr-d/codeph ">&lt;U&gt;</codeph> tag, but the latter is not true underlining, because it does not skip
descenders correctly. The default value is <codeph class="+ topic/ph pr-d/codeph ">null</codeph>, which indicates that underlining
is not used.
</apiDesc><example class="- topic/example ">Please see the <xref href="TextFormat.html#TextFormat()" class="- topic/xref ">TextFormat() constructor</xref> example
for an illustration of how to use this property.
</example></apiValueDetail></apiValue><apiValue id="flash.text:TextFormat:url:get" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiValue/apiValue "><apiName class="- topic/title reference/title apiRef/apiName ">url</apiName><shortdesc class="- topic/shortdesc ">
Indicates the target URL for the text in this text format.</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="Flash" version="9." class="+ topic/ph adobe-api-d/apiPlatform "/><apiPlatform description="" name="Lite" version="4" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata><asCustoms class="+ topic/metadata adobe-api-d/asCustoms "><keyword class="- topic/keyword ">TextFormat, TextFormat.url, url
</keyword></asCustoms></prolog><apiValueDetail class="- topic/body reference/refbody apiRef/apiDetail apiValue/apiValueDetail "><apiValueDef class="- topic/section reference/section apiRef/apiDef apiValue/apiValueDef "><apiProperty class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiProperty "/><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiDynamic class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiDynamic "/><apiValueAccess value="readwrite" class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiValueAccess "/><apiValueClassifier class="- topic/xref reference/xref apiRef/apiRelation apiValue/apiValueClassifier ">String</apiValueClassifier></apiValueDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
Indicates the target URL for the text in this text format. If the <codeph class="+ topic/ph pr-d/codeph ">url</codeph>
property is an empty string, the text does not have a hyperlink. The default value is <codeph class="+ topic/ph pr-d/codeph ">null</codeph>,
which indicates that the text does not have a hyperlink.
<p class="- topic/p "><b class="+ topic/ph hi-d/b ">Note:</b> The text with the assigned text format must be set with the <codeph class="+ topic/ph pr-d/codeph ">htmlText</codeph>
property for the hyperlink to work.</p>
</apiDesc><example class="- topic/example ">Please see the <xref href="TextFormat.html#TextFormat()" class="- topic/xref ">TextFormat() constructor</xref> example
for an illustration of how to use this property.
</example></apiValueDetail><related-links class="- topic/related-links "><link href="flash.text.xml#TextField/htmlText" class="- topic/link "><linktext class="- topic/linktext ">flash.text.TextField.htmlText</linktext></link></related-links></apiValue></apiClassifier><apiClassifier languages="" id="flash.text:TextDisplayMode" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiClassifier/apiClassifier "><apiName class="- topic/title reference/title apiRef/apiName ">TextDisplayMode</apiName><shortdesc class="- topic/shortdesc ">
The TextDisplayMode class contains values that control the subpixel anti-aliasing of the advanced anti-aliasing system.</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="Flash" version="9" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata></prolog><apiClassifierDetail class="- topic/body reference/refbody apiRef/apiDetail apiClassifier/apiClassifierDetail "><apiClassifierDef class="- topic/section reference/section apiRef/apiDef apiClassifier/apiClassifierDef "><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiStatic class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiStatic "/><apiFinal class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiFinal "/><apiBaseClassifier class="- topic/xref reference/xref apiRef/apiRelation apiClassifier/apiBaseClassifier ">Object</apiBaseClassifier></apiClassifierDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
The TextDisplayMode class contains values that control the subpixel anti-aliasing of the advanced anti-aliasing system.
</apiDesc></apiClassifierDetail><related-links class="- topic/related-links "><link href="flash.text.xml#TextRenderer/displayMode" class="- topic/link "><linktext class="- topic/linktext ">flash.text.TextRenderer.displayMode</linktext></link></related-links><apiValue id="flash.text:TextDisplayMode:CRT" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiValue/apiValue "><apiName class="- topic/title reference/title apiRef/apiName ">CRT</apiName><shortdesc class="- topic/shortdesc ">
Forces Flash Player to display grayscale anti-aliasing.</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="Flash" version="9" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata></prolog><apiValueDetail class="- topic/body reference/refbody apiRef/apiDetail apiValue/apiValueDetail "><apiValueDef class="- topic/section reference/section apiRef/apiDef apiValue/apiValueDef "><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiStatic class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiStatic "/><apiData class="- topic/ph reference/ph apiRef/apiData ">crt</apiData><apiValueClassifier class="- topic/xref reference/xref apiRef/apiRelation apiValue/apiValueClassifier ">String</apiValueClassifier></apiValueDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
Forces Flash Player to display grayscale anti-aliasing. While this setting
avoids text coloring, some users may think it appears blurry.
</apiDesc></apiValueDetail></apiValue><apiValue id="flash.text:TextDisplayMode:DEFAULT" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiValue/apiValue "><apiName class="- topic/title reference/title apiRef/apiName ">DEFAULT</apiName><shortdesc class="- topic/shortdesc ">
Allows Flash Player to choose LCD or CRT mode.</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="Flash" version="9" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata></prolog><apiValueDetail class="- topic/body reference/refbody apiRef/apiDetail apiValue/apiValueDetail "><apiValueDef class="- topic/section reference/section apiRef/apiDef apiValue/apiValueDef "><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiStatic class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiStatic "/><apiData class="- topic/ph reference/ph apiRef/apiData ">default</apiData><apiValueClassifier class="- topic/xref reference/xref apiRef/apiRelation apiValue/apiValueClassifier ">String</apiValueClassifier></apiValueDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
Allows Flash Player to choose LCD or CRT mode.
</apiDesc></apiValueDetail></apiValue><apiValue id="flash.text:TextDisplayMode:LCD" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiValue/apiValue "><apiName class="- topic/title reference/title apiRef/apiName ">LCD</apiName><shortdesc class="- topic/shortdesc ">
Forces Flash Player to use LCD subpixel anti-aliasing.</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="Flash" version="9" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata></prolog><apiValueDetail class="- topic/body reference/refbody apiRef/apiDetail apiValue/apiValueDetail "><apiValueDef class="- topic/section reference/section apiRef/apiDef apiValue/apiValueDef "><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiStatic class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiStatic "/><apiData class="- topic/ph reference/ph apiRef/apiData ">lcd</apiData><apiValueClassifier class="- topic/xref reference/xref apiRef/apiRelation apiValue/apiValueClassifier ">String</apiValueClassifier></apiValueDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
Forces Flash Player to use LCD subpixel anti-aliasing. Depending on the font and
the hardware, this setting can result in much higher resolution text or text coloring.
</apiDesc></apiValueDetail></apiValue></apiClassifier><apiClassifier languages="" id="flash.text:AntiAliasType" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiClassifier/apiClassifier "><apiName class="- topic/title reference/title apiRef/apiName ">AntiAliasType</apiName><shortdesc class="- topic/shortdesc ">
The AntiAliasType class provides values for anti-aliasing in the flash.text.TextField class.</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="Flash" version="9" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata></prolog><apiClassifierDetail class="- topic/body reference/refbody apiRef/apiDetail apiClassifier/apiClassifierDetail "><apiClassifierDef class="- topic/section reference/section apiRef/apiDef apiClassifier/apiClassifierDef "><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiStatic class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiStatic "/><apiFinal class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiFinal "/><apiBaseClassifier class="- topic/xref reference/xref apiRef/apiRelation apiClassifier/apiBaseClassifier ">Object</apiBaseClassifier></apiClassifierDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
The AntiAliasType class provides values for anti-aliasing in the flash.text.TextField class.
</apiDesc></apiClassifierDetail><related-links class="- topic/related-links "><link href="flash.text.xml#TextField" class="- topic/link "><linktext class="- topic/linktext ">flash.text.TextField</linktext></link></related-links><apiValue id="flash.text:AntiAliasType:ADVANCED" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiValue/apiValue "><apiName class="- topic/title reference/title apiRef/apiName ">ADVANCED</apiName><shortdesc class="- topic/shortdesc ">
Sets anti-aliasing to advanced anti-aliasing.</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="Flash" version="9" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata></prolog><apiValueDetail class="- topic/body reference/refbody apiRef/apiDetail apiValue/apiValueDetail "><apiValueDef class="- topic/section reference/section apiRef/apiDef apiValue/apiValueDef "><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiStatic class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiStatic "/><apiData class="- topic/ph reference/ph apiRef/apiData ">advanced</apiData><apiValueClassifier class="- topic/xref reference/xref apiRef/apiRelation apiValue/apiValueClassifier ">String</apiValueClassifier></apiValueDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
Sets anti-aliasing to advanced anti-aliasing. Advanced anti-aliasing
allows font faces to be rendered at very high quality at small sizes. It is best used
with applications that have a lot of small text. Advanced anti-aliasing is not recommended
for very large fonts (larger than 48 points).
This constant is used for the <codeph class="+ topic/ph pr-d/codeph ">antiAliasType</codeph> property in the TextField
class.
Use the syntax <codeph class="+ topic/ph pr-d/codeph ">AntiAliasType.ADVANCED</codeph>.
</apiDesc></apiValueDetail><related-links class="- topic/related-links "><link href="flash.text.xml#TextField/antiAliasType" class="- topic/link "><linktext class="- topic/linktext ">flash.text.TextField.antiAliasType</linktext></link></related-links></apiValue><apiValue id="flash.text:AntiAliasType:NORMAL" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiValue/apiValue "><apiName class="- topic/title reference/title apiRef/apiName ">NORMAL</apiName><shortdesc class="- topic/shortdesc ">
Sets anti-aliasing to the anti-aliasing that is used in Flash Player 7 and earlier.</shortdesc><prolog class="- topic/prolog "><author class="- topic/author ">Bob Pappas
</author><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="Flash" version="9" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata></prolog><apiValueDetail class="- topic/body reference/refbody apiRef/apiDetail apiValue/apiValueDetail "><apiValueDef class="- topic/section reference/section apiRef/apiDef apiValue/apiValueDef "><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiStatic class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiStatic "/><apiData class="- topic/ph reference/ph apiRef/apiData ">normal</apiData><apiValueClassifier class="- topic/xref reference/xref apiRef/apiRelation apiValue/apiValueClassifier ">String</apiValueClassifier></apiValueDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
Sets anti-aliasing to the anti-aliasing that is used in Flash Player 7 and earlier.
This setting is recommended for applications that do not have a lot of text.
This constant is used for the <codeph class="+ topic/ph pr-d/codeph ">antiAliasType</codeph> property in the TextField
class.
Use the syntax <codeph class="+ topic/ph pr-d/codeph ">AntiAliasType.NORMAL</codeph>.
</apiDesc></apiValueDetail><related-links class="- topic/related-links "><link href="flash.text.xml#TextField/antiAliasType" class="- topic/link "><linktext class="- topic/linktext ">flash.text.TextField.antiAliasType</linktext></link></related-links></apiValue></apiClassifier><apiClassifier languages="" id="flash.text:FontType" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiClassifier/apiClassifier "><apiName class="- topic/title reference/title apiRef/apiName ">FontType</apiName><shortdesc class="- topic/shortdesc ">
The FontType class contains the enumerated constants "embedded"
and "device" for the fontType property of the Font class.</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="Flash" version="9" class="+ topic/ph adobe-api-d/apiPlatform "/><apiPlatform description="" name="Lite" version="4" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata></prolog><apiClassifierDetail class="- topic/body reference/refbody apiRef/apiDetail apiClassifier/apiClassifierDetail "><apiClassifierDef class="- topic/section reference/section apiRef/apiDef apiClassifier/apiClassifierDef "><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiStatic class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiStatic "/><apiFinal class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiFinal "/><apiBaseClassifier class="- topic/xref reference/xref apiRef/apiRelation apiClassifier/apiBaseClassifier ">Object</apiBaseClassifier></apiClassifierDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
The FontType class contains the enumerated constants <codeph class="+ topic/ph pr-d/codeph ">"embedded"</codeph>
and <codeph class="+ topic/ph pr-d/codeph ">"device"</codeph> for the <codeph class="+ topic/ph pr-d/codeph ">fontType</codeph> property of the Font class.
</apiDesc></apiClassifierDetail><related-links class="- topic/related-links "><link href="flash.text.xml#Font/fontType" class="- topic/link "><linktext class="- topic/linktext ">flash.text.Font.fontType</linktext></link></related-links><apiValue id="flash.text:FontType:DEVICE" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiValue/apiValue "><apiName class="- topic/title reference/title apiRef/apiName ">DEVICE</apiName><shortdesc class="- topic/shortdesc ">
Indicates that this is a device font.</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage name="ActionScript" version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="Flash" version="9" class="+ topic/ph adobe-api-d/apiPlatform "/><apiPlatform description="" name="Lite" version="4" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata></prolog><apiValueDetail class="- topic/body reference/refbody apiRef/apiDetail apiValue/apiValueDetail "><apiValueDef class="- topic/section reference/section apiRef/apiDef apiValue/apiValueDef "><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiStatic class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiStatic "/><apiData class="- topic/ph reference/ph apiRef/apiData ">device</apiData><apiValueClassifier class="- topic/xref reference/xref apiRef/apiRelation apiValue/apiValueClassifier ">String</apiValueClassifier></apiValueDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
Indicates that this is a device font.
The SWF file renders fonts with those installed on the system.
<p class="- topic/p ">Using device fonts results in a smaller movie size, because font data
is not included in the file. Device fonts are often a good choice for
displaying text at small point sizes, because anti-aliased text can be blurry
at small sizes. Device fonts are also a good choice for large blocks of text,
such as scrolling text.</p>
<p class="- topic/p ">Text fields that use device fonts may not be displayed the same across different
systems and platforms, because they are rendered with fonts installed on the system.
For the same reason, device fonts are not anti-aliased and may appear jagged at
large point sizes.</p>
</apiDesc></apiValueDetail><related-links class="- topic/related-links "><link href="flash.text.xml#TextField/embedFonts" class="- topic/link "><linktext class="- topic/linktext ">TextField.embedFonts</linktext></link><link href="flash.text.engine.xml#FontDescription/fontLookup" class="- topic/link "><linktext class="- topic/linktext ">flash.text.engine.FontDescription.fontLookup</linktext></link></related-links></apiValue><apiValue id="flash.text:FontType:EMBEDDED_CFF" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiValue/apiValue "><apiName class="- topic/title reference/title apiRef/apiName ">EMBEDDED_CFF</apiName><shortdesc class="- topic/shortdesc ">
Indicates that this is an embedded CFF font.</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage name="ActionScript" version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="Flash" version="10" class="+ topic/ph adobe-api-d/apiPlatform "/><apiPlatform description="" name="AIR" version="1.5" class="+ topic/ph adobe-api-d/apiPlatform "/><apiPlatform description="" name="Lite" version="4" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata></prolog><apiValueDetail class="- topic/body reference/refbody apiRef/apiDetail apiValue/apiValueDetail "><apiValueDef class="- topic/section reference/section apiRef/apiDef apiValue/apiValueDef "><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiStatic class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiStatic "/><apiData class="- topic/ph reference/ph apiRef/apiData ">embeddedCFF</apiData><apiValueClassifier class="- topic/xref reference/xref apiRef/apiRelation apiValue/apiValueClassifier ">String</apiValueClassifier></apiValueDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
Indicates that this is an embedded CFF font.
Font outlines and a subset of OpenType tables are embedded in the published SWF file.
<p class="- topic/p ">Text that uses embedded CFF fonts is always displayed
in the chosen font, whether or not that font is installed
on the playback system. Also, text that uses embedded CFF fonts
is always anti-aliased (smoothed) by Flash Player. You
can select the rendering mode and hinting for an embedded CFF font using the
<codeph class="+ topic/ph pr-d/codeph ">flash.text.engine.FontDescription.renderingMode</codeph> and
<codeph class="+ topic/ph pr-d/codeph ">flash.text.engine.FontDescription.cffHinting</codeph> properties.</p>
<p class="- topic/p ">One drawback to embedded CFF fonts is that they increase the size of the SWF file.
However, embedded CFF fonts are typically 20% to 30% smaller than regular embedded fonts.</p>
<p class="- topic/p ">Fonts of type <codeph class="+ topic/ph pr-d/codeph ">EMBEDDED_CFF</codeph> can only be used by the flash.text.engine classes.
A TextField directed to use such a font will fail to render.</p>
</apiDesc></apiValueDetail><related-links class="- topic/related-links "><link href="flash.text.engine.xml#FontDescription/fontLookup" class="- topic/link "><linktext class="- topic/linktext ">flash.text.engine.FontDescription.fontLookup</linktext></link></related-links></apiValue><apiValue id="flash.text:FontType:EMBEDDED" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiValue/apiValue "><apiName class="- topic/title reference/title apiRef/apiName ">EMBEDDED</apiName><shortdesc class="- topic/shortdesc ">
Indicates that this is an embedded font.</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage name="ActionScript" version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="Flash" version="9" class="+ topic/ph adobe-api-d/apiPlatform "/><apiPlatform description="" name="Lite" version="4" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata></prolog><apiValueDetail class="- topic/body reference/refbody apiRef/apiDetail apiValue/apiValueDetail "><apiValueDef class="- topic/section reference/section apiRef/apiDef apiValue/apiValueDef "><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiStatic class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiStatic "/><apiData class="- topic/ph reference/ph apiRef/apiData ">embedded</apiData><apiValueClassifier class="- topic/xref reference/xref apiRef/apiRelation apiValue/apiValueClassifier ">String</apiValueClassifier></apiValueDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
Indicates that this is an embedded font.
Font outlines are embedded in the published SWF file.
<p class="- topic/p ">Text fields that use embedded fonts are always displayed
in the chosen font, whether or not that font is installed
on the playback system. Also, text fields that use embedded fonts
are always anti-aliased (smoothed). You
can select the amount of anti-aliasing you want by using the
<codeph class="+ topic/ph pr-d/codeph ">TextField.antiAliasType property</codeph>.</p>
<p class="- topic/p ">One drawback to embedded fonts is that they increase the size of the SWF file.</p>
<p class="- topic/p ">Fonts of type <codeph class="+ topic/ph pr-d/codeph ">EMBEDDED</codeph> can only be used by TextField.
If flash.text.engine classes are directed to use such a font they will fall back to device fonts.</p>
</apiDesc></apiValueDetail><related-links class="- topic/related-links "><link href="flash.text.xml#TextField/embedFonts" class="- topic/link "><linktext class="- topic/linktext ">TextField.embedFonts</linktext></link></related-links></apiValue></apiClassifier><apiClassifier languages="" id="flash.text:TextFormatAlign" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiClassifier/apiClassifier "><apiName class="- topic/title reference/title apiRef/apiName ">TextFormatAlign</apiName><shortdesc class="- topic/shortdesc ">
The TextFormatAlign class provides values for text alignment in the TextFormat class.</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="Flash" version="9" class="+ topic/ph adobe-api-d/apiPlatform "/><apiPlatform description="" name="Lite" version="4" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata></prolog><apiClassifierDetail class="- topic/body reference/refbody apiRef/apiDetail apiClassifier/apiClassifierDetail "><apiClassifierDef class="- topic/section reference/section apiRef/apiDef apiClassifier/apiClassifierDef "><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiStatic class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiStatic "/><apiFinal class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiFinal "/><apiBaseClassifier class="- topic/xref reference/xref apiRef/apiRelation apiClassifier/apiBaseClassifier ">Object</apiBaseClassifier></apiClassifierDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
The TextFormatAlign class provides values for text alignment in the TextFormat class.
</apiDesc></apiClassifierDetail><related-links class="- topic/related-links "><link href="flash.text.xml#TextFormat" class="- topic/link "><linktext class="- topic/linktext ">flash.text.TextFormat</linktext></link></related-links><apiValue id="flash.text:TextFormatAlign:CENTER" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiValue/apiValue "><apiName class="- topic/title reference/title apiRef/apiName ">CENTER</apiName><shortdesc class="- topic/shortdesc ">
Constant; centers the text in the text field.</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="Flash" version="9" class="+ topic/ph adobe-api-d/apiPlatform "/><apiPlatform description="" name="Lite" version="4" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata></prolog><apiValueDetail class="- topic/body reference/refbody apiRef/apiDetail apiValue/apiValueDetail "><apiValueDef class="- topic/section reference/section apiRef/apiDef apiValue/apiValueDef "><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiStatic class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiStatic "/><apiData class="- topic/ph reference/ph apiRef/apiData ">center</apiData><apiValueClassifier class="- topic/xref reference/xref apiRef/apiRelation apiValue/apiValueClassifier ">String</apiValueClassifier></apiValueDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
Constant; centers the text in the text field.
Use the syntax <codeph class="+ topic/ph pr-d/codeph ">TextFormatAlign.CENTER</codeph>.
</apiDesc></apiValueDetail><related-links class="- topic/related-links "><link href="flash.text.xml#TextFormat/align" class="- topic/link "><linktext class="- topic/linktext ">flash.text.TextFormat.align</linktext></link></related-links></apiValue><apiValue id="flash.text:TextFormatAlign:JUSTIFY" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiValue/apiValue "><apiName class="- topic/title reference/title apiRef/apiName ">JUSTIFY</apiName><shortdesc class="- topic/shortdesc ">
Constant; justifies text within the text field.</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="Flash" version="9" class="+ topic/ph adobe-api-d/apiPlatform "/><apiPlatform description="" name="Lite" version="4" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata></prolog><apiValueDetail class="- topic/body reference/refbody apiRef/apiDetail apiValue/apiValueDetail "><apiValueDef class="- topic/section reference/section apiRef/apiDef apiValue/apiValueDef "><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiStatic class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiStatic "/><apiData class="- topic/ph reference/ph apiRef/apiData ">justify</apiData><apiValueClassifier class="- topic/xref reference/xref apiRef/apiRelation apiValue/apiValueClassifier ">String</apiValueClassifier></apiValueDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
Constant; justifies text within the text field.
Use the syntax <codeph class="+ topic/ph pr-d/codeph ">TextFormatAlign.JUSTIFY</codeph>.
</apiDesc></apiValueDetail><related-links class="- topic/related-links "><link href="flash.text.xml#TextFormat/align" class="- topic/link "><linktext class="- topic/linktext ">flash.text.TextFormat.align</linktext></link></related-links></apiValue><apiValue id="flash.text:TextFormatAlign:LEFT" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiValue/apiValue "><apiName class="- topic/title reference/title apiRef/apiName ">LEFT</apiName><shortdesc class="- topic/shortdesc ">
Constant; aligns text to the left within the text field.</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="Flash" version="9" class="+ topic/ph adobe-api-d/apiPlatform "/><apiPlatform description="" name="Lite" version="4" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata></prolog><apiValueDetail class="- topic/body reference/refbody apiRef/apiDetail apiValue/apiValueDetail "><apiValueDef class="- topic/section reference/section apiRef/apiDef apiValue/apiValueDef "><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiStatic class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiStatic "/><apiData class="- topic/ph reference/ph apiRef/apiData ">left</apiData><apiValueClassifier class="- topic/xref reference/xref apiRef/apiRelation apiValue/apiValueClassifier ">String</apiValueClassifier></apiValueDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
Constant; aligns text to the left within the text field.
Use the syntax <codeph class="+ topic/ph pr-d/codeph ">TextFormatAlign.LEFT</codeph>.
</apiDesc></apiValueDetail><related-links class="- topic/related-links "><link href="flash.text.xml#TextFormat/align" class="- topic/link "><linktext class="- topic/linktext ">flash.text.TextFormat.align</linktext></link></related-links></apiValue><apiValue id="flash.text:TextFormatAlign:RIGHT" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiValue/apiValue "><apiName class="- topic/title reference/title apiRef/apiName ">RIGHT</apiName><shortdesc class="- topic/shortdesc ">
Constant; aligns text to the right within the text field.</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="Flash" version="9" class="+ topic/ph adobe-api-d/apiPlatform "/><apiPlatform description="" name="Lite" version="4" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata></prolog><apiValueDetail class="- topic/body reference/refbody apiRef/apiDetail apiValue/apiValueDetail "><apiValueDef class="- topic/section reference/section apiRef/apiDef apiValue/apiValueDef "><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiStatic class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiStatic "/><apiData class="- topic/ph reference/ph apiRef/apiData ">right</apiData><apiValueClassifier class="- topic/xref reference/xref apiRef/apiRelation apiValue/apiValueClassifier ">String</apiValueClassifier></apiValueDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
Constant; aligns text to the right within the text field.
Use the syntax <codeph class="+ topic/ph pr-d/codeph ">TextFormatAlign.RIGHT</codeph>.
</apiDesc></apiValueDetail><related-links class="- topic/related-links "><link href="flash.text.xml#TextFormat/align" class="- topic/link "><linktext class="- topic/linktext ">flash.text.TextFormat.align</linktext></link></related-links></apiValue></apiClassifier><apiClassifier languages="" id="flash.text:Font" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiClassifier/apiClassifier "><apiName class="- topic/title reference/title apiRef/apiName ">Font</apiName><shortdesc class="- topic/shortdesc ">
The Font class is used to manage embedded fonts in SWF files.</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="Flash" version="9" class="+ topic/ph adobe-api-d/apiPlatform "/><apiPlatform description="" name="Lite" version="4" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata></prolog><apiClassifierDetail class="- topic/body reference/refbody apiRef/apiDetail apiClassifier/apiClassifierDetail "><apiClassifierDef class="- topic/section reference/section apiRef/apiDef apiClassifier/apiClassifierDef "><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiStatic class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiStatic "/><apiBaseClassifier class="- topic/xref reference/xref apiRef/apiRelation apiClassifier/apiBaseClassifier ">Object</apiBaseClassifier></apiClassifierDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
The Font class is used to manage embedded fonts in SWF files. Embedded fonts
are represented as a subclass of the Font class. The Font class is currently useful only to
find out information about embedded fonts; you cannot alter a font by
using this class.
You cannot use the Font class to load external fonts, or to create an instance
of a Font object by itself. Use the Font class as an abstract base class.
</apiDesc></apiClassifierDetail><apiOperation id="flash.text:Font:enumerateFonts" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiOperation/apiOperation "><apiName class="- topic/title reference/title apiRef/apiName ">enumerateFonts</apiName><shortdesc class="- topic/shortdesc ">
Specifies whether to provide a list of the currently available embedded fonts.</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="Flash" version="9" class="+ topic/ph adobe-api-d/apiPlatform "/><apiPlatform description="" name="Lite" version="4" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata></prolog><apiOperationDetail class="- topic/body reference/refbody apiRef/apiDetail apiOperation/apiOperationDetail "><apiOperationDef class="- topic/section reference/section apiRef/apiDef apiOperation/apiOperationDef "><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiStatic class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiStatic "/><apiReturn class="- topic/ph reference/ph apiRef/apiDefItem apiOperation/apiReturn "><apiDesc class="- topic/section reference/section apiRef/apiDesc ">A list of available fonts as an array of Font objects.
</apiDesc><apiOperationClassifier class="- topic/xref reference/xref apiRef/apiRelation apiOperation/apiOperationClassifier ">Array</apiOperationClassifier></apiReturn><apiParam class="- topic/ph reference/ph apiRef/apiDefItem apiOperation/apiParam "><apiItemName class="- topic/keyword reference/keyword apiRef/apiItemName ">enumerateDeviceFonts</apiItemName><apiOperationClassifier class="- topic/xref reference/xref apiRef/apiRelation apiOperation/apiOperationClassifier ">Boolean</apiOperationClassifier><apiData class="- topic/ph reference/ph apiRef/apiData ">false</apiData><apiDesc class="- topic/section reference/section apiRef/apiDesc ">Indicates whether you want to limit the list to only the currently available embedded fonts.
If this is set to <codeph class="+ topic/ph pr-d/codeph ">true</codeph> then a list of all fonts, both device fonts and embedded fonts, is returned.
If this is set to <codeph class="+ topic/ph pr-d/codeph ">false</codeph> then only a list of embedded fonts is returned.
</apiDesc></apiParam></apiOperationDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
Specifies whether to provide a list of the currently available embedded fonts.
</apiDesc><example conref="examples\Font.enumerateFonts.1.as" class="- topic/example "> This example first calls the static method <codeph class="+ topic/ph pr-d/codeph ">Font.enumerateFonts()</codeph>
to get a list of all device and embedded fonts. Then it sorts the resulting Array of Font objects
by the <codeph class="+ topic/ph pr-d/codeph ">fontName</codeph> property.
<p class="- topic/p ">Next the example shows how to call the <codeph class="+ topic/ph pr-d/codeph ">Font.enumerateFonts()</codeph> method with the
<codeph class="+ topic/ph pr-d/codeph ">enumerateDeviceFonts</codeph> parameter set to false. The resulting Array only includes
embedded Font objects. (If you run this code within an application that does not contain
any embedded fonts, the <codeph class="+ topic/ph pr-d/codeph ">embeddedFonts</codeph> array will be empty.)</p>
<codeblock xml:space="preserve" class="+ topic/pre pr-d/codeblock ">
import flash.text.Font;
var allFonts:Array = Font.enumerateFonts(true);
allFonts.sortOn("fontName", Array.CASEINSENSITIVE);
var embeddedFonts:Array = Font.enumerateFonts(false);
embeddedFonts.sortOn("fontName", Array.CASEINSENSITIVE);
</codeblock></example></apiOperationDetail></apiOperation><apiOperation id="flash.text:Font:hasGlyphs" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiOperation/apiOperation "><apiName class="- topic/title reference/title apiRef/apiName ">hasGlyphs</apiName><shortdesc class="- topic/shortdesc ">
Specifies whether a provided string can be displayed using the currently assigned font.</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="Flash" version="9" class="+ topic/ph adobe-api-d/apiPlatform "/><apiPlatform description="" name="Lite" version="4" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata></prolog><apiOperationDetail class="- topic/body reference/refbody apiRef/apiDetail apiOperation/apiOperationDetail "><apiOperationDef class="- topic/section reference/section apiRef/apiDef apiOperation/apiOperationDef "><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiReturn class="- topic/ph reference/ph apiRef/apiDefItem apiOperation/apiReturn "><apiDesc class="- topic/section reference/section apiRef/apiDesc ">A value of <codeph class="+ topic/ph pr-d/codeph ">true</codeph> if the specified string can be fully displayed using this font.
</apiDesc><apiOperationClassifier class="- topic/xref reference/xref apiRef/apiRelation apiOperation/apiOperationClassifier ">Boolean</apiOperationClassifier></apiReturn><apiParam class="- topic/ph reference/ph apiRef/apiDefItem apiOperation/apiParam "><apiItemName class="- topic/keyword reference/keyword apiRef/apiItemName ">str</apiItemName><apiOperationClassifier class="- topic/xref reference/xref apiRef/apiRelation apiOperation/apiOperationClassifier ">String</apiOperationClassifier><apiDesc class="- topic/section reference/section apiRef/apiDesc ">The string to test against the current font.
</apiDesc></apiParam></apiOperationDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
Specifies whether a provided string can be displayed using the currently assigned font.
</apiDesc></apiOperationDetail></apiOperation><apiOperation id="flash.text:Font:registerFont" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiOperation/apiOperation "><apiName class="- topic/title reference/title apiRef/apiName ">registerFont</apiName><shortdesc class="- topic/shortdesc ">
Registers a font class in the global font list.</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="Flash" version="9" class="+ topic/ph adobe-api-d/apiPlatform "/><apiPlatform description="" name="Lite" version="4" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata></prolog><apiOperationDetail class="- topic/body reference/refbody apiRef/apiDetail apiOperation/apiOperationDetail "><apiOperationDef class="- topic/section reference/section apiRef/apiDef apiOperation/apiOperationDef "><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiStatic class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiStatic "/><apiReturn class="- topic/ph reference/ph apiRef/apiDefItem apiOperation/apiReturn "><apiType value="void" name="type" class="- topic/state reference/state apiRef/apiType "/></apiReturn><apiParam class="- topic/ph reference/ph apiRef/apiDefItem apiOperation/apiParam "><apiItemName class="- topic/keyword reference/keyword apiRef/apiItemName ">font</apiItemName><apiOperationClassifier class="- topic/xref reference/xref apiRef/apiRelation apiOperation/apiOperationClassifier ">Class</apiOperationClassifier><apiDesc class="- topic/section reference/section apiRef/apiDesc ">The class you want to add to the global font list.
</apiDesc></apiParam></apiOperationDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
Registers a font class in the global font list.
</apiDesc></apiOperationDetail></apiOperation><apiValue id="flash.text:Font:fontName:get" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiValue/apiValue "><apiName class="- topic/title reference/title apiRef/apiName ">fontName</apiName><shortdesc class="- topic/shortdesc ">
The name of an embedded font.</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="Flash" version="9" class="+ topic/ph adobe-api-d/apiPlatform "/><apiPlatform description="" name="Lite" version="4" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata></prolog><apiValueDetail class="- topic/body reference/refbody apiRef/apiDetail apiValue/apiValueDetail "><apiValueDef class="- topic/section reference/section apiRef/apiDef apiValue/apiValueDef "><apiProperty class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiProperty "/><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiDynamic class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiDynamic "/><apiValueAccess value="read" class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiValueAccess "/><apiValueClassifier class="- topic/xref reference/xref apiRef/apiRelation apiValue/apiValueClassifier ">String</apiValueClassifier></apiValueDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
The name of an embedded font.
</apiDesc><example conref="examples\Font_fontName.as" class="- topic/example "> The following example shows how you can use an embedded font with the Flash Professional ActionScript 3.0 CheckBox control by setting the textFormat and embedFonts styles.
Example provided by
<xref href="http://actionscriptexamples.com/2008/11/27/using-embedded-fonts-with-the-checkbox-control-in-flash-with-actionscript-30/" scope="_mmexternal" class="- topic/xref ">ActionScriptExamples.com</xref>.
<codeblock xml:space="preserve" class="+ topic/pre pr-d/codeblock ">
// Requires:
// - A CheckBox control UI component in Flash library.
// - An embedded font in Flash library with linkage class "MyFont" and Export for ActionScript checked.
//
import fl.controls.CheckBox;
var embeddedFont:Font = new MyFont();
var textFormat:TextFormat = new TextFormat();
textFormat.font = embeddedFont.fontName;
textFormat.size = 24;
var checkBox:CheckBox = new CheckBox();
checkBox.setStyle("textFormat", textFormat);
checkBox.setStyle("embedFonts", true);
checkBox.label = "The quick brown fox jumps over the lazy dog.";
checkBox.textField.autoSize = TextFieldAutoSize.LEFT;
checkBox.move(10, 10);
checkBox.validateNow();
addChild(checkBox);
</codeblock></example></apiValueDetail></apiValue><apiValue id="flash.text:Font:fontStyle:get" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiValue/apiValue "><apiName class="- topic/title reference/title apiRef/apiName ">fontStyle</apiName><shortdesc class="- topic/shortdesc ">
The style of the font.</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="Flash" version="9" class="+ topic/ph adobe-api-d/apiPlatform "/><apiPlatform description="" name="Lite" version="4" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata></prolog><apiValueDetail class="- topic/body reference/refbody apiRef/apiDetail apiValue/apiValueDetail "><apiValueDef class="- topic/section reference/section apiRef/apiDef apiValue/apiValueDef "><apiProperty class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiProperty "/><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiDynamic class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiDynamic "/><apiValueAccess value="read" class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiValueAccess "/><apiValueClassifier class="- topic/xref reference/xref apiRef/apiRelation apiValue/apiValueClassifier ">String</apiValueClassifier></apiValueDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
The style of the font. This value can be any of the values defined in the FontStyle class.
</apiDesc></apiValueDetail><related-links class="- topic/related-links "><link href="flash.text.xml#FontStyle" class="- topic/link "><linktext class="- topic/linktext ">flash.text.FontStyle</linktext></link></related-links></apiValue><apiValue id="flash.text:Font:fontType:get" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiValue/apiValue "><apiName class="- topic/title reference/title apiRef/apiName ">fontType</apiName><shortdesc class="- topic/shortdesc ">
The type of the font.</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="Flash" version="9" class="+ topic/ph adobe-api-d/apiPlatform "/><apiPlatform description="" name="Lite" version="4" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata></prolog><apiValueDetail class="- topic/body reference/refbody apiRef/apiDetail apiValue/apiValueDetail "><apiValueDef class="- topic/section reference/section apiRef/apiDef apiValue/apiValueDef "><apiProperty class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiProperty "/><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiDynamic class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiDynamic "/><apiValueAccess value="read" class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiValueAccess "/><apiValueClassifier class="- topic/xref reference/xref apiRef/apiRelation apiValue/apiValueClassifier ">String</apiValueClassifier></apiValueDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
The type of the font. This value can be any of the constants defined in the FontType class.
</apiDesc></apiValueDetail><related-links class="- topic/related-links "><link href="flash.text.xml#FontType" class="- topic/link "><linktext class="- topic/linktext ">flash.text.FontType</linktext></link></related-links></apiValue></apiClassifier><apiClassifier languages="" id="flash.text:TextRenderer" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiClassifier/apiClassifier "><apiName class="- topic/title reference/title apiRef/apiName ">TextRenderer</apiName><shortdesc class="- topic/shortdesc ">
The TextRenderer class provides functionality for the advanced anti-aliasing capability of
embedded fonts.</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="Flash" version="9" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata><asCustoms class="+ topic/metadata adobe-api-d/asCustoms "><internal>-- Class sample changed due to bug 193833
</internal></asCustoms></prolog><apiClassifierDetail class="- topic/body reference/refbody apiRef/apiDetail apiClassifier/apiClassifierDetail "><apiClassifierDef class="- topic/section reference/section apiRef/apiDef apiClassifier/apiClassifierDef "><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiStatic class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiStatic "/><apiFinal class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiFinal "/><apiTipTexts><apiTipText class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiTipText ">Controls the anti-aliasing of embedded fonts.
</apiTipText></apiTipTexts><apiBaseClassifier class="- topic/xref reference/xref apiRef/apiRelation apiClassifier/apiBaseClassifier ">Object</apiBaseClassifier></apiClassifierDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
The TextRenderer class provides functionality for the advanced anti-aliasing capability of
embedded fonts. Advanced anti-aliasing allows font faces to render at very high quality at
small sizes. Use advanced anti-aliasing with applications that have a lot of small text. Adobe does not recommend using advanced
anti-aliasing for very large fonts (larger than 48 points).
Advanced anti-aliasing is available in Flash Player 8 and later only.
<p class="- topic/p ">To set advanced anti-aliasing on a text field, set the <codeph class="+ topic/ph pr-d/codeph ">antiAliasType</codeph> property of
the TextField instance.</p>
<p class="- topic/p ">Advanced anti-aliasing provides continuous stroke modulation (CSM), which is continuous
modulation of both stroke weight and edge sharpness. As an advanced feature, you can
use the <codeph class="+ topic/ph pr-d/codeph ">setAdvancedAntiAliasingTable()</codeph> method to define settings for specific
typefaces and font sizes.</p>
</apiDesc><example conref="examples\TextRendererExample2.as" class="- topic/example "> The following example creates the TextRendererExample class
to demonstrate visual examples of advanced anti-aliasing settings with small
and large font sizes. Before testing this example, you will need to embed a
font.
If you are using Flex, embed a font in the following manner:
<ol class="- topic/ol "><li class="- topic/li ">Place the Georgia font, named georgia.ttf in the same directory as this AS file.</li><li class="- topic/li ">Add the following lines directly underneath the class definition:</li><li class="- topic/li "><codeph class="+ topic/ph pr-d/codeph ">[Embed(source="georgia.ttf", fontFamily="Georgia")]</codeph></li><li class="- topic/li "><codeph class="+ topic/ph pr-d/codeph ">private var embeddedFont:String;</codeph></li></ol>
If you are using Flash, embed a font in the following manner:
<ol class="- topic/ol "><li class="- topic/li ">Place a text field on the stage and select it.</li><li class="- topic/li ">In the Property Inspector, set that text field's font to Georgia</li><li class="- topic/li ">In the Property Inspector, press "Embed..." and select "All"</li></ol>
<p class="- topic/p "> <b class="+ topic/ph hi-d/b ">Notes:</b>
<ul class="- topic/ul "><li class="- topic/li ">You will need to compile the SWF file with "Local playback security" set to "Access local files only".</li></ul>
</p>
<codeblock xml:space="preserve" class="+ topic/pre pr-d/codeblock ">
package {
import flash.display.DisplayObject;
import flash.display.Sprite;
import flash.events.*;
import flash.text.*;
public class TextRendererExample2 extends Sprite {
private var gutter:int = 10;
public function TextRendererExample2() {
createTextField(8,AntiAliasType.NORMAL);
createTextField(8,AntiAliasType.ADVANCED);
createTextField(24,AntiAliasType.NORMAL);
createTextField(24,AntiAliasType.ADVANCED);
}
private function createTextField(fontSize:Number,antiAliasType:String):TextField {
var tf:TextField = new TextField();
tf.embedFonts = true;
tf.autoSize = TextFieldAutoSize.LEFT;
tf.antiAliasType = antiAliasType;
tf.defaultTextFormat = getTextFormat(fontSize);
tf.selectable = false;
tf.mouseEnabled = true;
tf.text = "The quick brown fox jumped over the lazy dog.";
if(numChildren &gt; 0) {
var sibling:DisplayObject = getChildAt(numChildren - 1);
tf.y = sibling.y + sibling.height + gutter;
}
addChild(tf);
return tf;
}
private function getTextFormat(fontSize:Number):TextFormat {
var format:TextFormat = new TextFormat();
format.size = fontSize;
format.font = "Georgia";
return format;
}
}
}
</codeblock></example></apiClassifierDetail><related-links class="- topic/related-links "><link href="flash.text.xml#TextField/antiAliasType" class="- topic/link "><linktext class="- topic/linktext ">flash.text.TextField.antiAliasType</linktext></link></related-links><apiOperation id="flash.text:TextRenderer:setAdvancedAntiAliasingTable" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiOperation/apiOperation "><apiName class="- topic/title reference/title apiRef/apiName ">setAdvancedAntiAliasingTable</apiName><shortdesc class="- topic/shortdesc ">
Sets a custom continuous stroke modulation (CSM) lookup table for a font.</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="Flash" version="9" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata><asCustoms class="+ topic/metadata adobe-api-d/asCustoms "><maelexample>The following example creates two anti-alias entries and two text fields to
illustrate them. For this example to work, the SWF file must have a shared font embedded with a linkage identifier of <code>
"myArial"</code>.
To embed the font, follow these steps:
<ol class="- topic/ol "><li class="- topic/li ">Open your Library.</li><li class="- topic/li ">Click the Library options menu in the upper-right corner of the Library.</li><li class="- topic/li ">Select New Font from the pop-up menu.</li><li class="- topic/li ">Name the font <b class="+ topic/ph hi-d/b ">myArial</b>.</li><li class="- topic/li ">Select Arial from the font pop-up menu.</li><li class="- topic/li ">Click OK.</li><li class="- topic/li ">Right-click the newly created font, and select Linkage.</li><li class="- topic/li ">Select the Export for ActionScript check box.</li><li class="- topic/li ">Click OK to accept the default identifier, myArial.</li></ol>
<listing version="2.0">
import flash.text.TextRenderer;
var antiAliasEntry_1 = {fontSize:24, insideCutoff:1.61, outsideCutoff:-3.43};
var antiAliasEntry_2 = {fontSize:48, insideCutoff:0.8, outsideCutoff:-0.8};
var arialTable:Array = new Array(antiAliasEntry_1, antiAliasEntry_2);
var lbl_1:TextField = createLabel(0, 0, 300, 100, 24);
var lbl_2:TextField = createLabel(0, 100, 300, 100, 48);
TextRenderer.setAdvancedAntiAliasingTable("Arial", "none", "dark", arialTable);
function createLabel(x:Number, y:Number, width:Number, height:Number, fontSize:Number):TextField {
var depth:Number = this.getNextHighestDepth();
var tmpTxt = this.createTextField("txt_" + depth, depth, x, y, width, height);
tmpTxt.antiAliasType = "advanced";
tmpTxt.gridFitType = "pixel";
tmpTxt.border = true;
tmpTxt.text = "Hello World";
tmpTxt.embedFonts = true;
tmpTxt.setTextFormat(getTextFormat(fontSize));
return tmpTxt;
}
function getTextFormat(fontSize:Number):TextFormat {
var tf:TextFormat = new TextFormat();
tf.align = "center";
tf.size = fontSize;
tf.font = "myArial";
return tf;
}
</listing>
</maelexample></asCustoms></prolog><apiOperationDetail class="- topic/body reference/refbody apiRef/apiDetail apiOperation/apiOperationDetail "><apiOperationDef class="- topic/section reference/section apiRef/apiDef apiOperation/apiOperationDef "><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiStatic class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiStatic "/><apiReturn class="- topic/ph reference/ph apiRef/apiDefItem apiOperation/apiReturn "><apiType value="void" name="type" class="- topic/state reference/state apiRef/apiType "/></apiReturn><apiParam class="- topic/ph reference/ph apiRef/apiDefItem apiOperation/apiParam "><apiItemName class="- topic/keyword reference/keyword apiRef/apiItemName ">fontName</apiItemName><apiOperationClassifier class="- topic/xref reference/xref apiRef/apiRelation apiOperation/apiOperationClassifier ">String</apiOperationClassifier><apiDesc class="- topic/section reference/section apiRef/apiDesc ">The name of the font for which you are applying settings.
</apiDesc></apiParam><apiParam class="- topic/ph reference/ph apiRef/apiDefItem apiOperation/apiParam "><apiItemName class="- topic/keyword reference/keyword apiRef/apiItemName ">fontStyle</apiItemName><apiOperationClassifier class="- topic/xref reference/xref apiRef/apiRelation apiOperation/apiOperationClassifier ">String</apiOperationClassifier><apiDesc class="- topic/section reference/section apiRef/apiDesc ">The font style indicated by using one of the values from
the flash.text.FontStyle class.
</apiDesc></apiParam><apiParam class="- topic/ph reference/ph apiRef/apiDefItem apiOperation/apiParam "><apiItemName class="- topic/keyword reference/keyword apiRef/apiItemName ">colorType</apiItemName><apiOperationClassifier class="- topic/xref reference/xref apiRef/apiRelation apiOperation/apiOperationClassifier ">String</apiOperationClassifier><apiDesc class="- topic/section reference/section apiRef/apiDesc ">This value determines whether the stroke is dark or whether it is light.
Use one of the values from the flash.text.TextColorType class.
</apiDesc></apiParam><apiParam class="- topic/ph reference/ph apiRef/apiDefItem apiOperation/apiParam "><apiItemName class="- topic/keyword reference/keyword apiRef/apiItemName ">advancedAntiAliasingTable</apiItemName><apiOperationClassifier class="- topic/xref reference/xref apiRef/apiRelation apiOperation/apiOperationClassifier ">Array</apiOperationClassifier><apiDesc class="- topic/section reference/section apiRef/apiDesc ">An array of one or more CSMSettings objects
for the specified font. Each object contains the following properties:
<ul class="- topic/ul "><li class="- topic/li "><codeph class="+ topic/ph pr-d/codeph ">fontSize</codeph></li><li class="- topic/li "><codeph class="+ topic/ph pr-d/codeph ">insideCutOff</codeph></li><li class="- topic/li "><codeph class="+ topic/ph pr-d/codeph ">outsideCutOff</codeph></li></ul>
<p class="- topic/p ">The <codeph class="+ topic/ph pr-d/codeph ">advancedAntiAliasingTable</codeph> array can contain multiple entries
that specify CSM settings for different font sizes.</p>
<p class="- topic/p ">The <codeph class="+ topic/ph pr-d/codeph ">fontSize</codeph> is the size, in pixels, for which the settings apply.</p>
<p class="- topic/p ">Advanced anti-aliasing uses adaptively sampled distance fields (ADFs) to
represent the outlines that determine a glyph. Flash Player uses an outside cutoff value
(<codeph class="+ topic/ph pr-d/codeph ">outsideCutOff</codeph>),
below which densities are set to zero, and an inside cutoff value (<codeph class="+ topic/ph pr-d/codeph ">insideCutOff</codeph>),
above which densities
are set to a maximum density value (such as 255). Between these two cutoff values,
the mapping function is a linear curve ranging from zero at the outside cutoff
to the maximum density at the inside cutoff.</p>
<p class="- topic/p ">Adjusting the outside and inside cutoff values affects stroke weight and
edge sharpness. The spacing between these two parameters is comparable to twice the
filter radius of classic anti-aliasing methods; a narrow spacing provides a sharper edge,
while a wider spacing provides a softer, more filtered edge. When
the spacing is zero, the resulting density image is a bi-level bitmap. When the
spacing is very wide, the resulting density image has a watercolor-like edge.</p>
<p class="- topic/p ">Typically, users prefer sharp, high-contrast edges at small point sizes, and
softer edges for animated text and larger point sizes. </p>
<p class="- topic/p ">The outside cutoff typically has a negative value, and the inside cutoff typically
has a positive value, and their midpoint typically lies near zero. Adjusting these
parameters to shift the midpoint toward negative infinity increases the stroke
weight; shifting the midpoint toward positive infinity decreases the stroke weight.
Make sure that the outside cutoff value is always less than or equal to the inside cutoff value.</p>
</apiDesc></apiParam></apiOperationDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
Sets a custom continuous stroke modulation (CSM) lookup table for a font.
Flash Player attempts to detect the best CSM for your font. If you are not
satisfied with the CSM that the Flash Player provides, you can customize
your own CSM by using the <codeph class="+ topic/ph pr-d/codeph ">setAdvancedAntiAliasingTable()</codeph> method.
</apiDesc></apiOperationDetail><related-links class="- topic/related-links "><link href="flash.text.xml#FontStyle" class="- topic/link "><linktext class="- topic/linktext ">flash.text.FontStyle</linktext></link><link href="flash.text.xml#TextColorType" class="- topic/link "><linktext class="- topic/linktext ">flash.text.TextColorType</linktext></link><link href="flash.text.xml#CSMSettings" class="- topic/link "><linktext class="- topic/linktext ">CSMSettings</linktext></link></related-links></apiOperation><apiValue id="flash.text:TextRenderer:displayMode:get" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiValue/apiValue "><apiName class="- topic/title reference/title apiRef/apiName ">displayMode</apiName><shortdesc class="- topic/shortdesc ">
Controls the rendering of advanced anti-aliased text.</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="Flash" version="9" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata></prolog><apiValueDetail class="- topic/body reference/refbody apiRef/apiDetail apiValue/apiValueDetail "><apiValueDef class="- topic/section reference/section apiRef/apiDef apiValue/apiValueDef "><apiProperty class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiProperty "/><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiStatic class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiStatic "/><apiValueAccess value="readwrite" class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiValueAccess "/><apiValueClassifier class="- topic/xref reference/xref apiRef/apiRelation apiValue/apiValueClassifier ">String</apiValueClassifier><apiDefaultValue>"default"
</apiDefaultValue></apiValueDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
Controls the rendering of advanced anti-aliased text. The visual quality of text is very subjective, and while
Flash Player tries to use the best settings for various conditions, designers may choose a different
look or feel for their text. Also, using <codeph class="+ topic/ph pr-d/codeph ">displayMode</codeph> allows a designer to override Flash
Player's subpixel choice and create visual consistency independent of the user's hardware. Use the values in the TextDisplayMode class to set this property.
</apiDesc></apiValueDetail><related-links class="- topic/related-links "><link href="flash.text.xml#TextDisplayMode" class="- topic/link "><linktext class="- topic/linktext ">TextDisplayMode class</linktext></link></related-links></apiValue><apiValue id="flash.text:TextRenderer:maxLevel:get" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiValue/apiValue "><apiName class="- topic/title reference/title apiRef/apiName ">maxLevel</apiName><shortdesc class="- topic/shortdesc ">
The adaptively sampled distance fields (ADFs) quality level for advanced anti-aliasing.</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="Flash" version="9" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata><asCustoms class="+ topic/metadata adobe-api-d/asCustoms "><maelexample>The following example specifies the <code>maxLevel</code> value for the entire
SWF file, and then displays a text field with the value set. For the
text in this example to display correctly, there must be a font symbol available with
a linkage identifier of <code>"CustomFont"</code>.
<listing version="2.0">
import flash.text.TextRenderer;
TextRenderer.maxLevel = 3;
var txtFormat:TextFormat = new TextFormat();
txtFormat.font = "CustomFont";
txtFormat.size = 64;
var label:TextField = this.createTextField("label", this.getNextHighestDepth(), 10, 10, 500, 100);
label.setNewTextFormat(txtFormat);
label.text = "Hello World";
label.embedFonts = true;
trace("TextRenderer.maxLevel: " + TextRenderer.maxLevel);
</listing>
</maelexample></asCustoms></prolog><apiValueDetail class="- topic/body reference/refbody apiRef/apiDetail apiValue/apiValueDetail "><apiValueDef class="- topic/section reference/section apiRef/apiDef apiValue/apiValueDef "><apiProperty class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiProperty "/><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiStatic class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiStatic "/><apiValueAccess value="readwrite" class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiValueAccess "/><apiValueClassifier class="- topic/xref reference/xref apiRef/apiRelation apiValue/apiValueClassifier ">int</apiValueClassifier><apiDefaultValue>4
</apiDefaultValue></apiValueDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
The adaptively sampled distance fields (ADFs) quality level for advanced anti-aliasing. The only acceptable values are
3, 4, and 7.
<p class="- topic/p ">Advanced anti-aliasing uses ADFs to
represent the outlines that determine a glyph. The higher the quality, the more
cache space is required for ADF structures. A value of <codeph class="+ topic/ph pr-d/codeph ">3</codeph> takes the least amount
of memory and provides the lowest quality. Larger fonts require more cache space;
at a font size of 64 pixels, the quality level increases from <codeph class="+ topic/ph pr-d/codeph ">3</codeph> to <codeph class="+ topic/ph pr-d/codeph ">4</codeph> or
from <codeph class="+ topic/ph pr-d/codeph ">4</codeph> to <codeph class="+ topic/ph pr-d/codeph ">7</codeph> unless, the level is already set to <codeph class="+ topic/ph pr-d/codeph ">7</codeph>.</p>
</apiDesc></apiValueDetail></apiValue></apiClassifier><apiClassifier languages="" id="flash.text:TextLineMetrics" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiClassifier/apiClassifier "><apiName class="- topic/title reference/title apiRef/apiName ">TextLineMetrics</apiName><shortdesc class="- topic/shortdesc ">
The TextLineMetrics class contains information about the text position and measurements of a
line of text within a text field.</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="Flash" version="9" class="+ topic/ph adobe-api-d/apiPlatform "/><apiPlatform description="" name="Lite" version="4" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata></prolog><apiClassifierDetail class="- topic/body reference/refbody apiRef/apiDetail apiClassifier/apiClassifierDetail "><apiClassifierDef class="- topic/section reference/section apiRef/apiDef apiClassifier/apiClassifierDef "><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiStatic class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiStatic "/><apiTipTexts><apiTipText class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiTipText ">Contains information about the text position and measurements of a line of text in a text field.
</apiTipText></apiTipTexts><apiBaseClassifier class="- topic/xref reference/xref apiRef/apiRelation apiClassifier/apiBaseClassifier ">Object</apiBaseClassifier></apiClassifierDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
The TextLineMetrics class contains information about the text position and measurements of a
<i class="+ topic/ph hi-d/i ">line of text</i> within a text field. All measurements are in pixels. Objects of this class are returned by the
<codeph class="+ topic/ph pr-d/codeph ">flash.text.TextField.getLineMetrics()</codeph> method.
<p class="- topic/p ">For measurements related to the text field containing the line of text (for example, the "Text Field height" measurement in the diagram), see flash.text.TextField. </p>
<p class="- topic/p ">The following diagram indicates the points and measurements of a text field and the line of text the field contains:</p>
<p class="- topic/p ">
<adobeimage alt="An image illustrating text metrics" href="../../images/text-metrics.jpg" placement="inline" class="+ topic/image adobe-d/adobeimage "/></p>
</apiDesc><example conref="examples\TextLineMetricsExample.as" class="- topic/example "> The following example creates the classes TextLineMetricsExample and
LineMetricsReader to print out a message in the Flash Player via an XML object. This
is accomplished using the following steps:
<ol class="- topic/ol "><li class="- topic/li ">Create a property called <codeph class="+ topic/ph pr-d/codeph ">label</codeph> of type TextField.</li><li class="- topic/li ">The constructor calls <codeph class="+ topic/ph pr-d/codeph ">configureAssets()</codeph>, which does the following:
<ul class="- topic/ul "><li class="- topic/li ">Sets the stage's alignment to top-left and no scale.</li><li class="- topic/li ">Creates a new TextField object named <codeph class="+ topic/ph pr-d/codeph ">label</codeph>.</li><li class="- topic/li ">Enables <codeph class="+ topic/ph pr-d/codeph ">label</codeph>'s background and sets the color to white.</li><li class="- topic/li ">Allows <codeph class="+ topic/ph pr-d/codeph ">label</codeph>'s text to span multiple lines with automatic word wrapping.</li><li class="- topic/li ">Assigns the result of a call to <codeph class="+ topic/ph pr-d/codeph ">getLabelText()</codeph> to the <codeph class="+ topic/ph pr-d/codeph ">text</codeph> property
of <codeph class="+ topic/ph pr-d/codeph ">label</codeph>. The <codeph class="+ topic/ph pr-d/codeph ">getLabelText()</codeph> method creates a variable of type XML and assigns
it to an XML node named <codeph class="+ topic/ph pr-d/codeph ">body</codeph>, which is populated with a long sentence.</li><li class="- topic/li ">Adds <codeph class="+ topic/ph pr-d/codeph ">label</codeph> to the display list using <codeph class="+ topic/ph pr-d/codeph ">addChild()</codeph>.</li></ul>
</li><li class="- topic/li ">A method that listens for <codeph class="+ topic/ph pr-d/codeph ">resize</codeph> events performed on the stage is then added called
<codeph class="+ topic/ph pr-d/codeph ">resizeHandler()</codeph>. Every time the Flash Player window size is changed, a <codeph class="+ topic/ph pr-d/codeph ">RESIZE</codeph>
event is dispatched and the following happens:
<ul class="- topic/ul "><li class="- topic/li "><codeph class="+ topic/ph pr-d/codeph ">draw()</codeph> is called to ensure that <codeph class="+ topic/ph pr-d/codeph ">label</codeph> appears in the center of the
stage and surrounded by a 10-pixel buffer.</li><li class="- topic/li "><codeph class="+ topic/ph pr-d/codeph ">setTimeout()</codeph> then executes <codeph class="+ topic/ph pr-d/codeph ">showMetrics()</codeph> after a short delay. The
delay is added because the line metrics are not updated until after the <codeph class="+ topic/ph pr-d/codeph ">RESIZE</codeph> event has
completed and the stage has fully re-drawn.</li><li class="- topic/li "><codeph class="+ topic/ph pr-d/codeph ">showMetrics()</codeph> assigns a TextLineMetrics variable named <codeph class="+ topic/ph pr-d/codeph ">metrics</codeph> to
the result of a call to <codeph class="+ topic/ph pr-d/codeph ">getLineMetrics()</codeph> and this variable is then passed to
a new instance of a LineMetricsReader instance named <codeph class="+ topic/ph pr-d/codeph ">reader</codeph>. The two
variables are then used within calls to <codeph class="+ topic/ph pr-d/codeph ">trace()</codeph> to print out the first (and only)
line of <codeph class="+ topic/ph pr-d/codeph ">label</codeph> and information provided by the LineMetricsReader instance through its
<codeph class="+ topic/ph pr-d/codeph ">toString()</codeph> method.</li></ul>
</li><li class="- topic/li ">The constructor forces a single dispatch of the <codeph class="+ topic/ph pr-d/codeph ">resize</codeph> event to force
<codeph class="+ topic/ph pr-d/codeph ">label</codeph> to be drawn correctly when the SWF file is first loaded.</li></ol>
<codeblock xml:space="preserve" class="+ topic/pre pr-d/codeblock ">
package {
import flash.display.Sprite;
import flash.display.StageAlign;
import flash.display.StageScaleMode;
import flash.events.*;
import flash.text.TextField;
import flash.text.TextLineMetrics;
import flash.utils.setTimeout;
public class TextLineMetricsExample extends Sprite {
private var gutter:int = 10;
private var label:TextField;
public function TextLineMetricsExample() {
configureAssets();
configureListeners();
resizeHandler(new Event(Event.RESIZE));
}
private function showMetrics():void {
var metrics:TextLineMetrics = label.getLineMetrics(0);
var reader:LineMetricsReader = new LineMetricsReader(metrics);
trace("lineText: " + label.getLineText(0));
trace("metrics: " + reader);
}
private function configureAssets():void {
stage.align = StageAlign.TOP_LEFT;
stage.scaleMode = StageScaleMode.NO_SCALE;
label = new TextField();
label.background = true;
label.backgroundColor = 0xFFFFFF;
label.multiline = true;
label.wordWrap = true;
label.text = getLabelText();
addChild(label);
}
private function configureListeners():void {
stage.addEventListener(Event.RESIZE, resizeHandler);
}
private function resizeHandler(event:Event):void {
draw();
setTimeout(showMetrics, 100);
}
private function draw():void {
label.x = gutter;
label.y = gutter;
label.width = stage.stageWidth - (gutter * 2);
label.height = stage.stageHeight - (gutter * 2);
}
private function getLabelText():String {
var text:XML = &lt;body&gt;The Flex product line enables developers to build rich Internet applications that blend the responsiveness of desktop software, the cross-platform reach of the web, and the expressiveness of the Flash Platform.&lt;/body&gt;
return text.toString();
}
}
}
import flash.text.TextLineMetrics;
class LineMetricsReader {
private var metrics:TextLineMetrics;
public function LineMetricsReader(metrics:TextLineMetrics) {
this.metrics = metrics;
}
public function toString():String {
return "[TextLineMetrics ascent:" + metrics.ascent
+ ", descent:" + metrics.descent
+ ", leading:" + metrics.leading
+ ", width:" + metrics.width
+ ", height:" + metrics.height
+ ", x:" + metrics.x
+ "]";
}
}
</codeblock></example></apiClassifierDetail><related-links class="- topic/related-links "><link href="flash.text.xml#TextField" class="- topic/link "><linktext class="- topic/linktext ">flash.text.TextField</linktext></link></related-links><apiConstructor id="flash.text:TextLineMetrics:TextLineMetrics" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiOperation/apiOperation apiOperation/apiConstructor"><apiName class="- topic/title reference/title apiRef/apiName ">TextLineMetrics</apiName><shortdesc class="- topic/shortdesc ">
Creates a TextLineMetrics object.</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="Flash" version="9" class="+ topic/ph adobe-api-d/apiPlatform "/><apiPlatform description="" name="Lite" version="4" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata></prolog><apiConstructorDetail class="- topic/body reference/refbody apiRef/apiDetail apiOperation/apiOperationDetail apiOperation/apiConstructorDetail"><apiConstructorDef class="- topic/section reference/section apiRef/apiDef apiOperation/apiConstructorDef "><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiParam class="- topic/ph reference/ph apiRef/apiDefItem apiOperation/apiParam "><apiItemName class="- topic/keyword reference/keyword apiRef/apiItemName ">x</apiItemName><apiOperationClassifier class="- topic/xref reference/xref apiRef/apiRelation apiOperation/apiOperationClassifier ">Number</apiOperationClassifier><apiDesc class="- topic/section reference/section apiRef/apiDesc ">The left position of the first character in pixels.
</apiDesc></apiParam><apiParam class="- topic/ph reference/ph apiRef/apiDefItem apiOperation/apiParam "><apiItemName class="- topic/keyword reference/keyword apiRef/apiItemName ">width</apiItemName><apiOperationClassifier class="- topic/xref reference/xref apiRef/apiRelation apiOperation/apiOperationClassifier ">Number</apiOperationClassifier><apiDesc class="- topic/section reference/section apiRef/apiDesc ">The width of the text of the selected lines (not necessarily the complete text) in pixels.
</apiDesc></apiParam><apiParam class="- topic/ph reference/ph apiRef/apiDefItem apiOperation/apiParam "><apiItemName class="- topic/keyword reference/keyword apiRef/apiItemName ">height</apiItemName><apiOperationClassifier class="- topic/xref reference/xref apiRef/apiRelation apiOperation/apiOperationClassifier ">Number</apiOperationClassifier><apiDesc class="- topic/section reference/section apiRef/apiDesc ">The height of the text of the selected lines (not necessarily the complete text) in pixels.
</apiDesc></apiParam><apiParam class="- topic/ph reference/ph apiRef/apiDefItem apiOperation/apiParam "><apiItemName class="- topic/keyword reference/keyword apiRef/apiItemName ">ascent</apiItemName><apiOperationClassifier class="- topic/xref reference/xref apiRef/apiRelation apiOperation/apiOperationClassifier ">Number</apiOperationClassifier><apiDesc class="- topic/section reference/section apiRef/apiDesc ">The length from the baseline to the top of the line height in pixels.
</apiDesc></apiParam><apiParam class="- topic/ph reference/ph apiRef/apiDefItem apiOperation/apiParam "><apiItemName class="- topic/keyword reference/keyword apiRef/apiItemName ">descent</apiItemName><apiOperationClassifier class="- topic/xref reference/xref apiRef/apiRelation apiOperation/apiOperationClassifier ">Number</apiOperationClassifier><apiDesc class="- topic/section reference/section apiRef/apiDesc ">The length from the baseline to the bottom depth of the line in pixels.
</apiDesc></apiParam><apiParam class="- topic/ph reference/ph apiRef/apiDefItem apiOperation/apiParam "><apiItemName class="- topic/keyword reference/keyword apiRef/apiItemName ">leading</apiItemName><apiOperationClassifier class="- topic/xref reference/xref apiRef/apiRelation apiOperation/apiOperationClassifier ">Number</apiOperationClassifier><apiDesc class="- topic/section reference/section apiRef/apiDesc ">The measurement of the vertical distance between the lines of text.
</apiDesc></apiParam><apiTipTexts><apiTipText class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiTipText ">Contains information about the text position and measurements of a line of text in a text field.
</apiTipText></apiTipTexts></apiConstructorDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
Creates a TextLineMetrics object. The TextLineMetrics object contains information about
the text metrics of a line of text in a text field. Objects of this class are returned by the
<codeph class="+ topic/ph pr-d/codeph ">flash.text.TextField.getLineMetrics()</codeph> method.
<p class="- topic/p ">See the diagram in the overview for this class for the properties in context.</p>
</apiDesc></apiConstructorDetail><related-links class="- topic/related-links "><link href="flash.text.xml#TextLineMetrics" class="- topic/link "><linktext class="- topic/linktext ">TextLineMetrics class overview</linktext></link><link href="flash.text.xml#TextField/getLineMetrics()" class="- topic/link "><linktext class="- topic/linktext ">flash.text.TextField.getLineMetrics()</linktext></link></related-links></apiConstructor><apiValue id="flash.text:TextLineMetrics:ascent" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiValue/apiValue "><apiName class="- topic/title reference/title apiRef/apiName ">ascent</apiName><shortdesc class="- topic/shortdesc ">
The ascent value of the text is the length from the baseline to the top of the line height in pixels.</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="Flash" version="9" class="+ topic/ph adobe-api-d/apiPlatform "/><apiPlatform description="" name="Lite" version="4" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata><asCustoms class="+ topic/metadata adobe-api-d/asCustoms "><internal>including accents? is it really the line or the font itself?
</internal></asCustoms></prolog><apiValueDetail class="- topic/body reference/refbody apiRef/apiDetail apiValue/apiValueDetail "><apiValueDef class="- topic/section reference/section apiRef/apiDef apiValue/apiValueDef "><apiProperty class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiProperty "/><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiDynamic class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiDynamic "/><apiValueClassifier class="- topic/xref reference/xref apiRef/apiRelation apiValue/apiValueClassifier ">Number</apiValueClassifier></apiValueDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
The ascent value of the text is the length from the baseline to the top of the line height in pixels. See the
"Ascent" measurement in the overview diagram for this class.
</apiDesc></apiValueDetail><related-links class="- topic/related-links "><link href="flash.text.xml#TextLineMetrics" class="- topic/link "><linktext class="- topic/linktext ">TextLineMetrics class overview</linktext></link></related-links></apiValue><apiValue id="flash.text:TextLineMetrics:descent" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiValue/apiValue "><apiName class="- topic/title reference/title apiRef/apiName ">descent</apiName><shortdesc class="- topic/shortdesc ">
The descent value of the text is the length from the baseline to the bottom depth of the line in pixels.</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="Flash" version="9" class="+ topic/ph adobe-api-d/apiPlatform "/><apiPlatform description="" name="Lite" version="4" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata><asCustoms class="+ topic/metadata adobe-api-d/asCustoms "><internal>is it really the line? or the font itself?
</internal></asCustoms></prolog><apiValueDetail class="- topic/body reference/refbody apiRef/apiDetail apiValue/apiValueDetail "><apiValueDef class="- topic/section reference/section apiRef/apiDef apiValue/apiValueDef "><apiProperty class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiProperty "/><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiDynamic class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiDynamic "/><apiValueClassifier class="- topic/xref reference/xref apiRef/apiRelation apiValue/apiValueClassifier ">Number</apiValueClassifier></apiValueDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
The descent value of the text is the length from the baseline to the bottom depth of the line in pixels.
See the "Descent" measurement in the overview diagram for this class.
</apiDesc></apiValueDetail><related-links class="- topic/related-links "><link href="flash.text.xml#TextLineMetrics" class="- topic/link "><linktext class="- topic/linktext ">TextLineMetrics class overview</linktext></link></related-links></apiValue><apiValue id="flash.text:TextLineMetrics:height" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiValue/apiValue "><apiName class="- topic/title reference/title apiRef/apiName ">height</apiName><shortdesc class="- topic/shortdesc ">
The height value of the text of the selected lines (not necessarily the complete text) in pixels.</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="Flash" version="9" class="+ topic/ph adobe-api-d/apiPlatform "/><apiPlatform description="" name="Lite" version="4" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata></prolog><apiValueDetail class="- topic/body reference/refbody apiRef/apiDetail apiValue/apiValueDetail "><apiValueDef class="- topic/section reference/section apiRef/apiDef apiValue/apiValueDef "><apiProperty class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiProperty "/><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiDynamic class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiDynamic "/><apiValueClassifier class="- topic/xref reference/xref apiRef/apiRelation apiValue/apiValueClassifier ">Number</apiValueClassifier></apiValueDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
The height value of the text of the selected lines (not necessarily the complete text) in pixels. The height of the
text line does not include the gutter height. See the "Line height" measurement in the overview diagram
for this class.
</apiDesc></apiValueDetail><related-links class="- topic/related-links "><link href="flash.text.xml#TextLineMetrics" class="- topic/link "><linktext class="- topic/linktext ">TextLineMetrics class overview</linktext></link></related-links></apiValue><apiValue id="flash.text:TextLineMetrics:leading" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiValue/apiValue "><apiName class="- topic/title reference/title apiRef/apiName ">leading</apiName><shortdesc class="- topic/shortdesc ">
The leading value is the measurement of the vertical distance between the lines of text.</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="Flash" version="9" class="+ topic/ph adobe-api-d/apiPlatform "/><apiPlatform description="" name="Lite" version="4" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata></prolog><apiValueDetail class="- topic/body reference/refbody apiRef/apiDetail apiValue/apiValueDetail "><apiValueDef class="- topic/section reference/section apiRef/apiDef apiValue/apiValueDef "><apiProperty class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiProperty "/><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiDynamic class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiDynamic "/><apiValueClassifier class="- topic/xref reference/xref apiRef/apiRelation apiValue/apiValueClassifier ">Number</apiValueClassifier></apiValueDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
The leading value is the measurement of the vertical distance between the lines of text.
See the "Leading" measurement in the overview diagram for this class.
</apiDesc></apiValueDetail><related-links class="- topic/related-links "><link href="flash.text.xml#TextLineMetrics" class="- topic/link "><linktext class="- topic/linktext ">TextLineMetrics class overview</linktext></link></related-links></apiValue><apiValue id="flash.text:TextLineMetrics:width" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiValue/apiValue "><apiName class="- topic/title reference/title apiRef/apiName ">width</apiName><shortdesc class="- topic/shortdesc ">
The width value is the width of the text of the selected lines (not necessarily the complete text) in pixels.</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="Flash" version="9" class="+ topic/ph adobe-api-d/apiPlatform "/><apiPlatform description="" name="Lite" version="4" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata></prolog><apiValueDetail class="- topic/body reference/refbody apiRef/apiDetail apiValue/apiValueDetail "><apiValueDef class="- topic/section reference/section apiRef/apiDef apiValue/apiValueDef "><apiProperty class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiProperty "/><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiDynamic class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiDynamic "/><apiValueClassifier class="- topic/xref reference/xref apiRef/apiRelation apiValue/apiValueClassifier ">Number</apiValueClassifier></apiValueDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
The width value is the width of the text of the selected lines (not necessarily the complete text) in pixels. The width of the
text line is not the same as the width of the text field. The width of the text line is relative to the
text field width, minus the gutter width of 4 pixels (2 pixels on each side). See the "Text Line width"
measurement in the overview diagram for this class.
</apiDesc></apiValueDetail><related-links class="- topic/related-links "><link href="flash.text.xml#TextLineMetrics" class="- topic/link "><linktext class="- topic/linktext ">TextLineMetrics class overview</linktext></link></related-links></apiValue><apiValue id="flash.text:TextLineMetrics:x" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiValue/apiValue "><apiName class="- topic/title reference/title apiRef/apiName ">x</apiName><shortdesc class="- topic/shortdesc ">
The x value is the left position of the first character in pixels.</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="Flash" version="9" class="+ topic/ph adobe-api-d/apiPlatform "/><apiPlatform description="" name="Lite" version="4" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata></prolog><apiValueDetail class="- topic/body reference/refbody apiRef/apiDetail apiValue/apiValueDetail "><apiValueDef class="- topic/section reference/section apiRef/apiDef apiValue/apiValueDef "><apiProperty class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiProperty "/><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiDynamic class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiDynamic "/><apiValueClassifier class="- topic/xref reference/xref apiRef/apiRelation apiValue/apiValueClassifier ">Number</apiValueClassifier></apiValueDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
The x value is the left position of the first character in pixels. This value includes the margin,
indent (if any), and gutter widths. See the "Text Line x-position" in the overview diagram for this class.
</apiDesc></apiValueDetail><related-links class="- topic/related-links "><link href="flash.text.xml#TextLineMetrics" class="- topic/link "><linktext class="- topic/linktext ">TextLineMetrics class overview</linktext></link></related-links></apiValue></apiClassifier><apiClassifier languages="" id="flash.text:TextInteractionMode" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiClassifier/apiClassifier "><apiName class="- topic/title reference/title apiRef/apiName ">TextInteractionMode</apiName><shortdesc class="- topic/shortdesc ">
A class that defines the Interactive mode of a text field object.</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="Flash" version="11" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata></prolog><apiClassifierDetail class="- topic/body reference/refbody apiRef/apiDetail apiClassifier/apiClassifierDetail "><apiClassifierDef class="- topic/section reference/section apiRef/apiDef apiClassifier/apiClassifierDef "><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiStatic class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiStatic "/><apiFinal class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiFinal "/><apiBaseClassifier class="- topic/xref reference/xref apiRef/apiRelation apiClassifier/apiBaseClassifier ">Object</apiBaseClassifier></apiClassifierDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
A class that defines the Interactive mode of a text field object.
</apiDesc></apiClassifierDetail><apiValue id="flash.text:TextInteractionMode:NORMAL" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiValue/apiValue "><apiName class="- topic/title reference/title apiRef/apiName ">NORMAL</apiName><shortdesc class="- topic/shortdesc ">
The text field's default interaction mode is NORMAL and it varies across platform.</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="Flash" version="11" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata></prolog><apiValueDetail class="- topic/body reference/refbody apiRef/apiDetail apiValue/apiValueDetail "><apiValueDef class="- topic/section reference/section apiRef/apiDef apiValue/apiValueDef "><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiStatic class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiStatic "/><apiData class="- topic/ph reference/ph apiRef/apiData ">normal</apiData><apiValueClassifier class="- topic/xref reference/xref apiRef/apiRelation apiValue/apiValueClassifier ">String</apiValueClassifier></apiValueDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
The text field's default interaction mode is NORMAL and it varies across platform.
On Desktop, the normal mode implies that the text field is in scrollable + selection mode.
On Mobile platforms like Android, normal mode implies that the text field can only be scrolled but
the text can not be selected.
</apiDesc></apiValueDetail></apiValue><apiValue id="flash.text:TextInteractionMode:SELECTION" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiValue/apiValue "><apiName class="- topic/title reference/title apiRef/apiName ">SELECTION</apiName><shortdesc class="- topic/shortdesc ">
On mobile platforms like Android, the text field starts in normal mode(which implies scroll and non-selectable mode).</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="Flash" version="11" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata></prolog><apiValueDetail class="- topic/body reference/refbody apiRef/apiDetail apiValue/apiValueDetail "><apiValueDef class="- topic/section reference/section apiRef/apiDef apiValue/apiValueDef "><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiStatic class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiStatic "/><apiData class="- topic/ph reference/ph apiRef/apiData ">selection</apiData><apiValueClassifier class="- topic/xref reference/xref apiRef/apiRelation apiValue/apiValueClassifier ">String</apiValueClassifier></apiValueDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
On mobile platforms like Android, the text field starts in normal mode(which implies scroll and non-selectable mode).
The user can switch to selection mode through the in-built context menu of the text field object.
</apiDesc></apiValueDetail></apiValue></apiClassifier><apiClassifier languages="" id="flash.text:StyleSheet" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiClassifier/apiClassifier "><apiName class="- topic/title reference/title apiRef/apiName ">StyleSheet</apiName><shortdesc class="- topic/shortdesc ">
The StyleSheet class lets you create a StyleSheet object that contains text
formatting rules for font size, color, and other styles.</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="Flash" version="9" class="+ topic/ph adobe-api-d/apiPlatform "/><apiPlatform description="" name="Lite" version="4" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata><asCustoms class="+ topic/metadata adobe-api-d/asCustoms "><keyword class="- topic/keyword ">TextField, StyleSheet class, built-in class, style sheet, stylesheet
</keyword></asCustoms></prolog><apiClassifierDetail class="- topic/body reference/refbody apiRef/apiDetail apiClassifier/apiClassifierDetail "><apiClassifierDef class="- topic/section reference/section apiRef/apiDef apiClassifier/apiClassifierDef "><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiDynamic class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiDynamic "/><apiTipTexts><apiTipText class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiTipText ">Lets you create a StyleSheet object.
</apiTipText></apiTipTexts><apiBaseClassifier class="- topic/xref reference/xref apiRef/apiRelation apiClassifier/apiBaseClassifier ">flash.events:EventDispatcher</apiBaseClassifier></apiClassifierDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
The StyleSheet class lets you create a StyleSheet object that contains text
formatting rules for font size, color, and other styles. You can then apply
styles defined by a style sheet to a TextField object that contains HTML- or
XML-formatted text. The text in the TextField object is automatically
formatted according to the tag styles defined by the StyleSheet object.
You can use text styles to define new formatting tags, redefine built-in HTML
tags, or create style classes that you can apply to certain HTML tags.
<p class="- topic/p ">To apply styles to a TextField object, assign the StyleSheet
object to a TextField object's <codeph class="+ topic/ph pr-d/codeph ">styleSheet</codeph> property.</p>
<p class="- topic/p "><b class="+ topic/ph hi-d/b ">Note:</b> A text field with a style sheet is not editable. In other words, a text field with the <codeph class="+ topic/ph pr-d/codeph ">type</codeph> property set to <codeph class="+ topic/ph pr-d/codeph ">TextFieldType.INPUT</codeph> applies the StyleSheet to the default text for the text field, but the content will no longer be editable by the user. Consider using the TextFormat class to assign styles to input text fields.</p>
<p class="- topic/p ">Flash Player supports a subset of properties in the original CSS1 specification
(<xref href="http://www.w3.org/TR/REC-CSS1" scope="external" class="- topic/xref ">www.w3.org/TR/REC-CSS1</xref>).
The following table shows the supported Cascading Style Sheet (CSS) properties and values, as well as their corresponding
ActionScript property names. (Each ActionScript property name is derived from the corresponding
CSS property name; if the name contains a hyphen, the hyphen is omitted and the subsequent character is capitalized.)</p>
<adobetable class="innertable"><tgroup cols="3" class="- topic/tgroup "><thead class="- topic/thead "><row class="- topic/row "><entry class="- topic/entry ">CSS property</entry><entry class="- topic/entry ">ActionScript property</entry><entry class="- topic/entry ">Usage and supported values</entry></row></thead><tbody class="- topic/tbody "><row class="- topic/row "><entry class="- topic/entry "><codeph class="+ topic/ph pr-d/codeph ">color</codeph></entry><entry class="- topic/entry "><codeph class="+ topic/ph pr-d/codeph ">color</codeph></entry><entry class="- topic/entry ">Only hexadecimal color values are supported. Named colors (such as <codeph class="+ topic/ph pr-d/codeph ">blue</codeph>)
are not supported. Colors are written in the following format: <codeph class="+ topic/ph pr-d/codeph ">#FF0000</codeph>.</entry></row><row class="- topic/row "><entry class="- topic/entry "><codeph class="+ topic/ph pr-d/codeph ">display</codeph></entry><entry class="- topic/entry "><codeph class="+ topic/ph pr-d/codeph ">display</codeph></entry><entry class="- topic/entry ">Supported values are <codeph class="+ topic/ph pr-d/codeph ">inline</codeph>, <codeph class="+ topic/ph pr-d/codeph ">block</codeph>, and <codeph class="+ topic/ph pr-d/codeph ">none</codeph>.</entry></row><row class="- topic/row "><entry class="- topic/entry "><codeph class="+ topic/ph pr-d/codeph ">font-family</codeph></entry><entry class="- topic/entry "><codeph class="+ topic/ph pr-d/codeph ">fontFamily</codeph></entry><entry class="- topic/entry ">A comma-separated list of fonts to use, in descending order of desirability. Any font
family name can be used. If you specify a generic font name, it is converted to an
appropriate device font. The following font conversions are available: <codeph class="+ topic/ph pr-d/codeph ">mono</codeph> is
converted to <codeph class="+ topic/ph pr-d/codeph ">_typewriter</codeph>, <codeph class="+ topic/ph pr-d/codeph ">sans-serif</codeph> is converted to
<codeph class="+ topic/ph pr-d/codeph ">_sans</codeph>, and <codeph class="+ topic/ph pr-d/codeph ">serif</codeph> is converted to <codeph class="+ topic/ph pr-d/codeph ">_serif</codeph>.</entry></row><row class="- topic/row "><entry class="- topic/entry "><codeph class="+ topic/ph pr-d/codeph ">font-size</codeph></entry><entry class="- topic/entry "><codeph class="+ topic/ph pr-d/codeph ">fontSize</codeph> </entry><entry class="- topic/entry ">Only the numeric part of the value is used. Units (px, pt) are not parsed; pixels and points
are equivalent.</entry></row><row class="- topic/row "><entry class="- topic/entry "><codeph class="+ topic/ph pr-d/codeph ">font-style</codeph></entry><entry class="- topic/entry "><codeph class="+ topic/ph pr-d/codeph ">fontStyle</codeph></entry><entry class="- topic/entry ">Recognized values are <codeph class="+ topic/ph pr-d/codeph ">normal</codeph> and <codeph class="+ topic/ph pr-d/codeph ">italic</codeph>.</entry></row><row class="- topic/row "><entry class="- topic/entry "><codeph class="+ topic/ph pr-d/codeph ">font-weight</codeph></entry><entry class="- topic/entry "><codeph class="+ topic/ph pr-d/codeph ">fontWeight</codeph></entry><entry class="- topic/entry ">Recognized values are <codeph class="+ topic/ph pr-d/codeph ">normal</codeph> and <codeph class="+ topic/ph pr-d/codeph ">bold</codeph>.</entry></row><row class="- topic/row "><entry class="- topic/entry "><codeph class="+ topic/ph pr-d/codeph ">kerning</codeph></entry><entry class="- topic/entry "><codeph class="+ topic/ph pr-d/codeph ">kerning</codeph></entry><entry class="- topic/entry ">Recognized values are <codeph class="+ topic/ph pr-d/codeph ">true</codeph> and <codeph class="+ topic/ph pr-d/codeph ">false</codeph>.
Kerning is supported for embedded fonts only. Certain fonts, such as Courier New, do not support kerning.
The kerning property is only supported in SWF files created in Windows, not in SWF files created on the
Macintosh. However, these SWF files can be played in non-Windows versions of Flash Player and the kerning
still applies.</entry></row><row class="- topic/row "><entry class="- topic/entry "><codeph class="+ topic/ph pr-d/codeph ">leading</codeph></entry><entry class="- topic/entry "><codeph class="+ topic/ph pr-d/codeph ">leading</codeph></entry><entry class="- topic/entry ">The amount of space that is uniformly distributed between lines. The value specifies the
number of pixels that are added after each line. A negative value condenses the space
between lines. Only the numeric part of the value is used. Units (px, pt) are not parsed;
pixels and points are equivalent.</entry></row><row class="- topic/row "><entry class="- topic/entry "><codeph class="+ topic/ph pr-d/codeph ">letter-spacing</codeph></entry><entry class="- topic/entry "><codeph class="+ topic/ph pr-d/codeph ">letterSpacing</codeph></entry><entry class="- topic/entry ">The amount of space that is uniformly distributed between characters.
The value specifies the number of pixels that are added after each
character. A negative value condenses the space between characters. Only the numeric part of the
value is used. Units (px, pt) are not parsed; pixels and points are equivalent.</entry></row><row class="- topic/row "><entry class="- topic/entry "><codeph class="+ topic/ph pr-d/codeph ">margin-left</codeph></entry><entry class="- topic/entry "><codeph class="+ topic/ph pr-d/codeph ">marginLeft</codeph></entry><entry class="- topic/entry ">Only the numeric part of the value is used. Units (px, pt) are not parsed; pixels and points
are equivalent. </entry></row><row class="- topic/row "><entry class="- topic/entry "><codeph class="+ topic/ph pr-d/codeph ">margin-right</codeph></entry><entry class="- topic/entry "><codeph class="+ topic/ph pr-d/codeph ">marginRight</codeph></entry><entry class="- topic/entry ">Only the numeric part of the value is used. Units (px, pt) are not parsed; pixels and
points are equivalent.</entry></row><row class="- topic/row "><entry class="- topic/entry "><codeph class="+ topic/ph pr-d/codeph ">text-align</codeph></entry><entry class="- topic/entry "><codeph class="+ topic/ph pr-d/codeph ">textAlign</codeph></entry><entry class="- topic/entry ">Recognized values are <codeph class="+ topic/ph pr-d/codeph ">left</codeph>, <codeph class="+ topic/ph pr-d/codeph ">center</codeph>, <codeph class="+ topic/ph pr-d/codeph ">right</codeph>, and
<codeph class="+ topic/ph pr-d/codeph ">justify</codeph>.</entry></row><row class="- topic/row "><entry class="- topic/entry "><codeph class="+ topic/ph pr-d/codeph ">text-decoration</codeph></entry><entry class="- topic/entry "><codeph class="+ topic/ph pr-d/codeph ">textDecoration</codeph></entry><entry class="- topic/entry ">Recognized values are <codeph class="+ topic/ph pr-d/codeph ">none</codeph> and <codeph class="+ topic/ph pr-d/codeph ">underline</codeph>.</entry></row><row class="- topic/row "><entry class="- topic/entry "><codeph class="+ topic/ph pr-d/codeph ">text-indent</codeph></entry><entry class="- topic/entry "><codeph class="+ topic/ph pr-d/codeph ">textIndent</codeph></entry><entry class="- topic/entry ">Only the numeric part of the value is used. Units (px, pt) are not parsed; pixels and
points are equivalent. </entry></row></tbody></tgroup></adobetable>
<p class="- topic/p "><ph outputclass="flexonly" class="- topic/ph ">You can use the StyleSheet class to perform low-level text rendering.
However, in Flex, you typically use the Label, Text, TextArea, and TextInput controls to process text.</ph></p>
</apiDesc><example conref="examples\StyleSheetExample.as" class="- topic/example "> The following example creates a new style sheet and assigns bold
and red font treatments to the heading style.
<codeblock xml:space="preserve" class="+ topic/pre pr-d/codeblock ">
package {
import flash.display.Sprite;
import flash.text.StyleSheet;
import flash.text.TextField;
import flash.text.TextFieldAutoSize;
public class StyleSheetExample extends Sprite {
public function StyleSheetExample() {
var style:StyleSheet = new StyleSheet();
var heading:Object = new Object();
heading.fontWeight = "bold";
heading.color = "#FF0000";
var body:Object = new Object();
body.fontStyle = "italic";
style.setStyle(".heading", heading);
style.setStyle("body", body);
var label:TextField = new TextField();
label.styleSheet = style;
label.htmlText = "&lt;body&gt;&lt;span class='heading'&gt;Hello &lt;/span&gt;World...&lt;/body&gt;";
addChild(label);
}
}
}
</codeblock></example></apiClassifierDetail><related-links class="- topic/related-links "><link href="flash.text.xml#TextField" class="- topic/link "><linktext class="- topic/linktext ">flash.text.TextField</linktext></link></related-links><apiConstructor id="flash.text:StyleSheet:StyleSheet" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiOperation/apiOperation apiOperation/apiConstructor"><apiName class="- topic/title reference/title apiRef/apiName ">StyleSheet</apiName><shortdesc class="- topic/shortdesc ">
Creates a new StyleSheet object.</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="Flash" version="9" class="+ topic/ph adobe-api-d/apiPlatform "/><apiPlatform description="" name="Lite" version="4" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata><asCustoms class="+ topic/metadata adobe-api-d/asCustoms "><keyword class="- topic/keyword ">StyleSheet, constructor
</keyword></asCustoms></prolog><apiConstructorDetail class="- topic/body reference/refbody apiRef/apiDetail apiOperation/apiOperationDetail apiOperation/apiConstructorDetail"><apiConstructorDef class="- topic/section reference/section apiRef/apiDef apiOperation/apiConstructorDef "><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/></apiConstructorDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
Creates a new StyleSheet object.
</apiDesc></apiConstructorDetail><related-links class="- topic/related-links "><link href="flash.text.xml#StyleSheet/getStyle()" class="- topic/link "><linktext class="- topic/linktext ">flash.text.StyleSheet.getStyle()</linktext></link></related-links></apiConstructor><apiOperation id="flash.text:StyleSheet:clear" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiOperation/apiOperation "><apiName class="- topic/title reference/title apiRef/apiName ">clear</apiName><shortdesc class="- topic/shortdesc ">
Removes all styles from the style sheet object.</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="Flash" version="9" class="+ topic/ph adobe-api-d/apiPlatform "/><apiPlatform description="" name="Lite" version="4" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata><asCustoms class="+ topic/metadata adobe-api-d/asCustoms "><keyword class="- topic/keyword ">StyleSheet.clear, clear
</keyword></asCustoms></prolog><apiOperationDetail class="- topic/body reference/refbody apiRef/apiDetail apiOperation/apiOperationDetail "><apiOperationDef class="- topic/section reference/section apiRef/apiDef apiOperation/apiOperationDef "><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiReturn class="- topic/ph reference/ph apiRef/apiDefItem apiOperation/apiReturn "><apiType value="void" name="type" class="- topic/state reference/state apiRef/apiType "/></apiReturn></apiOperationDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
Removes all styles from the style sheet object.
</apiDesc></apiOperationDetail></apiOperation><apiOperation id="flash.text:StyleSheet:getStyle" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiOperation/apiOperation "><apiName class="- topic/title reference/title apiRef/apiName ">getStyle</apiName><shortdesc class="- topic/shortdesc ">
Returns a copy of the style object associated with the style named styleName.</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="Flash" version="9" class="+ topic/ph adobe-api-d/apiPlatform "/><apiPlatform description="" name="Lite" version="4" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata><asCustoms class="+ topic/metadata adobe-api-d/asCustoms "><keyword class="- topic/keyword ">StyleSheet.getStyle, getStyle
</keyword></asCustoms></prolog><apiOperationDetail class="- topic/body reference/refbody apiRef/apiDetail apiOperation/apiOperationDetail "><apiOperationDef class="- topic/section reference/section apiRef/apiDef apiOperation/apiOperationDef "><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiReturn class="- topic/ph reference/ph apiRef/apiDefItem apiOperation/apiReturn "><apiDesc class="- topic/section reference/section apiRef/apiDesc ">An object.
</apiDesc><apiOperationClassifier class="- topic/xref reference/xref apiRef/apiRelation apiOperation/apiOperationClassifier ">Object</apiOperationClassifier></apiReturn><apiParam class="- topic/ph reference/ph apiRef/apiDefItem apiOperation/apiParam "><apiItemName class="- topic/keyword reference/keyword apiRef/apiItemName ">styleName</apiItemName><apiOperationClassifier class="- topic/xref reference/xref apiRef/apiRelation apiOperation/apiOperationClassifier ">String</apiOperationClassifier><apiDesc class="- topic/section reference/section apiRef/apiDesc ">A string that specifies the name of the style to retrieve.
</apiDesc></apiParam></apiOperationDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
Returns a copy of the style object associated with the style named <codeph class="+ topic/ph pr-d/codeph ">styleName</codeph>.
If there is no style object associated with <codeph class="+ topic/ph pr-d/codeph ">styleName</codeph>,
<codeph class="+ topic/ph pr-d/codeph ">null</codeph> is returned.
</apiDesc><example class="- topic/example ">Please see the <xref href="StyleSheet.html#parseCSS()" class="- topic/xref ">parseCSS()</xref> or <xref href="StyleSheet.html#transform()" class="- topic/xref ">transform()</xref>
method's example for illustrations of how to use the <codeph class="+ topic/ph pr-d/codeph ">getStyle()</codeph> method.
</example></apiOperationDetail><related-links class="- topic/related-links "><link href="flash.text.xml#StyleSheet/setStyle()" class="- topic/link "><linktext class="- topic/linktext ">flash.text.StyleSheet.setStyle()</linktext></link></related-links></apiOperation><apiOperation id="flash.text:StyleSheet:parseCSS" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiOperation/apiOperation "><apiName class="- topic/title reference/title apiRef/apiName ">parseCSS</apiName><shortdesc class="- topic/shortdesc ">
Parses the CSS in CSSText and loads the style sheet with it.</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="Flash" version="9" class="+ topic/ph adobe-api-d/apiPlatform "/><apiPlatform description="" name="Lite" version="4" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata><asCustoms class="+ topic/metadata adobe-api-d/asCustoms "><keyword class="- topic/keyword ">StyleSheet.parseCSS, parseCSS
</keyword></asCustoms></prolog><apiOperationDetail class="- topic/body reference/refbody apiRef/apiDetail apiOperation/apiOperationDetail "><apiOperationDef class="- topic/section reference/section apiRef/apiDef apiOperation/apiOperationDef "><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiReturn class="- topic/ph reference/ph apiRef/apiDefItem apiOperation/apiReturn "><apiType value="void" name="type" class="- topic/state reference/state apiRef/apiType "/></apiReturn><apiParam class="- topic/ph reference/ph apiRef/apiDefItem apiOperation/apiParam "><apiItemName class="- topic/keyword reference/keyword apiRef/apiItemName ">CSSText</apiItemName><apiOperationClassifier class="- topic/xref reference/xref apiRef/apiRelation apiOperation/apiOperationClassifier ">String</apiOperationClassifier><apiDesc class="- topic/section reference/section apiRef/apiDesc ">The CSS text to parse (a string).
</apiDesc></apiParam><apiTipTexts><apiTipText class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiTipText ">Parses the CSS in cssText and loads the StyleSheet with it.
</apiTipText></apiTipTexts></apiOperationDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
Parses the CSS in <codeph class="+ topic/ph pr-d/codeph ">CSSText</codeph> and loads the style sheet with it. If a style in
<codeph class="+ topic/ph pr-d/codeph ">CSSText</codeph> is already in <codeph class="+ topic/ph pr-d/codeph ">styleSheet</codeph>, the properties in
<codeph class="+ topic/ph pr-d/codeph ">styleSheet</codeph> are retained, and only the ones in <codeph class="+ topic/ph pr-d/codeph ">CSSText</codeph>
are added or changed in <codeph class="+ topic/ph pr-d/codeph ">styleSheet</codeph>.
<p class="- topic/p ">To extend the native CSS parsing capability, you can override this method by creating a subclass
of the StyleSheet class.</p>
</apiDesc><example conref="examples\StyleSheet_parseCSSExample.as" class="- topic/example "> In the following example, when a user clicks on the text file,
CSS styles, loaded from a file, are applied to the content.
<p class="- topic/p ">In the constructor, a multiline text field is created and its content is
set to an HTML-formatted string. (The HTML heading and span tags are
not rendered before CSS style is applied.) A <codeph class="+ topic/ph pr-d/codeph ">URLRequest</codeph>
object is created to identify the location of the CSS file; for this example, the CSS file
is in the same directory as the SWF file. The file is loaded with a <codeph class="+ topic/ph pr-d/codeph ">URLLoader</codeph>
object. There are two event listeners added for the <codeph class="+ topic/ph pr-d/codeph ">loader</codeph> URLLoader object.
If an IO error occurs, the <codeph class="+ topic/ph pr-d/codeph ">errorHandler()</codeph> method is invoked, which displays
an error message in the text field. After all the data is received and placed in the data
property of the <codeph class="+ topic/ph pr-d/codeph ">loader</codeph> URLLoader object, the <codeph class="+ topic/ph pr-d/codeph ">loaderCompleteHandler()</codeph>
method is invoked. This method parses the CSS styles from the data loaded from the file and
fills the <codeph class="+ topic/ph pr-d/codeph ">sheet</codeph> StyleSheet object with the style definitions.</p>
<p class="- topic/p ">When the user clicks on the text field, the <codeph class="+ topic/ph pr-d/codeph ">clickHandler()</codeph> method is called.
The if statement in the <codeph class="+ topic/ph pr-d/codeph ">clickHandler()</codeph> method checks to make sure the file loading
was finished before applying the style sheet to the text field. In order for the style sheet to
take effect, the <codeph class="+ topic/ph pr-d/codeph ">htmlText</codeph> property must be reassigned with the content after the
style sheet is assigned to the text field. The CSS <codeph class="+ topic/ph pr-d/codeph ">font-family</codeph> and the <codeph class="+ topic/ph pr-d/codeph ">color</codeph>
property values for the heading tag also are appended to the content of the text field. (The values
of these properties will be "undefined" if style sheet values are not in effect.)</p>
<p class="- topic/p ">The following is an example of a content of the CSS file that can be used with this example.
Before running this example, create a text file, copy the following CSS content into it,
then save it with the file name <codeph class="+ topic/ph pr-d/codeph ">test.css</codeph> and place it in the same directory as the SWF file.</p>
<pre xml:space="preserve" class="- topic/pre ">
p {
font-family: Times New Roman, Times, _serif;
font-size: 14;
font-Style: italic;
margin-left: 10;
}
h1 {
font-family: Arial, Helvetica, _sans;
font-size: 20;
font-weight: bold;
}
.bluetext {
color: #0000CC;
}
</pre>
<codeblock xml:space="preserve" class="+ topic/pre pr-d/codeblock ">
package {
import flash.display.Sprite;
import flash.net.URLLoader;
import flash.net.URLRequest;
import flash.text.StyleSheet;
import flash.text.TextField;
import flash.text.TextFieldAutoSize;
import flash.events.IOErrorEvent;
import flash.events.Event;
import flash.events.MouseEvent;
public class StyleSheet_parseCSSExample extends Sprite {
private var loader:URLLoader = new URLLoader();
private var field:TextField = new TextField();
private var exampleText:String = "&lt;h1&gt;This is a headline&lt;/h1&gt;"
+ "&lt;p&gt;This is a line of text. &lt;span class='bluetext'&gt;"
+ "This line of text is colored blue.&lt;/span&gt;&lt;/p&gt;";
private var sheet:StyleSheet = new StyleSheet();
private var cssReady:Boolean = false;
public function StyleSheet_parseCSSExample() {
field.x = 10;
field.y = 10;
field.background = true;
field.multiline = true;
field.autoSize = TextFieldAutoSize.LEFT;
field.htmlText = exampleText;
field.addEventListener(MouseEvent.CLICK, clickHandler);
addChild(field);
var req:URLRequest = new URLRequest("test.css");
loader.load(req);
loader.addEventListener(IOErrorEvent.IO_ERROR, errorHandler);
loader.addEventListener(Event.COMPLETE, loaderCompleteHandler);
}
public function errorHandler(e:IOErrorEvent):void {
field.htmlText = "Couldn't load the style sheet file.";
}
public function loaderCompleteHandler(event:Event):void {
sheet.parseCSS(loader.data);
cssReady = true;
}
public function clickHandler(e:MouseEvent):void {
if (cssReady) {
field.styleSheet = sheet;
field.htmlText = exampleText;
var style:Object = sheet.getStyle("h1");
field.htmlText += "&lt;p&gt;Headline font-family is: " + style.fontFamily + "&lt;/p&gt;";
field.htmlText += "&lt;p&gt;Headline color is: " + style.color + "&lt;/p&gt;";
} else {
field.htmlText = "Couldn't apply the CSS styles.";
}
}
}
}
</codeblock></example></apiOperationDetail></apiOperation><apiOperation id="flash.text:StyleSheet:setStyle" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiOperation/apiOperation "><apiName class="- topic/title reference/title apiRef/apiName ">setStyle</apiName><shortdesc class="- topic/shortdesc ">
Adds a new style with the specified name to the style sheet object.</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="Flash" version="9" class="+ topic/ph adobe-api-d/apiPlatform "/><apiPlatform description="" name="Lite" version="4" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata><asCustoms class="+ topic/metadata adobe-api-d/asCustoms "><oldexample>The following example adds a style named <code>emphasized</code> to the
StyleSheet <code>myStyleSheet</code>. The style includes two style properties: <code>color</code>
and <code>fontWeight</code>. The style object is defined with the <code>{}</code> operator.
<pre xml:space="preserve" class="- topic/pre "><code>
myStyleSheet.setStyle("emphasized", {color:'#000000',fontWeight:'bold'});
</code></pre>
<p class="- topic/p ">You could also create a style object using an instance of the Object class, and
then pass that object (<code>styleObj</code>) as
the <code>style</code> parameter, as the next example shows:</p>
<listing version="2.0">
import TextField.StyleSheet;
var my_styleSheet:StyleSheet = new StyleSheet();
var styleObj:Object = new Object();
styleObj.color = "#000000";
styleObj.fontWeight = "bold";
my_styleSheet.setStyle("emphasized", styleObj);
delete styleObj;
var styleNames_array:Array = my_styleSheet.getStyleNames();
for (var i=0;i&lt;styleNames_array.length;i++) {
var styleName:String = styleNames_array[i];
var thisStyle:Object = my_styleSheet.getStyle(styleName);
trace(styleName);
for (var prop in thisStyle) {
trace("\t"+prop+": "+thisStyle[prop]);
}
trace("");
}
</listing>
<p class="- topic/p "><span class="flashonly">The following information appears in the Output
panel:</span><span class="flexonly">The following information writes to the
log file:</span></p>
<pre xml:space="preserve" class="- topic/pre "><code>
emphasized
fontWeight: bold
color: #000000
</code></pre>
<p class="- topic/p "><strong>Note: </strong>Because Flash Player creates a copy of the style object
you pass to <code>setStyle()</code>, the <code> delete styleObj</code> command in the
code example reduces memory usage by deleting the original style object passed to
<code>setStyle()</code>.</p>
</oldexample></asCustoms></prolog><apiOperationDetail class="- topic/body reference/refbody apiRef/apiDetail apiOperation/apiOperationDetail "><apiOperationDef class="- topic/section reference/section apiRef/apiDef apiOperation/apiOperationDef "><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiReturn class="- topic/ph reference/ph apiRef/apiDefItem apiOperation/apiReturn "><apiType value="void" name="type" class="- topic/state reference/state apiRef/apiType "/></apiReturn><apiParam class="- topic/ph reference/ph apiRef/apiDefItem apiOperation/apiParam "><apiItemName class="- topic/keyword reference/keyword apiRef/apiItemName ">styleName</apiItemName><apiOperationClassifier class="- topic/xref reference/xref apiRef/apiRelation apiOperation/apiOperationClassifier ">String</apiOperationClassifier><apiDesc class="- topic/section reference/section apiRef/apiDesc ">A string that specifies the name of the style to add to the style sheet.
</apiDesc></apiParam><apiParam class="- topic/ph reference/ph apiRef/apiDefItem apiOperation/apiParam "><apiItemName class="- topic/keyword reference/keyword apiRef/apiItemName ">styleObject</apiItemName><apiOperationClassifier class="- topic/xref reference/xref apiRef/apiRelation apiOperation/apiOperationClassifier ">Object</apiOperationClassifier><apiDesc class="- topic/section reference/section apiRef/apiDesc ">An object that describes the style, or <codeph class="+ topic/ph pr-d/codeph ">null</codeph>.
</apiDesc></apiParam></apiOperationDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
Adds a new style with the specified name to the style sheet object.
If the named style does not already exist in the style sheet, it is added.
If the named style already exists in the style sheet, it is replaced.
If the <codeph class="+ topic/ph pr-d/codeph ">styleObject</codeph> parameter is <codeph class="+ topic/ph pr-d/codeph ">null</codeph>, the named style is removed.
<p class="- topic/p ">Flash Player creates a copy of the style object that you pass to this method.</p>
<p class="- topic/p ">For a list of supported styles, see the table in the description for the StyleSheet class.</p>
</apiDesc></apiOperationDetail></apiOperation><apiOperation id="flash.text:StyleSheet:transform" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiOperation/apiOperation "><apiName class="- topic/title reference/title apiRef/apiName ">transform</apiName><shortdesc class="- topic/shortdesc ">
Extends the CSS parsing capability.</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="Flash" version="9" class="+ topic/ph adobe-api-d/apiPlatform "/><apiPlatform description="" name="Lite" version="4" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata><asCustoms class="+ topic/metadata adobe-api-d/asCustoms "><keyword class="- topic/keyword ">StyleSheet.transform, transform
</keyword></asCustoms></prolog><apiOperationDetail class="- topic/body reference/refbody apiRef/apiDetail apiOperation/apiOperationDetail "><apiOperationDef class="- topic/section reference/section apiRef/apiDef apiOperation/apiOperationDef "><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiReturn class="- topic/ph reference/ph apiRef/apiDefItem apiOperation/apiReturn "><apiDesc class="- topic/section reference/section apiRef/apiDesc ">A TextFormat object containing the result of the mapping of CSS rules
to text format properties.
</apiDesc><apiOperationClassifier class="- topic/xref reference/xref apiRef/apiRelation apiOperation/apiOperationClassifier ">flash.text:TextFormat</apiOperationClassifier></apiReturn><apiParam class="- topic/ph reference/ph apiRef/apiDefItem apiOperation/apiParam "><apiItemName class="- topic/keyword reference/keyword apiRef/apiItemName ">formatObject</apiItemName><apiOperationClassifier class="- topic/xref reference/xref apiRef/apiRelation apiOperation/apiOperationClassifier ">Object</apiOperationClassifier><apiDesc class="- topic/section reference/section apiRef/apiDesc ">An object that describes the style, containing style rules as properties of the object,
or <codeph class="+ topic/ph pr-d/codeph ">null</codeph>.
</apiDesc></apiParam></apiOperationDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
Extends the CSS parsing capability. Advanced developers can override this method by extending the
StyleSheet class.
</apiDesc><example conref="examples\StyleSheet_transformExample.as" class="- topic/example "> This example uses the <codeph class="+ topic/ph pr-d/codeph ">transform()</codeph> method to apply a style
from a CSS file to a TextFormat object for a text field.
<p class="- topic/p ">CSS styles are used usually to format HTML content. However,
by using <codeph class="+ topic/ph pr-d/codeph ">transform()</codeph> method of a StyleSheet object, specific
CSS styles can be assigned to a TextFormat object and then applied to any text field.</p>
<p class="- topic/p ">The <codeph class="+ topic/ph pr-d/codeph ">URLRequest</codeph> and <codeph class="+ topic/ph pr-d/codeph ">URLLoader</codeph> objects are used to
load the CSS file. An event listener is added for the <codeph class="+ topic/ph pr-d/codeph ">Event.COMPLETE</codeph>
event, which occurs after all the data is received and placed in the data property of the
<codeph class="+ topic/ph pr-d/codeph ">loader</codeph> URLLoader object. The <codeph class="+ topic/ph pr-d/codeph ">loaderCompleteHandler()</codeph> method
then parses the CSS from the data loaded from the file and fills the <codeph class="+ topic/ph pr-d/codeph ">sheet</codeph>
StyleSheet object with the styles. The <codeph class="+ topic/ph pr-d/codeph ">getStyle()</codeph> method of the style sheet
retrieves the HTML paragraph styles, which are then assigned to the <codeph class="+ topic/ph pr-d/codeph ">cssFormat</codeph>
TextFormat object by using style sheet's <codeph class="+ topic/ph pr-d/codeph ">transform()</codeph> method. Finally, the default text
format of the <codeph class="+ topic/ph pr-d/codeph ">inputField</codeph> text field is set to the new <codeph class="+ topic/ph pr-d/codeph ">cssFormat</codeph> text format.</p>
<codeblock xml:space="preserve" class="+ topic/pre pr-d/codeblock ">
package {
import flash.display.Sprite;
import flash.net.URLLoader;
import flash.net.URLRequest;
import flash.text.StyleSheet;
import flash.text.TextField;
import flash.text.TextFormat;
import flash.text.TextFieldType;
import flash.events.IOErrorEvent;
import flash.events.Event;
public class StyleSheet_transformExample extends Sprite {
private var loader:URLLoader = new URLLoader();
private var inputField:TextField = new TextField();
private var sheet:StyleSheet = new StyleSheet();
public function StyleSheet_transformExample() {
inputField.x = 10;
inputField.y = 10;
inputField.background = true;
inputField.width = 300;
inputField.height = 200;
inputField.wordWrap = true;
inputField.multiline = true;
inputField.type = TextFieldType.INPUT;
addChild(inputField);
var req:URLRequest = new URLRequest("test.css");
loader.load(req);
loader.addEventListener(IOErrorEvent.IO_ERROR, errorHandler);
loader.addEventListener(Event.COMPLETE, loaderCompleteHandler);
}
public function errorHandler(e:IOErrorEvent):void {
inputField.htmlText = "Couldn't load the style sheet file.";
}
public function loaderCompleteHandler(event:Event):void {
var cssFormat:TextFormat = new TextFormat();
sheet.parseCSS(loader.data);
var style:Object = sheet.getStyle("p");
cssFormat = sheet.transform(style);
inputField.defaultTextFormat = cssFormat;
}
}
}
</codeblock></example></apiOperationDetail><related-links class="- topic/related-links "><link href="flash.text.xml#TextFormat" class="- topic/link "><linktext class="- topic/linktext ">flash.text.TextFormat</linktext></link></related-links></apiOperation><apiValue id="flash.text:StyleSheet:styleNames:get" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiValue/apiValue "><apiName class="- topic/title reference/title apiRef/apiName ">styleNames</apiName><shortdesc class="- topic/shortdesc ">
An array that contains the names (as strings) of all of the styles registered
in this style sheet.</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="Flash" version="9" class="+ topic/ph adobe-api-d/apiPlatform "/><apiPlatform description="" name="Lite" version="4" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata><asCustoms class="+ topic/metadata adobe-api-d/asCustoms "><keyword class="- topic/keyword ">StyleSheet.getStyleNames, getStyleNames
</keyword></asCustoms></prolog><apiValueDetail class="- topic/body reference/refbody apiRef/apiDetail apiValue/apiValueDetail "><apiValueDef class="- topic/section reference/section apiRef/apiDef apiValue/apiValueDef "><apiProperty class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiProperty "/><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiDynamic class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiDynamic "/><apiValueAccess value="read" class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiValueAccess "/><apiValueClassifier class="- topic/xref reference/xref apiRef/apiRelation apiValue/apiValueClassifier ">Array</apiValueClassifier><apiTipTexts><apiTipText class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiTipText ">Returns the names of all the styles registered in this StyleSheet.
</apiTipText></apiTipTexts></apiValueDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
An array that contains the names (as strings) of all of the styles registered
in this style sheet.
</apiDesc></apiValueDetail></apiValue></apiClassifier><apiClassifier languages="" id="flash.text:TextSnapshot" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiClassifier/apiClassifier "><apiName class="- topic/title reference/title apiRef/apiName ">TextSnapshot</apiName><shortdesc class="- topic/shortdesc ">
TextSnapshot objects let you work with static text in a movie clip.</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="Flash" version="9" class="+ topic/ph adobe-api-d/apiPlatform "/><apiPlatform description="" name="Lite" version="4" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata><asCustoms class="+ topic/metadata adobe-api-d/asCustoms "><keyword class="- topic/keyword ">TextSnapshot
</keyword></asCustoms></prolog><apiClassifierDetail class="- topic/body reference/refbody apiRef/apiDetail apiClassifier/apiClassifierDetail "><apiClassifierDef class="- topic/section reference/section apiRef/apiDef apiClassifier/apiClassifierDef "><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiStatic class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiStatic "/><apiBaseClassifier class="- topic/xref reference/xref apiRef/apiRelation apiClassifier/apiBaseClassifier ">Object</apiBaseClassifier></apiClassifierDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
TextSnapshot objects let you work with static text in a movie clip. You can use them, for example,
to lay out text with greater precision than that allowed by dynamic text, but still access the text
in a read-only way.
<p class="- topic/p ">You don't use a constructor to create a TextSnapshot object; it is returned by
<codeph class="+ topic/ph pr-d/codeph ">flash.display.DisplayObjectContainer.textSnapshot</codeph> property.</p>
</apiDesc></apiClassifierDetail><related-links class="- topic/related-links "><link href="flash.display.xml#DisplayObjectContainer/textSnapshot" class="- topic/link "><linktext class="- topic/linktext ">flash.display.DisplayObjectContainer.textSnapshot</linktext></link></related-links><apiOperation id="flash.text:TextSnapshot:findText" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiOperation/apiOperation "><apiName class="- topic/title reference/title apiRef/apiName ">findText</apiName><shortdesc class="- topic/shortdesc ">
Searches the specified TextSnapshot object and returns the position of the first
occurrence of textToFind found at or after beginIndex.</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="Flash" version="9" class="+ topic/ph adobe-api-d/apiPlatform "/><apiPlatform description="" name="Lite" version="4" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata><asCustoms class="+ topic/metadata adobe-api-d/asCustoms "><keyword class="- topic/keyword ">TextSnapshot.findText, findText
</keyword></asCustoms></prolog><apiOperationDetail class="- topic/body reference/refbody apiRef/apiDetail apiOperation/apiOperationDetail "><apiOperationDef class="- topic/section reference/section apiRef/apiDef apiOperation/apiOperationDef "><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiReturn class="- topic/ph reference/ph apiRef/apiDefItem apiOperation/apiReturn "><apiDesc class="- topic/section reference/section apiRef/apiDesc ">The zero-based index position of the first occurrence of the specified text, or -1.
</apiDesc><apiOperationClassifier class="- topic/xref reference/xref apiRef/apiRelation apiOperation/apiOperationClassifier ">int</apiOperationClassifier></apiReturn><apiParam class="- topic/ph reference/ph apiRef/apiDefItem apiOperation/apiParam "><apiItemName class="- topic/keyword reference/keyword apiRef/apiItemName ">beginIndex</apiItemName><apiOperationClassifier class="- topic/xref reference/xref apiRef/apiRelation apiOperation/apiOperationClassifier ">int</apiOperationClassifier><apiDesc class="- topic/section reference/section apiRef/apiDesc ">Specifies the starting point to search for the specified text.
</apiDesc></apiParam><apiParam class="- topic/ph reference/ph apiRef/apiDefItem apiOperation/apiParam "><apiItemName class="- topic/keyword reference/keyword apiRef/apiItemName ">textToFind</apiItemName><apiOperationClassifier class="- topic/xref reference/xref apiRef/apiRelation apiOperation/apiOperationClassifier ">String</apiOperationClassifier><apiDesc class="- topic/section reference/section apiRef/apiDesc ">Specifies the text to search for. If you specify a string literal instead of a
variable of type String, enclose the string in quotation marks.
</apiDesc></apiParam><apiParam class="- topic/ph reference/ph apiRef/apiDefItem apiOperation/apiParam "><apiItemName class="- topic/keyword reference/keyword apiRef/apiItemName ">caseSensitive</apiItemName><apiOperationClassifier class="- topic/xref reference/xref apiRef/apiRelation apiOperation/apiOperationClassifier ">Boolean</apiOperationClassifier><apiDesc class="- topic/section reference/section apiRef/apiDesc ">Specifies whether the text must match the case of the string in
<codeph class="+ topic/ph pr-d/codeph ">textToFind</codeph>.
</apiDesc></apiParam></apiOperationDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
Searches the specified TextSnapshot object and returns the position of the first
occurrence of <codeph class="+ topic/ph pr-d/codeph ">textToFind</codeph> found at or after <codeph class="+ topic/ph pr-d/codeph ">beginIndex</codeph>. If
<codeph class="+ topic/ph pr-d/codeph ">textToFind</codeph> is not found, the method returns <codeph class="+ topic/ph pr-d/codeph ">-1</codeph>.
</apiDesc></apiOperationDetail><related-links class="- topic/related-links "><link href="flash.text.xml#TextSnapshot/getText()" class="- topic/link "><linktext class="- topic/linktext ">flash.text.TextSnapshot.getText()</linktext></link></related-links></apiOperation><apiOperation id="flash.text:TextSnapshot:getSelectedText" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiOperation/apiOperation "><apiName class="- topic/title reference/title apiRef/apiName ">getSelectedText</apiName><shortdesc class="- topic/shortdesc ">
Returns a string that contains all the characters specified by the corresponding
setSelected() method.</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="Flash" version="9." class="+ topic/ph adobe-api-d/apiPlatform "/><apiPlatform description="" name="Lite" version="4" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata><asCustoms class="+ topic/metadata adobe-api-d/asCustoms "><keyword class="- topic/keyword ">TextSnapshot.getSelectedText, getSelectedText
</keyword></asCustoms></prolog><apiOperationDetail class="- topic/body reference/refbody apiRef/apiDetail apiOperation/apiOperationDetail "><apiOperationDef class="- topic/section reference/section apiRef/apiDef apiOperation/apiOperationDef "><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiReturn class="- topic/ph reference/ph apiRef/apiDefItem apiOperation/apiReturn "><apiDesc class="- topic/section reference/section apiRef/apiDesc ">A string that contains all the characters specified by the
corresponding <codeph class="+ topic/ph pr-d/codeph ">setSelected()</codeph> command.
</apiDesc><apiOperationClassifier class="- topic/xref reference/xref apiRef/apiRelation apiOperation/apiOperationClassifier ">String</apiOperationClassifier></apiReturn><apiParam class="- topic/ph reference/ph apiRef/apiDefItem apiOperation/apiParam "><apiItemName class="- topic/keyword reference/keyword apiRef/apiItemName ">includeLineEndings</apiItemName><apiOperationClassifier class="- topic/xref reference/xref apiRef/apiRelation apiOperation/apiOperationClassifier ">Boolean</apiOperationClassifier><apiData class="- topic/ph reference/ph apiRef/apiData ">false</apiData><apiDesc class="- topic/section reference/section apiRef/apiDesc ">An optional Boolean value that specifies
whether newline characters are inserted into the returned string where
appropriate. The default value is <codeph class="+ topic/ph pr-d/codeph ">false</codeph>.
</apiDesc></apiParam></apiOperationDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
Returns a string that contains all the characters specified by the corresponding
<codeph class="+ topic/ph pr-d/codeph ">setSelected()</codeph> method. If no characters are specified (by the
<codeph class="+ topic/ph pr-d/codeph ">setSelected()</codeph> method), an empty string is returned.
<p class="- topic/p ">If you pass <codeph class="+ topic/ph pr-d/codeph ">true</codeph> for <codeph class="+ topic/ph pr-d/codeph ">includeLineEndings</codeph>,
newline characters are inserted in the return string, and
the return string might be longer than the input range. If
<codeph class="+ topic/ph pr-d/codeph ">includeLineEndings</codeph> is <codeph class="+ topic/ph pr-d/codeph ">false</codeph> or omitted, the method returns
the selected text without adding any characters.</p>
</apiDesc></apiOperationDetail><related-links class="- topic/related-links "><link href="flash.text.xml#TextSnapshot/getSelected()" class="- topic/link "><linktext class="- topic/linktext ">flash.text.TextSnapshot.getSelected()</linktext></link><link href="flash.text.xml#TextSnapshot/setSelected()" class="- topic/link "><linktext class="- topic/linktext ">flash.text.TextSnapshot.setSelected()</linktext></link></related-links></apiOperation><apiOperation id="flash.text:TextSnapshot:getSelected" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiOperation/apiOperation "><apiName class="- topic/title reference/title apiRef/apiName ">getSelected</apiName><shortdesc class="- topic/shortdesc ">
Returns a Boolean value that specifies whether a TextSnapshot object contains selected text in
the specified range.</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="Flash" version="9" class="+ topic/ph adobe-api-d/apiPlatform "/><apiPlatform description="" name="Lite" version="4" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata><asCustoms class="+ topic/metadata adobe-api-d/asCustoms "><keyword class="- topic/keyword ">TextSnapshot.getSelected, getSelected
</keyword></asCustoms></prolog><apiOperationDetail class="- topic/body reference/refbody apiRef/apiDetail apiOperation/apiOperationDetail "><apiOperationDef class="- topic/section reference/section apiRef/apiDef apiOperation/apiOperationDef "><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiReturn class="- topic/ph reference/ph apiRef/apiDefItem apiOperation/apiReturn "><apiDesc class="- topic/section reference/section apiRef/apiDesc ">A Boolean value that indicates whether at least one character in the given range has been
selected by the corresponding <codeph class="+ topic/ph pr-d/codeph ">setSelected()</codeph> method (<codeph class="+ topic/ph pr-d/codeph ">true</codeph>); otherwise,
<codeph class="+ topic/ph pr-d/codeph ">false</codeph>.
</apiDesc><apiOperationClassifier class="- topic/xref reference/xref apiRef/apiRelation apiOperation/apiOperationClassifier ">Boolean</apiOperationClassifier></apiReturn><apiParam class="- topic/ph reference/ph apiRef/apiDefItem apiOperation/apiParam "><apiItemName class="- topic/keyword reference/keyword apiRef/apiItemName ">beginIndex</apiItemName><apiOperationClassifier class="- topic/xref reference/xref apiRef/apiRelation apiOperation/apiOperationClassifier ">int</apiOperationClassifier><apiDesc class="- topic/section reference/section apiRef/apiDesc ">Indicates the position of the first character to be examined.
Valid values for <codeph class="+ topic/ph pr-d/codeph ">beginIndex</codeph> are <codeph class="+ topic/ph pr-d/codeph ">0</codeph> through
<codeph class="+ topic/ph pr-d/codeph ">TextSnapshot.charCount - 1</codeph>. If <codeph class="+ topic/ph pr-d/codeph ">beginIndex</codeph> is a negative value,
<codeph class="+ topic/ph pr-d/codeph ">0</codeph> is used.
</apiDesc></apiParam><apiParam class="- topic/ph reference/ph apiRef/apiDefItem apiOperation/apiParam "><apiItemName class="- topic/keyword reference/keyword apiRef/apiItemName ">endIndex</apiItemName><apiOperationClassifier class="- topic/xref reference/xref apiRef/apiRelation apiOperation/apiOperationClassifier ">int</apiOperationClassifier><apiDesc class="- topic/section reference/section apiRef/apiDesc ">A value that is one greater than the index of the last character to be examined. Valid values
for <codeph class="+ topic/ph pr-d/codeph ">endIndex</codeph> are <codeph class="+ topic/ph pr-d/codeph ">0</codeph> through <codeph class="+ topic/ph pr-d/codeph ">charCount</codeph>.
The character indexed by the <codeph class="+ topic/ph pr-d/codeph ">endIndex</codeph> parameter is not included in the extracted
string. If this parameter is omitted, <codeph class="+ topic/ph pr-d/codeph ">charCount</codeph> is used. If this value is less than
or equal to the value of <codeph class="+ topic/ph pr-d/codeph ">beginIndex</codeph>, <codeph class="+ topic/ph pr-d/codeph ">beginIndex + 1</codeph> is used.
</apiDesc></apiParam></apiOperationDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
Returns a Boolean value that specifies whether a TextSnapshot object contains selected text in
the specified range.
<p class="- topic/p ">To search all characters, pass a value of <codeph class="+ topic/ph pr-d/codeph ">0</codeph> for <codeph class="+ topic/ph pr-d/codeph ">start</codeph>, and
<codeph class="+ topic/ph pr-d/codeph ">charCount</codeph> (or any very large number) for <codeph class="+ topic/ph pr-d/codeph ">end</codeph>.
To search a single character, pass the <codeph class="+ topic/ph pr-d/codeph ">end</codeph> parameter a value that is one greater
than the <codeph class="+ topic/ph pr-d/codeph ">start</codeph> parameter.</p>
</apiDesc></apiOperationDetail><related-links class="- topic/related-links "><link href="flash.text.xml#TextSnapshot/charCount" class="- topic/link "><linktext class="- topic/linktext ">flash.text.TextSnapshot.charCount</linktext></link><link href="flash.text.xml#TextSnapshot/getText()" class="- topic/link "><linktext class="- topic/linktext ">flash.text.TextSnapshot.getText()</linktext></link><link href="flash.text.xml#TextSnapshot/getSelectedText()" class="- topic/link "><linktext class="- topic/linktext ">flash.text.TextSnapshot.getSelectedText()</linktext></link><link href="flash.text.xml#TextSnapshot/setSelected()" class="- topic/link "><linktext class="- topic/linktext ">flash.text.TextSnapshot.setSelected()</linktext></link></related-links></apiOperation><apiOperation id="flash.text:TextSnapshot:getTextRunInfo" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiOperation/apiOperation "><apiName class="- topic/title reference/title apiRef/apiName ">getTextRunInfo</apiName><shortdesc class="- topic/shortdesc ">
Returns an array of objects that contains information about a run of text.</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="Flash" version="9" class="+ topic/ph adobe-api-d/apiPlatform "/><apiPlatform description="" name="Lite" version="4" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata></prolog><apiOperationDetail class="- topic/body reference/refbody apiRef/apiDetail apiOperation/apiOperationDetail "><apiOperationDef class="- topic/section reference/section apiRef/apiDef apiOperation/apiOperationDef "><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiReturn class="- topic/ph reference/ph apiRef/apiDefItem apiOperation/apiReturn "><apiDesc class="- topic/section reference/section apiRef/apiDesc ">An array of objects in which each object contains information about a specific character
in the range of characters specified by the <codeph class="+ topic/ph pr-d/codeph ">beginIndex</codeph> and <codeph class="+ topic/ph pr-d/codeph ">endIndex</codeph> parameters.
Each object contains the following eleven properties:
<ul class="- topic/ul "><li class="- topic/li "><codeph class="+ topic/ph pr-d/codeph ">indexInRun</codeph>—A zero-based integer index of the character
(relative to the entire string rather than the selected run of text).</li><li class="- topic/li "><codeph class="+ topic/ph pr-d/codeph ">selected</codeph>—A Boolean value that indicates whether the character is selected
<codeph class="+ topic/ph pr-d/codeph ">true</codeph>; <codeph class="+ topic/ph pr-d/codeph ">false</codeph> otherwise.</li><li class="- topic/li "><codeph class="+ topic/ph pr-d/codeph ">font</codeph>—The name of the character's font.</li><li class="- topic/li "><codeph class="+ topic/ph pr-d/codeph ">color</codeph>—The combined alpha and color value of the character.
The first two hexadecimal digits represent the alpha value, and the remaining digits
represent the color value.</li><li class="- topic/li "><codeph class="+ topic/ph pr-d/codeph ">height</codeph>—The height of the character, in pixels.</li><li class="- topic/li "><codeph class="+ topic/ph pr-d/codeph ">matrix_a</codeph>, <codeph class="+ topic/ph pr-d/codeph ">matrix_b</codeph>, <codeph class="+ topic/ph pr-d/codeph ">matrix_c</codeph>,
<codeph class="+ topic/ph pr-d/codeph ">matrix_d</codeph>, <codeph class="+ topic/ph pr-d/codeph ">matrix_tx</codeph>, and <codeph class="+ topic/ph pr-d/codeph ">matrix_ty</codeph>—
The values of a matrix that define the geometric transformation on the character.
Normal, upright text always has a matrix of the form
<codeph class="+ topic/ph pr-d/codeph ">[1 0 0 1 x y]</codeph>, where <codeph class="+ topic/ph pr-d/codeph ">x</codeph> and <codeph class="+ topic/ph pr-d/codeph ">y</codeph>
are the position of the character within the parent movie clip, regardless of the height of
the text. The matrix is in the parent movie clip coordinate system, and
does not include any transformations that may be on that movie clip itself (or its parent). </li><li class="- topic/li "><codeph class="+ topic/ph pr-d/codeph ">corner0x</codeph>, <codeph class="+ topic/ph pr-d/codeph ">corner0y</codeph>, <codeph class="+ topic/ph pr-d/codeph ">corner1x</codeph>, <codeph class="+ topic/ph pr-d/codeph ">corner1y</codeph>,
<codeph class="+ topic/ph pr-d/codeph ">corner2x</codeph>, <codeph class="+ topic/ph pr-d/codeph ">corner2y</codeph>, <codeph class="+ topic/ph pr-d/codeph ">corner3x</codeph>,
and <codeph class="+ topic/ph pr-d/codeph ">corner3y</codeph>—The corners of the bounding box of
the character, based on the coordinate system of the parent movie clip.
These values are only available if the font used by the character is embedded in the
SWF file.</li></ul>
</apiDesc><apiOperationClassifier class="- topic/xref reference/xref apiRef/apiRelation apiOperation/apiOperationClassifier ">Array</apiOperationClassifier></apiReturn><apiParam class="- topic/ph reference/ph apiRef/apiDefItem apiOperation/apiParam "><apiItemName class="- topic/keyword reference/keyword apiRef/apiItemName ">beginIndex</apiItemName><apiOperationClassifier class="- topic/xref reference/xref apiRef/apiRelation apiOperation/apiOperationClassifier ">int</apiOperationClassifier><apiDesc class="- topic/section reference/section apiRef/apiDesc ">The index value of the first character in a range of characters in a TextSnapshot
object.
</apiDesc></apiParam><apiParam class="- topic/ph reference/ph apiRef/apiDefItem apiOperation/apiParam "><apiItemName class="- topic/keyword reference/keyword apiRef/apiItemName ">endIndex</apiItemName><apiOperationClassifier class="- topic/xref reference/xref apiRef/apiRelation apiOperation/apiOperationClassifier ">int</apiOperationClassifier><apiDesc class="- topic/section reference/section apiRef/apiDesc ">The index value of the last character in a range of characters in a TextSnapshot
object.
</apiDesc></apiParam></apiOperationDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
Returns an array of objects that contains information about a run of text. Each object corresponds
to one character in the range of characters specified by the two method parameters.
<p class="- topic/p "><b class="+ topic/ph hi-d/b ">Note: </b> Using the <codeph class="+ topic/ph pr-d/codeph ">getTextRunInfo()</codeph> method for a large range of text can
return a large object. Adobe recommends limiting the text range defined by the
<codeph class="+ topic/ph pr-d/codeph ">beginIndex</codeph> and <codeph class="+ topic/ph pr-d/codeph ">endIndex</codeph> parameters. </p>
</apiDesc></apiOperationDetail><related-links class="- topic/related-links "><link href="flash.geom.xml#Matrix" class="- topic/link "><linktext class="- topic/linktext ">Matrix class</linktext></link></related-links></apiOperation><apiOperation id="flash.text:TextSnapshot:getText" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiOperation/apiOperation "><apiName class="- topic/title reference/title apiRef/apiName ">getText</apiName><shortdesc class="- topic/shortdesc ">
Returns a string that contains all the characters specified by the beginIndex
and endIndex parameters.</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="Flash" version="9." class="+ topic/ph adobe-api-d/apiPlatform "/><apiPlatform description="" name="Lite" version="4" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata><asCustoms class="+ topic/metadata adobe-api-d/asCustoms "><keyword class="- topic/keyword ">TextSnapshot.getText, getText
</keyword></asCustoms></prolog><apiOperationDetail class="- topic/body reference/refbody apiRef/apiDetail apiOperation/apiOperationDetail "><apiOperationDef class="- topic/section reference/section apiRef/apiDef apiOperation/apiOperationDef "><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiReturn class="- topic/ph reference/ph apiRef/apiDefItem apiOperation/apiReturn "><apiDesc class="- topic/section reference/section apiRef/apiDesc ">A string containing the characters in the specified range, or an empty string if no
characters are found in the specified range.
</apiDesc><apiOperationClassifier class="- topic/xref reference/xref apiRef/apiRelation apiOperation/apiOperationClassifier ">String</apiOperationClassifier></apiReturn><apiParam class="- topic/ph reference/ph apiRef/apiDefItem apiOperation/apiParam "><apiItemName class="- topic/keyword reference/keyword apiRef/apiItemName ">beginIndex</apiItemName><apiOperationClassifier class="- topic/xref reference/xref apiRef/apiRelation apiOperation/apiOperationClassifier ">int</apiOperationClassifier><apiDesc class="- topic/section reference/section apiRef/apiDesc ">Indicates the position of the first character to be included in the
returned string. Valid values for <codeph class="+ topic/ph pr-d/codeph ">beginIndex</codeph> are<codeph class="+ topic/ph pr-d/codeph ">0</codeph> through
<codeph class="+ topic/ph pr-d/codeph ">charCount - 1</codeph>. If <codeph class="+ topic/ph pr-d/codeph ">beginIndex</codeph> is a negative value,
<codeph class="+ topic/ph pr-d/codeph ">0</codeph> is used.
</apiDesc></apiParam><apiParam class="- topic/ph reference/ph apiRef/apiDefItem apiOperation/apiParam "><apiItemName class="- topic/keyword reference/keyword apiRef/apiItemName ">endIndex</apiItemName><apiOperationClassifier class="- topic/xref reference/xref apiRef/apiRelation apiOperation/apiOperationClassifier ">int</apiOperationClassifier><apiDesc class="- topic/section reference/section apiRef/apiDesc ">A value that is one greater than the index of the last character to be examined. Valid values
for <codeph class="+ topic/ph pr-d/codeph ">endIndex</codeph> are <codeph class="+ topic/ph pr-d/codeph ">0</codeph> through <codeph class="+ topic/ph pr-d/codeph ">charCount</codeph>. The character
indexed by the <codeph class="+ topic/ph pr-d/codeph ">endIndex</codeph> parameter is not included in the extracted string. If this
parameter is omitted, <codeph class="+ topic/ph pr-d/codeph ">charCount</codeph> is used. If this value is less than or
equal to the value of <codeph class="+ topic/ph pr-d/codeph ">beginIndex</codeph>, <codeph class="+ topic/ph pr-d/codeph ">beginIndex + 1</codeph> is used.
</apiDesc></apiParam><apiParam class="- topic/ph reference/ph apiRef/apiDefItem apiOperation/apiParam "><apiItemName class="- topic/keyword reference/keyword apiRef/apiItemName ">includeLineEndings</apiItemName><apiOperationClassifier class="- topic/xref reference/xref apiRef/apiRelation apiOperation/apiOperationClassifier ">Boolean</apiOperationClassifier><apiData class="- topic/ph reference/ph apiRef/apiData ">false</apiData><apiDesc class="- topic/section reference/section apiRef/apiDesc ">An optional Boolean value that specifies whether newline characters
are inserted (<codeph class="+ topic/ph pr-d/codeph ">true</codeph>) or are not inserted (<codeph class="+ topic/ph pr-d/codeph ">false</codeph>) into the returned string.
The default value is <codeph class="+ topic/ph pr-d/codeph ">false</codeph>.
</apiDesc></apiParam></apiOperationDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
Returns a string that contains all the characters specified by the <codeph class="+ topic/ph pr-d/codeph ">beginIndex</codeph>
and <codeph class="+ topic/ph pr-d/codeph ">endIndex</codeph> parameters. If no characters are selected, an empty string is
returned.
<p class="- topic/p ">To return all characters, pass a value of <codeph class="+ topic/ph pr-d/codeph ">0</codeph> for <codeph class="+ topic/ph pr-d/codeph ">beginIndex</codeph> and <codeph class="+ topic/ph pr-d/codeph ">
charCount</codeph> (or any very large number) for <codeph class="+ topic/ph pr-d/codeph ">endIndex</codeph>.
To return a single character, pass a value of <codeph class="+ topic/ph pr-d/codeph ">beginIndex + 1</codeph> for <codeph class="+ topic/ph pr-d/codeph ">endIndex</codeph>. </p>
<p class="- topic/p ">If you pass a value of <codeph class="+ topic/ph pr-d/codeph ">true</codeph> for <codeph class="+ topic/ph pr-d/codeph ">includeLineEndings</codeph>,
newline characters are inserted in the string returned where deemed appropriate. In this case,
the return string might be longer than the input range. If <codeph class="+ topic/ph pr-d/codeph ">includeLineEndings</codeph>
is <codeph class="+ topic/ph pr-d/codeph ">false</codeph> or omitted, the selected text is returned without any characters added.</p>
</apiDesc></apiOperationDetail><related-links class="- topic/related-links "><link href="flash.text.xml#TextSnapshot/charCount" class="- topic/link "><linktext class="- topic/linktext ">flash.text.TextSnapshot.charCount</linktext></link><link href="flash.text.xml#TextSnapshot/getSelectedText()" class="- topic/link "><linktext class="- topic/linktext ">flash.text.TextSnapshot.getSelectedText()</linktext></link></related-links></apiOperation><apiOperation id="flash.text:TextSnapshot:hitTestTextNearPos" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiOperation/apiOperation "><apiName class="- topic/title reference/title apiRef/apiName ">hitTestTextNearPos</apiName><shortdesc class="- topic/shortdesc ">
Lets you determine which character within a TextSnapshot object is on or near the specified
x, y coordinates of the movie clip containing the text in the TextSnapshot object.</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="Flash" version="9." class="+ topic/ph adobe-api-d/apiPlatform "/><apiPlatform description="" name="Lite" version="4" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata><asCustoms class="+ topic/metadata adobe-api-d/asCustoms "><keyword class="- topic/keyword ">TextSnapshot.hitTestTextNearPos, hitTestTextNearPos
</keyword></asCustoms></prolog><apiOperationDetail class="- topic/body reference/refbody apiRef/apiDetail apiOperation/apiOperationDetail "><apiOperationDef class="- topic/section reference/section apiRef/apiDef apiOperation/apiOperationDef "><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiReturn class="- topic/ph reference/ph apiRef/apiDefItem apiOperation/apiReturn "><apiDesc class="- topic/section reference/section apiRef/apiDesc ">A number representing the index value of the character that is nearest to the specified
<codeph class="+ topic/ph pr-d/codeph ">x</codeph>, <codeph class="+ topic/ph pr-d/codeph ">y</codeph> coordinate. Returns
<codeph class="+ topic/ph pr-d/codeph ">-1</codeph> if no character is found, or if the font doesn't contain character metric information.
</apiDesc><apiOperationClassifier class="- topic/xref reference/xref apiRef/apiRelation apiOperation/apiOperationClassifier ">Number</apiOperationClassifier></apiReturn><apiParam class="- topic/ph reference/ph apiRef/apiDefItem apiOperation/apiParam "><apiItemName class="- topic/keyword reference/keyword apiRef/apiItemName ">x</apiItemName><apiOperationClassifier class="- topic/xref reference/xref apiRef/apiRelation apiOperation/apiOperationClassifier ">Number</apiOperationClassifier><apiDesc class="- topic/section reference/section apiRef/apiDesc ">A number that represents the <codeph class="+ topic/ph pr-d/codeph ">x</codeph> coordinate of the movie clip containing the
text.
</apiDesc></apiParam><apiParam class="- topic/ph reference/ph apiRef/apiDefItem apiOperation/apiParam "><apiItemName class="- topic/keyword reference/keyword apiRef/apiItemName ">y</apiItemName><apiOperationClassifier class="- topic/xref reference/xref apiRef/apiRelation apiOperation/apiOperationClassifier ">Number</apiOperationClassifier><apiDesc class="- topic/section reference/section apiRef/apiDesc ">A number that represents the <codeph class="+ topic/ph pr-d/codeph ">y</codeph> coordinate of the movie clip containing the
text.
</apiDesc></apiParam><apiParam class="- topic/ph reference/ph apiRef/apiDefItem apiOperation/apiParam "><apiItemName class="- topic/keyword reference/keyword apiRef/apiItemName ">maxDistance</apiItemName><apiOperationClassifier class="- topic/xref reference/xref apiRef/apiRelation apiOperation/apiOperationClassifier ">Number</apiOperationClassifier><apiData class="- topic/ph reference/ph apiRef/apiData ">0</apiData><apiDesc class="- topic/section reference/section apiRef/apiDesc ">An optional number that represents the maximum distance from
<codeph class="+ topic/ph pr-d/codeph ">x</codeph>, <codeph class="+ topic/ph pr-d/codeph ">y</codeph> that can be searched for
text. The distance is measured from the center point of each character. The
default value is <codeph class="+ topic/ph pr-d/codeph ">0</codeph>.
</apiDesc></apiParam></apiOperationDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
Lets you determine which character within a TextSnapshot object is on or near the specified
<codeph class="+ topic/ph pr-d/codeph ">x</codeph>, <codeph class="+ topic/ph pr-d/codeph ">y</codeph> coordinates of the movie clip containing the text in the TextSnapshot object.
<p class="- topic/p ">If you omit or pass a value of <codeph class="+ topic/ph pr-d/codeph ">0</codeph> for <codeph class="+ topic/ph pr-d/codeph ">maxDistance</codeph>, the location specified
by the <codeph class="+ topic/ph pr-d/codeph ">x</codeph>, <codeph class="+ topic/ph pr-d/codeph ">y</codeph> coordinates must lie inside the bounding box of the TextSnapshot object.
</p>
<p class="- topic/p ">This method works correctly only with fonts that include character metric information; however,
by default, the Flash authoring tool does not include this information for static text fields.
<ph outputclass="flashonly" class="- topic/ph ">Therefore,
the method might return <codeph class="+ topic/ph pr-d/codeph ">-1</codeph> instead of an index value. To ensure that an index
value is returned, you can force the Flash authoring tool to include the character metric
information for a font. To do this, add a dynamic text field that uses that font, select
Character Options for that dynamic text field, and then specify that font outlines should be
embedded for at least one character. (It doesn't matter which characters you specify, nor
whether they are the characters used in the static text fields.)</ph></p>
</apiDesc></apiOperationDetail><related-links class="- topic/related-links "><link href="flash.display.xml#DisplayObject/x" class="- topic/link "><linktext class="- topic/linktext ">flash.display.DisplayObject.x</linktext></link><link href="flash.display.xml#DisplayObject/y" class="- topic/link "><linktext class="- topic/linktext ">flash.display.DisplayObject.y</linktext></link></related-links></apiOperation><apiOperation id="flash.text:TextSnapshot:setSelectColor" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiOperation/apiOperation "><apiName class="- topic/title reference/title apiRef/apiName ">setSelectColor</apiName><shortdesc class="- topic/shortdesc ">
Specifies the color to use when highlighting characters that have been selected with the
setSelected() method.</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="Flash" version="9." class="+ topic/ph adobe-api-d/apiPlatform "/><apiPlatform description="" name="Lite" version="4" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata><asCustoms class="+ topic/metadata adobe-api-d/asCustoms "><keyword class="- topic/keyword ">TextSnapshot.setSelectColor, setSelectColor
</keyword></asCustoms></prolog><apiOperationDetail class="- topic/body reference/refbody apiRef/apiDetail apiOperation/apiOperationDetail "><apiOperationDef class="- topic/section reference/section apiRef/apiDef apiOperation/apiOperationDef "><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiReturn class="- topic/ph reference/ph apiRef/apiDefItem apiOperation/apiReturn "><apiType value="void" name="type" class="- topic/state reference/state apiRef/apiType "/></apiReturn><apiParam class="- topic/ph reference/ph apiRef/apiDefItem apiOperation/apiParam "><apiItemName class="- topic/keyword reference/keyword apiRef/apiItemName ">hexColor</apiItemName><apiOperationClassifier class="- topic/xref reference/xref apiRef/apiRelation apiOperation/apiOperationClassifier ">uint</apiOperationClassifier><apiData class="- topic/ph reference/ph apiRef/apiData ">0xFFFF00</apiData><apiDesc class="- topic/section reference/section apiRef/apiDesc ">The color used for the border placed around characters that have been selected by the
corresponding <codeph class="+ topic/ph pr-d/codeph ">setSelected()</codeph> command, expressed in hexadecimal
format (0x<i class="+ topic/ph hi-d/i ">RRGGBB</i>).
</apiDesc></apiParam></apiOperationDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
Specifies the color to use when highlighting characters that have been selected with the <codeph class="+ topic/ph pr-d/codeph ">
setSelected()</codeph> method. The color is always opaque; you can't specify a
transparency value.
<p class="- topic/p ">This method works correctly only with fonts that include character metric information; however,
by default, the Flash authoring tool does not include this information for static text fields.
Therefore, the method might return <codeph class="+ topic/ph pr-d/codeph ">-1</codeph> instead of an index value.<ph outputclass="flashonly" class="- topic/ph "> To
ensure that an index value is returned, you can force the Flash authoring tool to include the
character metric information for a font. To do this, add a dynamic text field that uses that
font, select Character Options for that dynamic text field, and then specify that font outlines
should be embedded for at least one character. (It doesn't matter which characters you
specify, nor if they are the characters used in the static text fields.)</ph></p>
</apiDesc></apiOperationDetail><related-links class="- topic/related-links "><link href="flash.text.xml#TextSnapshot/setSelected()" class="- topic/link "><linktext class="- topic/linktext ">flash.text.TextSnapshot.setSelected()</linktext></link></related-links></apiOperation><apiOperation id="flash.text:TextSnapshot:setSelected" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiOperation/apiOperation "><apiName class="- topic/title reference/title apiRef/apiName ">setSelected</apiName><shortdesc class="- topic/shortdesc ">
Specifies a range of characters in a TextSnapshot object to be selected or deselected.</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="Flash" version="9." class="+ topic/ph adobe-api-d/apiPlatform "/><apiPlatform description="" name="Lite" version="4" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata><asCustoms class="+ topic/metadata adobe-api-d/asCustoms "><keyword class="- topic/keyword ">TextSnapshot.setSelected, setSelected
</keyword></asCustoms></prolog><apiOperationDetail class="- topic/body reference/refbody apiRef/apiDetail apiOperation/apiOperationDetail "><apiOperationDef class="- topic/section reference/section apiRef/apiDef apiOperation/apiOperationDef "><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiReturn class="- topic/ph reference/ph apiRef/apiDefItem apiOperation/apiReturn "><apiType value="void" name="type" class="- topic/state reference/state apiRef/apiType "/></apiReturn><apiParam class="- topic/ph reference/ph apiRef/apiDefItem apiOperation/apiParam "><apiItemName class="- topic/keyword reference/keyword apiRef/apiItemName ">beginIndex</apiItemName><apiOperationClassifier class="- topic/xref reference/xref apiRef/apiRelation apiOperation/apiOperationClassifier ">int</apiOperationClassifier><apiDesc class="- topic/section reference/section apiRef/apiDesc ">Indicates the position of the first character to select.
Valid values for <codeph class="+ topic/ph pr-d/codeph ">beginIndex</codeph> are <codeph class="+ topic/ph pr-d/codeph ">0</codeph> through <codeph class="+ topic/ph pr-d/codeph ">charCount - 1</codeph>.
If <codeph class="+ topic/ph pr-d/codeph ">beginIndex</codeph> is a negative value, <codeph class="+ topic/ph pr-d/codeph ">0</codeph> is used.
</apiDesc></apiParam><apiParam class="- topic/ph reference/ph apiRef/apiDefItem apiOperation/apiParam "><apiItemName class="- topic/keyword reference/keyword apiRef/apiItemName ">endIndex</apiItemName><apiOperationClassifier class="- topic/xref reference/xref apiRef/apiRelation apiOperation/apiOperationClassifier ">int</apiOperationClassifier><apiDesc class="- topic/section reference/section apiRef/apiDesc ">An integer that is 1+ the index of the last character to be
examined. Valid values for <codeph class="+ topic/ph pr-d/codeph ">end</codeph> are <codeph class="+ topic/ph pr-d/codeph ">0</codeph> through <codeph class="+ topic/ph pr-d/codeph ">charCount</codeph>.
The character indexed by the <codeph class="+ topic/ph pr-d/codeph ">end</codeph> parameter is not included in the extracted
string. If you omit this parameter, <codeph class="+ topic/ph pr-d/codeph ">TextSnapshot.charCount</codeph> is used. If the
value of <codeph class="+ topic/ph pr-d/codeph ">beginIndex</codeph> is less than or equal to the value of <codeph class="+ topic/ph pr-d/codeph ">endIndex</codeph>,
<codeph class="+ topic/ph pr-d/codeph ">beginIndex + 1</codeph> is used.
</apiDesc></apiParam><apiParam class="- topic/ph reference/ph apiRef/apiDefItem apiOperation/apiParam "><apiItemName class="- topic/keyword reference/keyword apiRef/apiItemName ">select</apiItemName><apiOperationClassifier class="- topic/xref reference/xref apiRef/apiRelation apiOperation/apiOperationClassifier ">Boolean</apiOperationClassifier><apiDesc class="- topic/section reference/section apiRef/apiDesc ">A Boolean value that specifies whether the text should be selected (<codeph class="+ topic/ph pr-d/codeph ">true</codeph>)
or deselected (<codeph class="+ topic/ph pr-d/codeph ">false</codeph>).
</apiDesc></apiParam></apiOperationDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
Specifies a range of characters in a TextSnapshot object to be selected or deselected.
Characters that are selected are drawn with a colored rectangle behind them, matching the
bounding box of the character. The color of the bounding box is defined by
<codeph class="+ topic/ph pr-d/codeph ">setSelectColor()</codeph>.
<p class="- topic/p ">To select or deselect all characters, pass a value of <codeph class="+ topic/ph pr-d/codeph ">0</codeph> for <codeph class="+ topic/ph pr-d/codeph ">beginIndex</codeph> and
<codeph class="+ topic/ph pr-d/codeph ">charCount</codeph> (or any very large number) for <codeph class="+ topic/ph pr-d/codeph ">endIndex</codeph>. To
specify a single character, pass a value of <codeph class="+ topic/ph pr-d/codeph ">start + 1</codeph> for <codeph class="+ topic/ph pr-d/codeph ">endIndex</codeph>. </p>
<p class="- topic/p ">Because characters are individually marked as selected, you can call this method multiple
times to select multiple characters; that is, using this method does not deselect other
characters that have been set by this method.</p>
<p class="- topic/p ">The colored rectangle that indicates a selection is displayed only for fonts that include
character metric information; by default, Flash does not include this information for static
text fields. In some cases, this behavior means that text that is selected won't appear to be
selected onscreen.<ph outputclass="flashonly" class="- topic/ph "> To ensure that all selected text appears to be
selected, you can force the Flash authoring tool to include the character metric information
for a font. To do this, add a dynamic text field that uses that font, select Character Options
for that dynamic text field, and then specify that font outlines should be embedded for at least
one character. It doesn't matter which characters you specify, nor even if they are the
characters used in the static text fields in question.</ph></p>
</apiDesc></apiOperationDetail><related-links class="- topic/related-links "><link href="flash.text.xml#TextSnapshot/charCount" class="- topic/link "><linktext class="- topic/linktext ">flash.text.TextSnapshot.charCount</linktext></link><link href="flash.text.xml#TextSnapshot/setSelectColor()" class="- topic/link "><linktext class="- topic/linktext ">flash.text.TextSnapshot.setSelectColor()</linktext></link></related-links></apiOperation><apiValue id="flash.text:TextSnapshot:charCount:get" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiValue/apiValue "><apiName class="- topic/title reference/title apiRef/apiName ">charCount</apiName><shortdesc class="- topic/shortdesc ">
The number of characters in a TextSnapshot object.</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="Flash" version="9" class="+ topic/ph adobe-api-d/apiPlatform "/><apiPlatform description="" name="Lite" version="4" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata><asCustoms class="+ topic/metadata adobe-api-d/asCustoms "><keyword class="- topic/keyword ">TextSnapshot.charCount, charCount, count
</keyword></asCustoms></prolog><apiValueDetail class="- topic/body reference/refbody apiRef/apiDetail apiValue/apiValueDetail "><apiValueDef class="- topic/section reference/section apiRef/apiDef apiValue/apiValueDef "><apiProperty class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiProperty "/><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiDynamic class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiDynamic "/><apiValueAccess value="read" class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiValueAccess "/><apiValueClassifier class="- topic/xref reference/xref apiRef/apiRelation apiValue/apiValueClassifier ">int</apiValueClassifier></apiValueDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
The number of characters in a TextSnapshot object.
</apiDesc></apiValueDetail><related-links class="- topic/related-links "><link href="flash.text.xml#TextSnapshot/getText()" class="- topic/link "><linktext class="- topic/linktext ">flash.text.TextSnapshot.getText()</linktext></link></related-links></apiValue></apiClassifier><apiClassifier languages="" id="flash.text:TextFieldAutoSize" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiClassifier/apiClassifier "><apiName class="- topic/title reference/title apiRef/apiName ">TextFieldAutoSize</apiName><shortdesc class="- topic/shortdesc ">
The TextFieldAutoSize class is an enumeration of constant values used in setting the autoSize
property of the TextField class.</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="Flash" version="9" class="+ topic/ph adobe-api-d/apiPlatform "/><apiPlatform description="" name="Lite" version="4" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata></prolog><apiClassifierDetail class="- topic/body reference/refbody apiRef/apiDetail apiClassifier/apiClassifierDetail "><apiClassifierDef class="- topic/section reference/section apiRef/apiDef apiClassifier/apiClassifierDef "><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiStatic class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiStatic "/><apiFinal class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiFinal "/><apiBaseClassifier class="- topic/xref reference/xref apiRef/apiRelation apiClassifier/apiBaseClassifier ">Object</apiBaseClassifier></apiClassifierDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
The TextFieldAutoSize class is an enumeration of constant values used in setting the <codeph class="+ topic/ph pr-d/codeph ">autoSize</codeph>
property of the TextField class.
</apiDesc></apiClassifierDetail><related-links class="- topic/related-links "><link href="flash.text.xml#TextField/autoSize" class="- topic/link "><linktext class="- topic/linktext ">flash.text.TextField.autoSize</linktext></link></related-links><apiValue id="flash.text:TextFieldAutoSize:CENTER" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiValue/apiValue "><apiName class="- topic/title reference/title apiRef/apiName ">CENTER</apiName><shortdesc class="- topic/shortdesc ">
Specifies that the text is to be treated as center-justified text.</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="Flash" version="9" class="+ topic/ph adobe-api-d/apiPlatform "/><apiPlatform description="" name="Lite" version="4" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata></prolog><apiValueDetail class="- topic/body reference/refbody apiRef/apiDetail apiValue/apiValueDetail "><apiValueDef class="- topic/section reference/section apiRef/apiDef apiValue/apiValueDef "><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiStatic class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiStatic "/><apiData class="- topic/ph reference/ph apiRef/apiData ">center</apiData><apiValueClassifier class="- topic/xref reference/xref apiRef/apiRelation apiValue/apiValueClassifier ">String</apiValueClassifier></apiValueDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
Specifies that the text is to be treated as center-justified text.
Any resizing of a single line of a text field is equally distributed
to both the right and left sides.
</apiDesc></apiValueDetail></apiValue><apiValue id="flash.text:TextFieldAutoSize:LEFT" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiValue/apiValue "><apiName class="- topic/title reference/title apiRef/apiName ">LEFT</apiName><shortdesc class="- topic/shortdesc ">
Specifies that the text is to be treated as left-justified text,
meaning that the left side of the text field remains fixed and any
resizing of a single line is on the right side.</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="Flash" version="9" class="+ topic/ph adobe-api-d/apiPlatform "/><apiPlatform description="" name="Lite" version="4" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata></prolog><apiValueDetail class="- topic/body reference/refbody apiRef/apiDetail apiValue/apiValueDetail "><apiValueDef class="- topic/section reference/section apiRef/apiDef apiValue/apiValueDef "><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiStatic class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiStatic "/><apiData class="- topic/ph reference/ph apiRef/apiData ">left</apiData><apiValueClassifier class="- topic/xref reference/xref apiRef/apiRelation apiValue/apiValueClassifier ">String</apiValueClassifier></apiValueDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
Specifies that the text is to be treated as left-justified text,
meaning that the left side of the text field remains fixed and any
resizing of a single line is on the right side.
</apiDesc></apiValueDetail></apiValue><apiValue id="flash.text:TextFieldAutoSize:NONE" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiValue/apiValue "><apiName class="- topic/title reference/title apiRef/apiName ">NONE</apiName><shortdesc class="- topic/shortdesc ">
Specifies that no resizing is to occur.</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="Flash" version="9" class="+ topic/ph adobe-api-d/apiPlatform "/><apiPlatform description="" name="Lite" version="4" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata></prolog><apiValueDetail class="- topic/body reference/refbody apiRef/apiDetail apiValue/apiValueDetail "><apiValueDef class="- topic/section reference/section apiRef/apiDef apiValue/apiValueDef "><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiStatic class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiStatic "/><apiData class="- topic/ph reference/ph apiRef/apiData ">none</apiData><apiValueClassifier class="- topic/xref reference/xref apiRef/apiRelation apiValue/apiValueClassifier ">String</apiValueClassifier></apiValueDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
Specifies that no resizing is to occur.
</apiDesc></apiValueDetail></apiValue><apiValue id="flash.text:TextFieldAutoSize:RIGHT" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiValue/apiValue "><apiName class="- topic/title reference/title apiRef/apiName ">RIGHT</apiName><shortdesc class="- topic/shortdesc ">
Specifies that the text is to be treated as right-justified text,
meaning that the right side of the text field remains fixed and any
resizing of a single line is on the left side.</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="Flash" version="9" class="+ topic/ph adobe-api-d/apiPlatform "/><apiPlatform description="" name="Lite" version="4" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata></prolog><apiValueDetail class="- topic/body reference/refbody apiRef/apiDetail apiValue/apiValueDetail "><apiValueDef class="- topic/section reference/section apiRef/apiDef apiValue/apiValueDef "><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiStatic class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiStatic "/><apiData class="- topic/ph reference/ph apiRef/apiData ">right</apiData><apiValueClassifier class="- topic/xref reference/xref apiRef/apiRelation apiValue/apiValueClassifier ">String</apiValueClassifier></apiValueDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
Specifies that the text is to be treated as right-justified text,
meaning that the right side of the text field remains fixed and any
resizing of a single line is on the left side.
</apiDesc></apiValueDetail></apiValue></apiClassifier><apiClassifier languages="" id="flash.text:TextFieldType" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiClassifier/apiClassifier "><apiName class="- topic/title reference/title apiRef/apiName ">TextFieldType</apiName><shortdesc class="- topic/shortdesc ">
The TextFieldType class is an enumeration of constant values used in setting the type property
of the TextField class.</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="Flash" version="9" class="+ topic/ph adobe-api-d/apiPlatform "/><apiPlatform description="" name="Lite" version="4" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata></prolog><apiClassifierDetail class="- topic/body reference/refbody apiRef/apiDetail apiClassifier/apiClassifierDetail "><apiClassifierDef class="- topic/section reference/section apiRef/apiDef apiClassifier/apiClassifierDef "><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiStatic class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiStatic "/><apiFinal class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiFinal "/><apiBaseClassifier class="- topic/xref reference/xref apiRef/apiRelation apiClassifier/apiBaseClassifier ">Object</apiBaseClassifier></apiClassifierDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
The TextFieldType class is an enumeration of constant values used in setting the <codeph class="+ topic/ph pr-d/codeph ">type</codeph> property
of the TextField class.
</apiDesc></apiClassifierDetail><related-links class="- topic/related-links "><link href="flash.text.xml#TextField/type" class="- topic/link "><linktext class="- topic/linktext ">flash.text.TextField.type</linktext></link></related-links><apiValue id="flash.text:TextFieldType:DYNAMIC" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiValue/apiValue "><apiName class="- topic/title reference/title apiRef/apiName ">DYNAMIC</apiName><shortdesc class="- topic/shortdesc ">
Used to specify a dynamic TextField.</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="Flash" version="9" class="+ topic/ph adobe-api-d/apiPlatform "/><apiPlatform description="" name="Lite" version="4" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata></prolog><apiValueDetail class="- topic/body reference/refbody apiRef/apiDetail apiValue/apiValueDetail "><apiValueDef class="- topic/section reference/section apiRef/apiDef apiValue/apiValueDef "><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiStatic class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiStatic "/><apiData class="- topic/ph reference/ph apiRef/apiData ">dynamic</apiData><apiValueClassifier class="- topic/xref reference/xref apiRef/apiRelation apiValue/apiValueClassifier ">String</apiValueClassifier></apiValueDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
Used to specify a <codeph class="+ topic/ph pr-d/codeph ">dynamic</codeph> TextField.
</apiDesc></apiValueDetail></apiValue><apiValue id="flash.text:TextFieldType:INPUT" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiValue/apiValue "><apiName class="- topic/title reference/title apiRef/apiName ">INPUT</apiName><shortdesc class="- topic/shortdesc ">
Used to specify an input TextField.</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="Flash" version="9" class="+ topic/ph adobe-api-d/apiPlatform "/><apiPlatform description="" name="Lite" version="4" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata></prolog><apiValueDetail class="- topic/body reference/refbody apiRef/apiDetail apiValue/apiValueDetail "><apiValueDef class="- topic/section reference/section apiRef/apiDef apiValue/apiValueDef "><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiStatic class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiStatic "/><apiData class="- topic/ph reference/ph apiRef/apiData ">input</apiData><apiValueClassifier class="- topic/xref reference/xref apiRef/apiRelation apiValue/apiValueClassifier ">String</apiValueClassifier></apiValueDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
Used to specify an <codeph class="+ topic/ph pr-d/codeph ">input</codeph> TextField.
</apiDesc></apiValueDetail></apiValue></apiClassifier><apiClassifier languages="" id="flash.text:FontStyle" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiClassifier/apiClassifier "><apiName class="- topic/title reference/title apiRef/apiName ">FontStyle</apiName><shortdesc class="- topic/shortdesc ">
The FontStyle class provides values for the TextRenderer class.</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="Flash" version="9" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata></prolog><apiClassifierDetail class="- topic/body reference/refbody apiRef/apiDetail apiClassifier/apiClassifierDetail "><apiClassifierDef class="- topic/section reference/section apiRef/apiDef apiClassifier/apiClassifierDef "><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiStatic class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiStatic "/><apiFinal class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiFinal "/><apiBaseClassifier class="- topic/xref reference/xref apiRef/apiRelation apiClassifier/apiBaseClassifier ">Object</apiBaseClassifier></apiClassifierDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
The FontStyle class provides values for the TextRenderer class.
</apiDesc></apiClassifierDetail><related-links class="- topic/related-links "><link href="flash.text.xml#TextRenderer" class="- topic/link "><linktext class="- topic/linktext ">flash.text.TextRenderer</linktext></link></related-links><apiValue id="flash.text:FontStyle:BOLD_ITALIC" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiValue/apiValue "><apiName class="- topic/title reference/title apiRef/apiName ">BOLD_ITALIC</apiName><shortdesc class="- topic/shortdesc ">
Defines the combined bold and italic style of a font for the fontStyle parameter in the setAdvancedAntiAliasingTable() method.</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="Flash" version="9" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata></prolog><apiValueDetail class="- topic/body reference/refbody apiRef/apiDetail apiValue/apiValueDetail "><apiValueDef class="- topic/section reference/section apiRef/apiDef apiValue/apiValueDef "><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiStatic class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiStatic "/><apiData class="- topic/ph reference/ph apiRef/apiData ">boldItalic</apiData><apiValueClassifier class="- topic/xref reference/xref apiRef/apiRelation apiValue/apiValueClassifier ">String</apiValueClassifier></apiValueDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
Defines the combined bold and italic style of a font for the <codeph class="+ topic/ph pr-d/codeph ">fontStyle</codeph> parameter in the <codeph class="+ topic/ph pr-d/codeph ">setAdvancedAntiAliasingTable()</codeph> method. Use the syntax <codeph class="+ topic/ph pr-d/codeph ">FontStyle.BOLD_ITALIC</codeph>.
</apiDesc></apiValueDetail><related-links class="- topic/related-links "><link href="flash.text.xml#TextRenderer/setAdvancedAntiAliasingTable()" class="- topic/link "><linktext class="- topic/linktext ">flash.text.TextRenderer.setAdvancedAntiAliasingTable()</linktext></link></related-links></apiValue><apiValue id="flash.text:FontStyle:BOLD" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiValue/apiValue "><apiName class="- topic/title reference/title apiRef/apiName ">BOLD</apiName><shortdesc class="- topic/shortdesc ">
Defines the bold style of a font for the fontStyle parameter in the setAdvancedAntiAliasingTable() method.</shortdesc><prolog class="- topic/prolog "><author class="- topic/author ">Bob Pappas
</author><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="Flash" version="9" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata></prolog><apiValueDetail class="- topic/body reference/refbody apiRef/apiDetail apiValue/apiValueDetail "><apiValueDef class="- topic/section reference/section apiRef/apiDef apiValue/apiValueDef "><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiStatic class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiStatic "/><apiData class="- topic/ph reference/ph apiRef/apiData ">bold</apiData><apiValueClassifier class="- topic/xref reference/xref apiRef/apiRelation apiValue/apiValueClassifier ">String</apiValueClassifier></apiValueDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
Defines the bold style of a font for the <codeph class="+ topic/ph pr-d/codeph ">fontStyle</codeph> parameter in the <codeph class="+ topic/ph pr-d/codeph ">setAdvancedAntiAliasingTable()</codeph> method. Use the syntax <codeph class="+ topic/ph pr-d/codeph ">FontStyle.BOLD</codeph>.
</apiDesc></apiValueDetail><related-links class="- topic/related-links "><link href="flash.text.xml#TextRenderer/setAdvancedAntiAliasingTable()" class="- topic/link "><linktext class="- topic/linktext ">flash.text.TextRenderer.setAdvancedAntiAliasingTable()</linktext></link></related-links></apiValue><apiValue id="flash.text:FontStyle:ITALIC" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiValue/apiValue "><apiName class="- topic/title reference/title apiRef/apiName ">ITALIC</apiName><shortdesc class="- topic/shortdesc ">
Defines the italic style of a font for the fontStyle parameter in the setAdvancedAntiAliasingTable() method.</shortdesc><prolog class="- topic/prolog "><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="Flash" version="9" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata></prolog><apiValueDetail class="- topic/body reference/refbody apiRef/apiDetail apiValue/apiValueDetail "><apiValueDef class="- topic/section reference/section apiRef/apiDef apiValue/apiValueDef "><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiStatic class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiStatic "/><apiData class="- topic/ph reference/ph apiRef/apiData ">italic</apiData><apiValueClassifier class="- topic/xref reference/xref apiRef/apiRelation apiValue/apiValueClassifier ">String</apiValueClassifier></apiValueDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
Defines the italic style of a font for the <codeph class="+ topic/ph pr-d/codeph ">fontStyle</codeph> parameter in the <codeph class="+ topic/ph pr-d/codeph ">setAdvancedAntiAliasingTable()</codeph> method. Use the syntax <codeph class="+ topic/ph pr-d/codeph ">FontStyle.ITALIC</codeph>.
</apiDesc></apiValueDetail><related-links class="- topic/related-links "><link href="flash.text.xml#TextRenderer/setAdvancedAntiAliasingTable()" class="- topic/link "><linktext class="- topic/linktext ">flash.text.TextRenderer.setAdvancedAntiAliasingTable()</linktext></link></related-links></apiValue><apiValue id="flash.text:FontStyle:REGULAR" ditaarch:DITAArchVersion="1.0" domains="(topic ui-d) (topic hi-d) (topic pr-d) (topic sw-d) (topic ut-d) (topic pr-d api-d)" class="- topic/topic reference/reference apiRef/apiRef apiValue/apiValue "><apiName class="- topic/title reference/title apiRef/apiName ">REGULAR</apiName><shortdesc class="- topic/shortdesc ">
Defines the plain style of a font for the fontStyle parameter in the setAdvancedAntiAliasingTable() method.</shortdesc><prolog class="- topic/prolog "><author class="- topic/author ">Bob Pappas
</author><asMetadata class="+ topic/metadata adobe-api-d/asMetadata "><apiVersion class="+ topic/ph adobe-api-d/apiVersion "><apiLanguage version="3.0" class="+ topic/ph adobe-api-d/apiLanguage "/><apiPlatform description="" name="Flash" version="9" class="+ topic/ph adobe-api-d/apiPlatform "/></apiVersion></asMetadata></prolog><apiValueDetail class="- topic/body reference/refbody apiRef/apiDetail apiValue/apiValueDetail "><apiValueDef class="- topic/section reference/section apiRef/apiDef apiValue/apiValueDef "><apiAccess value="public" class="- topic/state reference/state apiRef/apiQualifier adobe-api-d/apiAccess "/><apiStatic class="+ topic/state reference/state apiRef/apiQualifier adobe-api-d/apiStatic "/><apiData class="- topic/ph reference/ph apiRef/apiData ">regular</apiData><apiValueClassifier class="- topic/xref reference/xref apiRef/apiRelation apiValue/apiValueClassifier ">String</apiValueClassifier></apiValueDef><apiDesc class="- topic/section reference/section apiRef/apiDesc ">
Defines the plain style of a font for the <codeph class="+ topic/ph pr-d/codeph ">fontStyle</codeph> parameter in the <codeph class="+ topic/ph pr-d/codeph ">setAdvancedAntiAliasingTable()</codeph> method. Use the syntax <codeph class="+ topic/ph pr-d/codeph ">FontStyle.REGULAR</codeph>.
</apiDesc></apiValueDetail><related-links class="- topic/related-links "><link href="flash.text.xml#TextRenderer/setAdvancedAntiAliasingTable()" class="- topic/link "><linktext class="- topic/linktext ">flash.text.TextRenderer.setAdvancedAntiAliasingTable()</linktext></link></related-links></apiValue></apiClassifier></apiPackage>