適用於 Adobe® Flash® Platform 的 ActionScript® 3.0 參考
首頁  |  隱藏套件和類別清單 |  套件  |  類別  |  新增內容  |  索引  |  附錄  |  為什麼顯示英文?
篩選: AIR 30.0 和更早版本, Flash Player 30.0 和更早版本, Flash Lite 4
Flex 4.6 和更早版本, Flash Pro CS6 和更早版本
隱藏篩選
flash.text.engine 

TextBlock  - AS3

套件x

最上層
adobe.utils
air.desktop
air.net
air.update
air.update.events
coldfusion.air
coldfusion.air.errors
coldfusion.air.events
coldfusion.service
coldfusion.service.events
coldfusion.service.mxml
com.adobe.acm.solutions.authoring.domain.extensions
com.adobe.acm.solutions.ccr.domain.extensions
com.adobe.consulting.pst.vo
com.adobe.dct.component
com.adobe.dct.component.datadictionary
com.adobe.dct.component.datadictionaryElement
com.adobe.dct.component.dataElementsPanel
com.adobe.dct.component.toolbars
com.adobe.dct.event
com.adobe.dct.exp
com.adobe.dct.model
com.adobe.dct.service
com.adobe.dct.service.provider
com.adobe.dct.transfer
com.adobe.dct.util
com.adobe.dct.view
com.adobe.ep.taskmanagement.domain
com.adobe.ep.taskmanagement.event
com.adobe.ep.taskmanagement.filter
com.adobe.ep.taskmanagement.services
com.adobe.ep.taskmanagement.util
com.adobe.ep.ux.attachmentlist.component
com.adobe.ep.ux.attachmentlist.domain
com.adobe.ep.ux.attachmentlist.domain.events
com.adobe.ep.ux.attachmentlist.domain.renderers
com.adobe.ep.ux.attachmentlist.skin
com.adobe.ep.ux.attachmentlist.skin.renderers
com.adobe.ep.ux.content.event
com.adobe.ep.ux.content.factory
com.adobe.ep.ux.content.handlers
com.adobe.ep.ux.content.managers
com.adobe.ep.ux.content.model.asset
com.adobe.ep.ux.content.model.preview
com.adobe.ep.ux.content.model.relation
com.adobe.ep.ux.content.model.search
com.adobe.ep.ux.content.model.toolbar
com.adobe.ep.ux.content.search
com.adobe.ep.ux.content.services
com.adobe.ep.ux.content.services.load
com.adobe.ep.ux.content.services.permissions
com.adobe.ep.ux.content.services.preview
com.adobe.ep.ux.content.services.providers
com.adobe.ep.ux.content.services.query
com.adobe.ep.ux.content.services.relationships
com.adobe.ep.ux.content.services.search.lccontent
com.adobe.ep.ux.content.services.version
com.adobe.ep.ux.content.view
com.adobe.ep.ux.content.view.components.activate
com.adobe.ep.ux.content.view.components.grid
com.adobe.ep.ux.content.view.components.grid.hover
com.adobe.ep.ux.content.view.components.grid.hover.component
com.adobe.ep.ux.content.view.components.grid.renderers
com.adobe.ep.ux.content.view.components.relationships
com.adobe.ep.ux.content.view.components.review
com.adobe.ep.ux.content.view.components.search.renderers
com.adobe.ep.ux.content.view.components.searchpod
com.adobe.ep.ux.content.view.components.toolbar
com.adobe.ep.ux.content.view.components.toolbar.controlRenderers
com.adobe.ep.ux.content.view.components.version
com.adobe.ep.ux.documentsubmit.component
com.adobe.ep.ux.documentsubmit.domain
com.adobe.ep.ux.documentsubmit.skin
com.adobe.ep.ux.taskaction.component
com.adobe.ep.ux.taskaction.domain
com.adobe.ep.ux.taskaction.domain.events
com.adobe.ep.ux.taskaction.skin
com.adobe.ep.ux.taskdetails.component
com.adobe.ep.ux.taskdetails.domain
com.adobe.ep.ux.taskdetails.skin
com.adobe.ep.ux.tasklist.component
com.adobe.ep.ux.tasklist.domain
com.adobe.ep.ux.tasklist.skin
com.adobe.ep.ux.webdocumentviewer.domain
com.adobe.exm.expression
com.adobe.exm.expression.error
com.adobe.exm.expression.event
com.adobe.exm.expression.impl
com.adobe.fiber.runtime.lib
com.adobe.fiber.services
com.adobe.fiber.services.wrapper
com.adobe.fiber.styles
com.adobe.fiber.util
com.adobe.fiber.valueobjects
com.adobe.gravity.binding
com.adobe.gravity.context
com.adobe.gravity.flex.bundleloader
com.adobe.gravity.flex.progress
com.adobe.gravity.flex.serviceloader
com.adobe.gravity.framework
com.adobe.gravity.init
com.adobe.gravity.service.bundleloader
com.adobe.gravity.service.logging
com.adobe.gravity.service.manifest
com.adobe.gravity.service.progress
com.adobe.gravity.tracker
com.adobe.gravity.ui
com.adobe.gravity.utility
com.adobe.gravity.utility.async
com.adobe.gravity.utility.error
com.adobe.gravity.utility.events
com.adobe.gravity.utility.factory
com.adobe.gravity.utility.flex.async
com.adobe.gravity.utility.logging
com.adobe.gravity.utility.message
com.adobe.gravity.utility.sequence
com.adobe.gravity.utility.url
com.adobe.guides.control
com.adobe.guides.domain
com.adobe.guides.i18n
com.adobe.guides.spark.components.skins
com.adobe.guides.spark.components.skins.mx
com.adobe.guides.spark.headers.components
com.adobe.guides.spark.headers.skins
com.adobe.guides.spark.layouts.components
com.adobe.guides.spark.layouts.skins
com.adobe.guides.spark.navigators.components
com.adobe.guides.spark.navigators.renderers
com.adobe.guides.spark.navigators.skins
com.adobe.guides.spark.util
com.adobe.guides.spark.wrappers.components
com.adobe.guides.spark.wrappers.skins
com.adobe.guides.submit
com.adobe.icc.dc.domain
com.adobe.icc.dc.domain.factory
com.adobe.icc.editors.events
com.adobe.icc.editors.handlers
com.adobe.icc.editors.managers
com.adobe.icc.editors.model
com.adobe.icc.editors.model.config
com.adobe.icc.editors.model.el
com.adobe.icc.editors.model.el.operands
com.adobe.icc.editors.model.el.operators
com.adobe.icc.enum
com.adobe.icc.external.dc
com.adobe.icc.obj
com.adobe.icc.services
com.adobe.icc.services.category
com.adobe.icc.services.config
com.adobe.icc.services.download
com.adobe.icc.services.export
com.adobe.icc.services.external
com.adobe.icc.services.formbridge
com.adobe.icc.services.fragmentlayout
com.adobe.icc.services.layout
com.adobe.icc.services.letter
com.adobe.icc.services.locator
com.adobe.icc.services.module
com.adobe.icc.services.render
com.adobe.icc.services.submit
com.adobe.icc.services.user
com.adobe.icc.token
com.adobe.icc.vo
com.adobe.icc.vo.render
com.adobe.icomm.assetplacement.controller
com.adobe.icomm.assetplacement.controller.utils
com.adobe.icomm.assetplacement.data
com.adobe.icomm.assetplacement.model
com.adobe.livecycle.assetmanager.client
com.adobe.livecycle.assetmanager.client.event
com.adobe.livecycle.assetmanager.client.handler
com.adobe.livecycle.assetmanager.client.managers
com.adobe.livecycle.assetmanager.client.model
com.adobe.livecycle.assetmanager.client.model.cms
com.adobe.livecycle.assetmanager.client.service
com.adobe.livecycle.assetmanager.client.service.search
com.adobe.livecycle.assetmanager.client.service.search.cms
com.adobe.livecycle.assetmanager.client.utils
com.adobe.livecycle.content
com.adobe.livecycle.rca.model
com.adobe.livecycle.rca.model.constant
com.adobe.livecycle.rca.model.document
com.adobe.livecycle.rca.model.participant
com.adobe.livecycle.rca.model.reminder
com.adobe.livecycle.rca.model.stage
com.adobe.livecycle.rca.service
com.adobe.livecycle.rca.service.core
com.adobe.livecycle.rca.service.core.delegate
com.adobe.livecycle.rca.service.process
com.adobe.livecycle.rca.service.process.delegate
com.adobe.livecycle.rca.token
com.adobe.livecycle.ria.security.api
com.adobe.livecycle.ria.security.service
com.adobe.mosaic.layouts
com.adobe.mosaic.layouts.dragAndDrop
com.adobe.mosaic.layouts.interfaces
com.adobe.mosaic.mxml
com.adobe.mosaic.om.constants
com.adobe.mosaic.om.events
com.adobe.mosaic.om.impl
com.adobe.mosaic.om.interfaces
com.adobe.mosaic.skinning
com.adobe.mosaic.sparklib.editors
com.adobe.mosaic.sparklib.optionMenu
com.adobe.mosaic.sparklib.scrollableMenu
com.adobe.mosaic.sparklib.scrollableMenu.skins
com.adobe.mosaic.sparklib.tabLayout
com.adobe.mosaic.sparklib.tabLayout.events
com.adobe.mosaic.sparklib.tabLayout.layouts
com.adobe.mosaic.sparklib.tabLayout.skins
com.adobe.mosaic.sparklib.text
com.adobe.mosaic.sparklib.util
com.adobe.solutions.acm.authoring.presentation
com.adobe.solutions.acm.authoring.presentation.actionbar
com.adobe.solutions.acm.authoring.presentation.common
com.adobe.solutions.acm.authoring.presentation.events
com.adobe.solutions.acm.authoring.presentation.fragment
com.adobe.solutions.acm.authoring.presentation.letter
com.adobe.solutions.acm.authoring.presentation.letter.data
com.adobe.solutions.acm.authoring.presentation.preview
com.adobe.solutions.acm.authoring.presentation.rte
com.adobe.solutions.acm.ccr.presentation
com.adobe.solutions.acm.ccr.presentation.contentcapture
com.adobe.solutions.acm.ccr.presentation.contentcapture.events
com.adobe.solutions.acm.ccr.presentation.contentcapture.preview
com.adobe.solutions.acm.ccr.presentation.datacapture
com.adobe.solutions.acm.ccr.presentation.datacapture.renderers
com.adobe.solutions.acm.ccr.presentation.pdf
com.adobe.solutions.exm
com.adobe.solutions.exm.authoring
com.adobe.solutions.exm.authoring.components.controls
com.adobe.solutions.exm.authoring.components.toolbars
com.adobe.solutions.exm.authoring.domain
com.adobe.solutions.exm.authoring.domain.expression
com.adobe.solutions.exm.authoring.domain.impl
com.adobe.solutions.exm.authoring.domain.method
com.adobe.solutions.exm.authoring.domain.variable
com.adobe.solutions.exm.authoring.enum
com.adobe.solutions.exm.authoring.events
com.adobe.solutions.exm.authoring.model
com.adobe.solutions.exm.authoring.renderer
com.adobe.solutions.exm.authoring.view
com.adobe.solutions.exm.expression
com.adobe.solutions.exm.impl
com.adobe.solutions.exm.impl.method
com.adobe.solutions.exm.method
com.adobe.solutions.exm.mock
com.adobe.solutions.exm.mock.method
com.adobe.solutions.exm.runtime
com.adobe.solutions.exm.runtime.impl
com.adobe.solutions.exm.variable
com.adobe.solutions.prm.constant
com.adobe.solutions.prm.domain
com.adobe.solutions.prm.domain.factory
com.adobe.solutions.prm.domain.impl
com.adobe.solutions.prm.domain.manager
com.adobe.solutions.prm.presentation.asset
com.adobe.solutions.prm.presentation.constant
com.adobe.solutions.prm.presentation.document
com.adobe.solutions.prm.presentation.event
com.adobe.solutions.prm.presentation.file
com.adobe.solutions.prm.presentation.project
com.adobe.solutions.prm.presentation.team
com.adobe.solutions.prm.presentation.util
com.adobe.solutions.prm.service
com.adobe.solutions.prm.services.impl
com.adobe.solutions.prm.vo
com.adobe.solutions.rca.constant
com.adobe.solutions.rca.domain
com.adobe.solutions.rca.domain.common
com.adobe.solutions.rca.domain.factory
com.adobe.solutions.rca.domain.impl
com.adobe.solutions.rca.domain.impl.manager
com.adobe.solutions.rca.domain.manager
com.adobe.solutions.rca.presentation
com.adobe.solutions.rca.presentation.comment
com.adobe.solutions.rca.presentation.constant
com.adobe.solutions.rca.presentation.event
com.adobe.solutions.rca.presentation.gantt
com.adobe.solutions.rca.presentation.gantt.ruler
com.adobe.solutions.rca.presentation.template
com.adobe.solutions.rca.presentation.template.audit
com.adobe.solutions.rca.presentation.template.definition
com.adobe.solutions.rca.presentation.template.documents
com.adobe.solutions.rca.presentation.template.stages
com.adobe.solutions.rca.presentation.util
com.adobe.solutions.rca.service
com.adobe.solutions.rca.services.impl
com.adobe.solutions.rca.vo
com.adobe.solutions.rca.vo.um
com.adobe.viewsource
fl.accessibility
fl.containers
fl.controls
fl.controls.dataGridClasses
fl.controls.listClasses
fl.controls.progressBarClasses
fl.core
fl.data
fl.display
fl.events
fl.ik
fl.lang
fl.livepreview
fl.managers
fl.motion
fl.motion.easing
fl.rsl
fl.text
fl.transitions
fl.transitions.easing
fl.video
flash.accessibility
flash.concurrent
flash.crypto
flash.data
flash.desktop
flash.display
flash.display3D
flash.display3D.textures
flash.errors
flash.events
flash.external
flash.filesystem
flash.filters
flash.geom
flash.globalization
flash.html
flash.media
flash.net
flash.net.dns
flash.net.drm
flash.notifications
flash.permissions
flash.printing
flash.profiler
flash.sampler
flash.security
flash.sensors
flash.system
flash.text
flash.text.engine
flash.text.ime
flash.ui
flash.utils
flash.xml
flashx.textLayout
flashx.textLayout.compose
flashx.textLayout.container
flashx.textLayout.conversion
flashx.textLayout.edit
flashx.textLayout.elements
flashx.textLayout.events
flashx.textLayout.factory
flashx.textLayout.formats
flashx.textLayout.operations
flashx.textLayout.utils
flashx.undo
ga.controls
ga.layouts
ga.model
ga.uiComponents
ga.util
ga.views
ga.wrappers
lc.foundation
lc.foundation.domain
lc.foundation.events
lc.foundation.ui
lc.foundation.util
lc.preloader
lc.procmgmt
lc.procmgmt.commands
lc.procmgmt.domain
lc.procmgmt.events
lc.procmgmt.formbridge
lc.procmgmt.impl
lc.procmgmt.ui.attachments
lc.procmgmt.ui.controls
lc.procmgmt.ui.controls.card
lc.procmgmt.ui.controls.renderer
lc.procmgmt.ui.help
lc.procmgmt.ui.layout
lc.procmgmt.ui.presentationmodel
lc.procmgmt.ui.process
lc.procmgmt.ui.search
lc.procmgmt.ui.startpoint
lc.procmgmt.ui.task
lc.procmgmt.ui.task.form
lc.procmgmt.ui.task.form.commands
lc.procmgmt.ui.tracking
mx.accessibility
mx.automation
mx.automation.air
mx.automation.delegates
mx.automation.delegates.advancedDataGrid
mx.automation.delegates.charts
mx.automation.delegates.containers
mx.automation.delegates.controls
mx.automation.delegates.controls.dataGridClasses
mx.automation.delegates.controls.fileSystemClasses
mx.automation.delegates.core
mx.automation.delegates.flashflexkit
mx.automation.events
mx.binding
mx.binding.utils
mx.charts
mx.charts.chartClasses
mx.charts.effects
mx.charts.effects.effectClasses
mx.charts.events
mx.charts.renderers
mx.charts.series
mx.charts.series.items
mx.charts.series.renderData
mx.charts.styles
mx.collections
mx.collections.errors
mx.containers
mx.containers.accordionClasses
mx.containers.dividedBoxClasses
mx.containers.errors
mx.containers.utilityClasses
mx.controls
mx.controls.advancedDataGridClasses
mx.controls.dataGridClasses
mx.controls.listClasses
mx.controls.menuClasses
mx.controls.olapDataGridClasses
mx.controls.scrollClasses
mx.controls.sliderClasses
mx.controls.textClasses
mx.controls.treeClasses
mx.controls.videoClasses
mx.core
mx.core.windowClasses
mx.data
mx.data.crypto
mx.data.errors
mx.data.events
mx.data.messages
mx.data.mxml
mx.data.offline.errors
mx.data.utils
mx.effects
mx.effects.easing
mx.effects.effectClasses
mx.events
mx.filters
mx.flash
mx.formatters
mx.geom
mx.graphics
mx.graphics.codec
mx.graphics.shaderClasses
mx.logging
mx.logging.errors
mx.logging.targets
mx.managers
mx.messaging
mx.messaging.channels
mx.messaging.config
mx.messaging.errors
mx.messaging.events
mx.messaging.management
mx.messaging.messages
mx.modules
mx.netmon
mx.olap
mx.olap.aggregators
mx.preloaders
mx.printing
mx.resources
mx.rpc
mx.rpc.events
mx.rpc.http
mx.rpc.http.mxml
mx.rpc.livecycle
mx.rpc.mxml
mx.rpc.remoting
mx.rpc.remoting.mxml
mx.rpc.soap
mx.rpc.soap.mxml
mx.rpc.wsdl
mx.rpc.xml
mx.skins
mx.skins.halo
mx.skins.spark
mx.skins.wireframe
mx.skins.wireframe.windowChrome
mx.states
mx.styles
mx.utils
mx.validators
org.osmf.containers
org.osmf.display
org.osmf.elements
org.osmf.events
org.osmf.layout
org.osmf.logging
org.osmf.media
org.osmf.metadata
org.osmf.net
org.osmf.net.dvr
org.osmf.net.httpstreaming
org.osmf.net.metrics
org.osmf.net.qos
org.osmf.net.rtmpstreaming
org.osmf.net.rules
org.osmf.traits
org.osmf.utils
spark.accessibility
spark.automation.delegates
spark.automation.delegates.components
spark.automation.delegates.components.gridClasses
spark.automation.delegates.components.mediaClasses
spark.automation.delegates.components.supportClasses
spark.automation.delegates.skins.spark
spark.automation.events
spark.collections
spark.components
spark.components.calendarClasses
spark.components.gridClasses
spark.components.mediaClasses
spark.components.supportClasses
spark.components.windowClasses
spark.core
spark.effects
spark.effects.animation
spark.effects.easing
spark.effects.interpolation
spark.effects.supportClasses
spark.events
spark.filters
spark.formatters
spark.formatters.supportClasses
spark.globalization
spark.globalization.supportClasses
spark.layouts
spark.layouts.supportClasses
spark.managers
spark.modules
spark.preloaders
spark.primitives
spark.primitives.supportClasses
spark.skins
spark.skins.mobile
spark.skins.mobile.supportClasses
spark.skins.spark
spark.skins.spark.mediaClasses.fullScreen
spark.skins.spark.mediaClasses.normal
spark.skins.spark.windowChrome
spark.skins.wireframe
spark.skins.wireframe.mediaClasses
spark.skins.wireframe.mediaClasses.fullScreen
spark.transitions
spark.utils
spark.validators
spark.validators.supportClasses
xd.core.axm.enterprise.view.components
xd.core.axm.enterprise.view.skins
xd.core.axm.view.components
xd.core.axm.view.components.support

語言元素

全域常數
全域函數
運算子
陳述式、關鍵字和指令
特殊類型

附錄

新增內容
編譯器錯誤
編譯器警告
執行階段錯誤
移轉至 ActionScript 3
支援的字元集
僅限 MXML 標籤
移動 XML 元素
Timed Text 標籤
不建議元素清單
AccessibilityImplementation 常數
如何使用 ActionScript 範例
法律聲明
套件flash.text.engine
類別public final class TextBlock
繼承TextBlock Inheritance Object

語言版本: ActionScript 3.0
執行階段版本: Flash Player 10, AIR 1.5, Flash Lite 4

TextBlock 類別是建立 TextLine 物件的 factory,您可以將這些物件放在顯示清單上來加以顯示。

TextBlock 類別的用途是要包含單一段落,因為 Unicode 雙向和斷行演算法一次只在一個段落上運作。撰寫多個文字段落的應用程式應該使用標記語言或文字分析,以便將文字分成若干段落,並為每一個段落建立一個 TextBlock。

TextBlock 物件會將它的內容儲存在 content 屬性中,後者為 ContentElement 類別的實體。由於您無法建立 ContentElement 類別的實體,請將 content 設為下列子類別之一的實體:TextElement、GraphicElement,或是 GroupElement。在純文字內容上使用 TextElement、在影像或圖像內容中使用 GraphicElement,並在包含了 TextElement、GraphicElement,與其它 GroupElement 物件組合的內容上使用 GroupElement。如需有關管理格式化連續文字、內嵌的連續子文字,以及圖像元素的詳細資訊,請參閱 ContentElement 類別與其子類別。

當您建立 TextBlock 實體並設定 content 屬性之後,請呼叫 createTextLine() 方法來建立文字行 (亦即 TextLine 類別的實體)。

檢視範例

相關 API 元素



公用屬性
 屬性定義自
  applyNonLinearFontScaling : Boolean
指定您想要犧牲「所見即所得」(WYSIWYG) 列印真實度來換取更好的螢幕顯示效果。
TextBlock
  baselineFontDescription : FontDescription
用來針對從區塊建立的所有行判斷其基線的字體 (與其內容無關)。
TextBlock
  baselineFontSize : Number
用來針對從區塊建立的所有行計算其基線的字體大小。
TextBlock
  baselineZero : String
指定針對從此區塊建立的字行而言,哪一條基線位於 y=0。
TextBlock
  bidiLevel : int
指定文字區塊的雙向段落內嵌層級。
TextBlock
 Inheritedconstructor : Object
類別物件的參照或是特定物件實體的建構函數。
Object
  content : ContentElement
保留文字區塊的內容。
TextBlock
  firstInvalidLine : flash.text.engine:TextLine
[唯讀] 識別在文字區塊中,TextLine.validity 不等於 TextLineValidity.VALID 的第一行。
TextBlock
  firstLine : flash.text.engine:TextLine
[唯讀] TextBlock 中的第一個 TextLine (如果有的話)。
TextBlock
  lastLine : flash.text.engine:TextLine
[唯讀] TextBlock 中的最後一個 TextLine (如果有的話)。
TextBlock
  lineRotation : String
將文字區塊中的文字行當成一個單位來旋轉。
TextBlock
  tabStops : Vector.<flash.text.engine:TabStop>
為文字區塊內的文字指定定位停駐點,其形式為 TabStop 物件的向量。
TextBlock
  textJustifier : flash.text.engine:TextJustifier
指定建立字行時要使用的 TextJustifier。
TextBlock
  textLineCreationResult : String
[唯讀] 指出 createTextLine() 作業的結果。
TextBlock
  userData : *
提供了讓應用程式將任意資料與文字區塊產生關聯的方法。
TextBlock
公用方法
 方法定義自
  
TextBlock(content:ContentElement = null, tabStops:Vector.<flash.text.engine:TabStop> = null, textJustifier:flash.text.engine:TextJustifier = null, lineRotation:String = "rotate0", baselineZero:String = "roman", bidiLevel:int = 0, applyNonLinearFontScaling:Boolean = true, baselineFontDescription:FontDescription = null, baselineFontSize:Number = 12.0)
建立 TextBlock 物件。
TextBlock
  
createTextLine(previousLine:flash.text.engine:TextLine = null, width:Number = 1000000, lineOffset:Number = 0.0, fitSomething:Boolean = false):flash.text.engine:TextLine
指示文字區塊從它的內容建立一行文字,從 previousLine 參數指定的點開始,並結束於 width 參數指定的點。
TextBlock
  
將 TextBlock 的基礎內容傾印為 XML 字串。
TextBlock
  
findNextAtomBoundary(afterCharIndex:int):int
從指定的字元索引尋找下一個 Atom 界限的索引,不包括指定索引上的字元。
TextBlock
  
findNextWordBoundary(afterCharIndex:int):int
從指定的字元索引尋找下一個單字界限的索引,不包括指定之索引上的字元。
TextBlock
  
尋找指定之字元索引的上一個 Atom 界限的索引,不包括指定之索引上的字元。
TextBlock
  
尋找指定之字元索引的上一個單字界限的索引,不包括指定之索引上的字元。
TextBlock
  
傳回 TextLine,其中包含 charIndex 參數所指定的字元。
TextBlock
 Inherited
指出物件是否有已定義的指定屬性。
Object
 Inherited
指出 Object 類別的實體是否位於指定為參數的物件原型鏈中。
Object
 Inherited
指出指定的屬性是否存在,以及是否可列舉。
Object
  
recreateTextLine(textLine:flash.text.engine:TextLine, previousLine:flash.text.engine:TextLine = null, width:Number = 1000000, lineOffset:Number = 0.0, fitSomething:Boolean = false):flash.text.engine:TextLine
指示文字區塊重複使用現有的文字行,以便從其內容建立一行文字,從 previousLine 參數指定的點開始,並結束於 width 參數指定的點。
TextBlock
  
指示文字區塊釋放所有與文字行建立有關聯的暫存資料。
TextBlock
  
從 TextBlock 所維護的字行清單中,移除一部分的文字行範圍。
TextBlock
 Inherited
為迴圈作業設定動態屬性的可用性。
Object
 Inherited
傳回代表此物件的字串,根據地區特定慣例進行格式化。
Object
 Inherited
會傳回指定之物件的字串形式。
Object
 Inherited
會傳回指定之物件的基本值。
Object
屬性詳細資訊

applyNonLinearFontScaling

屬性
applyNonLinearFontScaling:Boolean

語言版本: ActionScript 3.0
執行階段版本: Flash Player 10, AIR 1.5, Flash Lite 4

指定您想要犧牲「所見即所得」(WYSIWYG) 列印真實度來換取更好的螢幕顯示效果。在裝置字體顯示期間不支援子像素字符定位但支援非線性縮放的平台及字體上,將這個屬性設定為 true 時,雖然可讓您使用這些度量,但是會犧牲某些 WYSIWYG 列印真實度,特別是小的字級。透過選擇性縮放個別字符的寛度,隱藏像素貼齊對齊所造成的不美觀間隔,這就是非線性字體縮放的運作方式。

在支援子像素字符定位的平台上,會忽略這個旗標。

此旗標對內嵌字體顯示沒有作用

預設值是 true



實作
    public function get applyNonLinearFontScaling():Boolean
    public function set applyNonLinearFontScaling(value:Boolean):void

baselineFontDescription

屬性 
baselineFontDescription:FontDescription

語言版本: ActionScript 3.0
執行階段版本: Flash Player 10, AIR 1.5, Flash Lite 4

用來針對從區塊建立的所有行判斷其基線的字體 (與其內容無關)。基線取決於字體和字體大小。

預設值為 null。當基線字體為 null,就會忽略基線字體大小,而且任何指定行的基線都將以該行最大文字的字體和大小為準。當您同時指定 baselineFontDescriptionbaselineFontSize 時,就決定了文字區塊中所有行的基線 (與其內容無關)。這種組合在亞洲印刷樣式中特別好用。



實作
    public function get baselineFontDescription():FontDescription
    public function set baselineFontDescription(value:FontDescription):void

相關 API 元素

baselineFontSize

屬性 
baselineFontSize:Number

語言版本: ActionScript 3.0
執行階段版本: Flash Player 10, AIR 1.5, Flash Lite 4

用來針對從區塊建立的所有行計算其基線的字體大小。基線取決於字體和字體大小。

預設值為 12。當基線字體為 null,就會忽略基線字體大小,而且任何指定行的基線都將以該行最大文字的字體和大小為準。



實作
    public function get baselineFontSize():Number
    public function set baselineFontSize(value:Number):void

擲回值
ArgumentError — 指定的 baselineFontSize 小於 0。

相關 API 元素

baselineZero

屬性 
baselineZero:String

語言版本: ActionScript 3.0
執行階段版本: Flash Player 10, AIR 1.5, Flash Lite 4

指定針對從此區塊建立的字行而言,哪一條基線位於 y=0。此屬性的有效值可在 TextBaseline 類別的成員中找到。

預設值為 TextBaseline.ROMAN

若要設定此屬性,請使用下列字串值:

字串值說明
TextBaseline.ROMAN行的羅馬基線位於 y=0。
TextBaseline.ASCENT行的上緣基線位於 y=0。
TextBaseline.DESCENT行的下緣基線位於 y=0。
TextBaseline.IDEOGRAPHIC_TOP行的表意上基線位於 y=0。
TextBaseline.IDEOGRAPHIC_CENTER行的表意中央基線位於 y=0。
TextBaseline.IDEOGRAPHIC_BOTTOM行的表意下基線位於 y=0。



實作
    public function get baselineZero():String
    public function set baselineZero(value:String):void

擲回值
ArgumentError — 如果設為不屬於 TextBaseline 成員的任何一個值。

相關 API 元素

bidiLevel

屬性 
bidiLevel:int

語言版本: ActionScript 3.0
執行階段版本: Flash Player 10, AIR 1.5, Flash Lite 4

指定文字區塊的雙向「段落內嵌層級」。一般來說,使用 0 表示 LTR 段落 (英文、日文等),使用 1 則表示 RTL 段落 (阿拉伯文、希伯來文等)。0 或 1 以外的值已保留,以供特殊情況使用,請參閱 UAX#9「Unicode 雙向演算法」(http://www.unicode.org/reports/tr9/) 取得詳細資訊。

預設值為 0。

修改 bidiLevel 會將先前所有斷行的有效性變更為 TextLineValidity.INVALID。在變更 bidiLevel 之後,firstInvalidLine 屬性會等於 firstLine 屬性,而您必須針對 TextBlock 中的所有行重新斷行處理。



實作
    public function get bidiLevel():int
    public function set bidiLevel(value:int):void

擲回值
ArgumentError — 如果設定為小於 0 的值。

相關 API 元素


範例  ( 如何使用本範例 )
此範例顯示相同的文字字串 (依照邏輯順序:a、b、c、alef、bet、gimel) 中,帶有 bidiLevel 偶數的會先顯示,而帶有 bidiLevel 奇數的會接著顯示。
package {
    
    import flash.display.Sprite;
    import flash.text.engine.TextBlock;
    import flash.text.engine.TextElement;
    import flash.text.engine.TextLine;
    import flash.text.engine.ElementFormat;
    import flash.text.engine.FontDescription;
    
    public class TextBlock_bidiLevelExample extends Sprite {
        
        public function TextBlock_bidiLevelExample():void {             
            var fontSize:Number = 36;

            var format:ElementFormat = new ElementFormat();        
            format.fontDescription = new FontDescription("Adobe Hebrew");
            format.fontSize = fontSize;
            var y:Number = 0;
            var leading:Number = fontSize * 0.2;
            var text:String = "abc" + String.fromCharCode(0x05D0, 0x05D1, 0x05D2);

            var textBlock:TextBlock = new TextBlock();
            textBlock.content = new TextElement(text, format);
                        
            // bidiLevel even
            textBlock.bidiLevel = 0;
            var textLine = textBlock.createTextLine(null, 400);
            y += leading + textLine.ascent;
            textLine.y = y;
            y += textLine.descent;
            addChild(textLine);      
            
            // bidiLevel odd
            textBlock.content = new TextElement(text, format);
            textBlock.bidiLevel = 1;
            textLine = textBlock.createTextLine(null, 400);
            y += leading + textLine.ascent;          
            textLine.y = y;
            addChild(textLine);   
        }
    }
}

content

屬性 
content:ContentElement

語言版本: ActionScript 3.0
執行階段版本: Flash Player 10, AIR 1.5, Flash Lite 4

保留文字區塊的內容。由於 ContentElement 是一個基底類別,因此請為 content 指定一個 ContentElement 子類別的實體:TextElement、GraphicElement,或是 GroupElement。TextElement 物件內含 String、GraphicElement 物件內含 DisplayObject,而 GroupElement 則內含 Vector 物件 (此物件又內含了一或多個 TextElement、GraphicElement,或是其它 GroupElement 物件)。針對一段同質性文字使用 TextElement、針對圖像使用 GraphicElement,並針對文字與圖像元素的組合,或是這些元素的多個實體 (以及其它 GroupElement 物件) 使用 GroupElement。

預設值為 null

修改 content 屬性會將先前建立的所有行的有效性變更為 TextLineValidity.INVALID。在變更 content 之後,firstInvalidLine 屬性會等於 firstLine 屬性,而您必須針對 TextBlock 中的所有行重新斷行處理。



實作
    public function get content():ContentElement
    public function set content(value:ContentElement):void

擲回值
ArgumentError — 如果設為不屬於 ContentElement 的已知子類別的值。
 
ArgumentError — 指定的 value 已經是群組成員之一。

相關 API 元素

firstInvalidLine

屬性 
firstInvalidLine:flash.text.engine:TextLine  [唯讀]

語言版本: ActionScript 3.0
執行階段版本: Flash Player 10, AIR 1.5, Flash Lite 4

識別在文字區塊中,TextLine.validity 不等於 TextLineValidity.VALID 的第一行。

預設值為 null



實作
    public function get firstInvalidLine():flash.text.engine:TextLine

相關 API 元素

firstLine

屬性 
firstLine:flash.text.engine:TextLine  [唯讀]

語言版本: ActionScript 3.0
執行階段版本: Flash Player 10, AIR 1.5, Flash Lite 4

TextBlock 中的第一個 TextLine (如果有的話)。

預設值為 null



實作
    public function get firstLine():flash.text.engine:TextLine

相關 API 元素

lastLine

屬性 
lastLine:flash.text.engine:TextLine  [唯讀]

語言版本: ActionScript 3.0
執行階段版本: Flash Player 10, AIR 1.5, Flash Lite 4

TextBlock 中的最後一個 TextLine (如果有的話)。

預設值為 null



實作
    public function get lastLine():flash.text.engine:TextLine

相關 API 元素

lineRotation

屬性 
lineRotation:String

語言版本: ActionScript 3.0
執行階段版本: Flash Player 10, AIR 1.5, Flash Lite 4

將文字區塊中的文字行當成一個單位來旋轉。先呼叫 createTextLine() 方法,再設定 lineRotation 以使其生效。預設值為 TextRotation.ROTATE_0

任何字符的最後旋轉都需仰賴 ElementFormat.textRotationContentElement.textRotationTextBlock.lineRotation 的值。

TextBlock.lineRotation 通常用於亞洲文字。若要建立垂直日文文字的段落,請執行下列動作:

  1. TextBlock.lineRotation 屬性設定為 TextRotation.ROTATE_90
  2. 將內容的 ElementFormat.textRotation 屬性保留為預設的 TextRotation.AUTO

使用以下常數 (在 TextRotation 類別中定義) 來設定此屬性的值:

字串值說明
TextRotation.ROTATE_0字行並未旋轉。
TextRotation.ROTATE_90字行以 90 度順時針方向旋轉。
TextRotation.ROTATE_180字行旋轉 180 度。
TextRotation.ROTATE_270字行以 270 度順時針方向旋轉。
TextRotation.AUTO不支援。



實作
    public function get lineRotation():String
    public function set lineRotation(value:String):void

擲回值
ArgumentError — 如果設為不屬於 TextRotation 成員的任何一個值。
 
ArgumentError — 如果設定為 TextRotation.AUTO

相關 API 元素


範例  ( 如何使用本範例 )
這個範例會在 TextBlock 中新增日文文字,並將 lineRotation() 屬性設為 TextRotation.ROTATE_90 以垂直顯示字行。
package {
    import flash.display.Sprite;
    import flash.text.engine.FontDescription;
    import flash.text.engine.TextBlock;
    import flash.text.engine.TextElement;
    import flash.text.engine.TextLine;
    import flash.text.engine.TextRotation;
    import flash.text.engine.ElementFormat;
    
    public class TextBlock_lineRotationExample extends Sprite {
        
        public function TextBlock_lineRotationExample():void {
            var Japanese:String = String.fromCharCode(
                0x5185, 0x95A3, 0x5E9C, 0x304C, 0x300C, 0x653F, 0x5E9C, 0x30A4,
                0x30F3, 0x30BF, 0x30FC, 0x30CD, 0x30C3, 0x30C8, 0x30C6, 0x30EC, 
                0x30D3, 0x300D, 0x306E, 0x52D5, 0x753B, 0x914D, 0x4FE1, 0x5411, 
                0x3051, 0x306B, 0x30A2, 0x30C9, 0x30D3, 0x30B7, 0x30B9, 0x30C6, 
                0x30E0, 0x30BA, 0x793E, 0x306E
            ) +
            "FMS 2" +
            String.fromCharCode(0x3092, 0x63A1, 0x7528, 0x3059, 0x308B, 0x3068, 
                0x767a, 0x8868, 0x3057, 0x307e, 0x3057, 0x305F, 0x3002);

            var fontDescription:FontDescription = new FontDescription("MS Mincho");
            var format:ElementFormat = new ElementFormat();
            format.fontSize = 15;
            format.fontDescription = fontDescription;
                        
            var textElement:TextElement = new TextElement(Japanese, format); 
            var textBlock:TextBlock = new TextBlock();
            textBlock.content = textElement;
            textBlock.lineRotation = TextRotation.ROTATE_90;

            var linePosition:Number = this.stage.stageWidth - 120;
            var previousLine:TextLine = null;
        
            while (true) {
                var textLine:TextLine = textBlock.createTextLine(
                    previousLine, 
                    300);
                if (textLine == null) 
                    break;
                textLine.y = 30;    
                textLine.x = linePosition;
                linePosition -= 24;
                addChild(textLine);                
                previousLine = textLine;
            }        
        }
    }
}

tabStops

屬性 
tabStops:Vector.<flash.text.engine:TabStop>

語言版本: ActionScript 3.0
執行階段版本: Flash Player 10, AIR 1.5, Flash Lite 4

為文字區塊內的文字指定定位停駐點,其形式為 TabStop 物件的向量。

預設值為 null,表示未指定任何定位停駐點。未指定定位色標 (或插入點超過最後一個指定的定位點),根據預設值,執行階段會建立半英吋的定位點。

設定 tabStops 屬性時,TextBlock 會複製 Vector 以供內部使用。修改原始 Vector 或其內容並不會影響 TextBlock。查詢 tabStops 屬性時,會傳回內部 Vector 的副本。同樣的,修改這個傳回的向量或其內容並不會影響 TextBlock。



實作
    public function get tabStops():Vector.<flash.text.engine:TabStop>
    public function set tabStops(value:Vector.<flash.text.engine:TabStop>):void

擲回值
ArgumentError — 指定的 tabStops 包含 null 元素。
 
ArgumentError — 指定的 tabStops 不是依照遞增位置來排序。

相關 API 元素

textJustifier

屬性 
textJustifier:flash.text.engine:TextJustifier

語言版本: ActionScript 3.0
執行階段版本: Flash Player 10, AIR 1.5, Flash Lite 4

指定建立字行時要使用的 TextJustifier。

預設值是預設的建構 TextJustifier 物件。

設定 textJustifier 屬性時,TextBlock 會複製物件以供內部使用。修改原始物件並不會影響 TextBlock。查詢 textJustifier 屬性時,會傳回內部物件的副本。同樣的,修改這個傳回的物件並不會影響 TextBlock。



實作
    public function get textJustifier():flash.text.engine:TextJustifier
    public function set textJustifier(value:flash.text.engine:TextJustifier):void

擲回值
ArgumentError — 如果設定為不屬於 TextJustifier 的已知子類別的值。

相關 API 元素

textLineCreationResult

屬性 
textLineCreationResult:String  [唯讀]

語言版本: ActionScript 3.0
執行階段版本: Flash Player 10, AIR 1.5, Flash Lite 4

指出 createTextLine() 作業的結果。變更區塊的內容會讓之前的斷行無效,並將這個屬性重設為 null

預設值為 null

此屬性的值可在 TextLineCreationResult 中找到。

字串值說明
TextLineCreationResult.SUCCESS該行已經成功斷行。
TextLineCreationResult.COMPLETE新建立的行剛好完美對齊已經從 POSSIBLY_INVALID 轉換至 VALID 的下列行,或者因為區塊內的所有文字都已經中斷所以未建立任何一行。
TextLineCreationResult.INSUFFICIENT_WIDTH未建立任何一行,因為沒有任何文字適合指定的寬度。



實作
    public function get textLineCreationResult():String

相關 API 元素

userData

屬性 
public var userData:*

語言版本: ActionScript 3.0
執行階段版本: Flash Player 10, AIR 1.5, Flash Lite 4

提供了讓應用程式將任意資料與文字區塊產生關聯的方法。資料可以是參考內容的相關資訊,如修訂日期或作者名稱,也可以是處理期間您使用的快取資料。

建構函式詳細資料

TextBlock

()建構函式
public function TextBlock(content:ContentElement = null, tabStops:Vector.<flash.text.engine:TabStop> = null, textJustifier:flash.text.engine:TextJustifier = null, lineRotation:String = "rotate0", baselineZero:String = "roman", bidiLevel:int = 0, applyNonLinearFontScaling:Boolean = true, baselineFontDescription:FontDescription = null, baselineFontSize:Number = 12.0)

語言版本: ActionScript 3.0
執行階段版本: Flash Player 10, AIR 1.5, Flash Lite 4

建立 TextBlock 物件。

參數
content:ContentElement (default = null) — 文字區塊的內容。
 
tabStops:Vector.<flash.text.engine:TabStop> (default = null) — 文字區塊內之文字的定位停駐點。
 
textJustifier:flash.text.engine:TextJustifier (default = null) — 在此區塊的建立字行期間所要使用的 TextJustifier 物件。如果未提供任何對齊,將會根據英文地區設定來建構預設的對齊。
 
lineRotation:String (default = "rotate0") — 套用至文字行的旋轉 (這些文字行是以單位的形式從文字區塊產生)。
 
baselineZero:String (default = "roman") — 指定對於區塊中的所有行而言,哪一條基線位於 y=0。
 
bidiLevel:int (default = 0) — 文字區塊內之文字的預設雙向內嵌層級。
 
applyNonLinearFontScaling:Boolean (default = true) — 指定您想要犧牲 WYSIWYG 列印真實度來換取更好的螢幕顯示效果。
 
baselineFontDescription:FontDescription (default = null) — 指定字體說明,區塊內所有行的行基線都是從此衍生。
 
baselineFontSize:Number (default = 12.0) — 指定要搭配 baselineFontDescription 一起使用的大小。如果 baselineFontDescriptionnull,就會忽略這個參數。

擲回值
ArgumentError — 指定的 content 不是 ContentElement 的已知子類別。
 
ArgumentError — 指定的 content 已經是群組成員之一。
 
ArgumentError — 指定的 lineRotation 不是 TextRotation 的成員。
 
ArgumentError — 指定的 baselineZero 不是 TextBaseline 的成員。
 
ArgumentError — 指定的 bidiLevel 小於 0。
 
ArgumentError — 指定的 tabStops 包含 null 元素。
 
ArgumentError — 指定的 tabStops 不是依照遞增位置來排序。
 
ArgumentError — 指定的 baselineFontSize 小於 0。

相關 API 元素

方法詳細資訊

createTextLine

()方法
public function createTextLine(previousLine:flash.text.engine:TextLine = null, width:Number = 1000000, lineOffset:Number = 0.0, fitSomething:Boolean = false):flash.text.engine:TextLine

語言版本: ActionScript 3.0
執行階段版本: Flash Player 10, AIR 1.5, Flash Lite 4

指示文字區塊從它的內容建立一行文字,從 previousLine 參數指定的點開始,並結束於 width 參數指定的點。此文字行是 TextLine 物件,而您可以將此物件加入顯示清單。

在已經斷行的某個文字區塊範圍內斷行,可能會變更斷行發生所在之行和區域外面的有效性。行的狀態可以從 VALID 變更為 INVALID 或 POSSIBLY_INVALID。如果新的斷行剛好完美對齊於狀態為 POSSIBLY_INVALID 的上一斷行,上一斷行及所有之後的 POSSIBLY_INVALID 行都將變回 VALID 的狀態。如果是值已經設定為不屬於 TextLineValidity 成員的字行,這些字行的有效性將無法變更為 VALID,但是可能會變更為 INVALID。對文字區塊做了任何變更之後,請檢查 firstInvalidLine 屬性,以查看應該在何處開始或繼續重新斷行。

您可以在文字中加入 Unicode Zero Width Space (ZWSP) 字元,藉以手動建立文字斷行。這對於某些語言特別有用 (如泰語),因為這類語言需要字典,才能正確斷行。Flash 執行階段不包含這類字典。

為降低對記憶體的工作負荷,當建立所有需要的文字行之後,除非希望文字行重複重新斷行 (例如,因為重新調整物件框),否則使用者應該呼叫 releaseLineCreationData() 方法允許文字區塊丟棄與斷行關聯的暫存資料。

參數

previousLine:flash.text.engine:TextLine (default = null) — 指定上一個斷行 (從此之後開始斷行)。第一行斷行時,可以為 null
 
width:Number (default = 1000000) — 指定該行的所需寬度 (以像素為單位)。實際的寬度可能比較小。
 
lineOffset:Number (default = 0.0) — 選擇性參數,可指定該行原點與定位停駐點原點之間的差異 (以像素為單位)。當行未對齊,但行的定位點需要對齊時,便可使用此方法。這個參數的預設值是 0.0
 
fitSomething:Boolean (default = false) — 選擇性參數,可指示 Flash Player 至少將一個字元放入文字行,不論指定的寬度為何 (即使寬度為零或負數,而這樣可能會導致例外的擲回)。

傳回值
flash.text.engine:TextLine — 如果文字區塊是空的,或是指定的寬度小於下一個元素的寬度,則為文字行或 null。若要區分這些案例,請檢查文字區塊的 textLineCreationResult 屬性。

擲回值
ArgumentError — 如果 previousLine 指定的 TextLine 是無效的。
 
ArgumentError — 如果 previousLine 指定的 TextLine 是由其他不同的 TextBlock 所擁有。
 
ArgumentError — 如果 width 小於零 (除非 fitSomething 為 true)。
 
ArgumentError — 如果 width 大於 TextLine.MAX_LINE_WIDTH
 
IllegalOperationError — 如果文字區塊內容中的一或多個元素具有 null ElementFormat

相關 API 元素


範例  ( 如何使用本範例 )

此範例會呼叫 createTextLine() 方法,在文字區塊中建立文字行。它藉由執行下列工作來完成這項任務:
  • 從 String 建立 TextElement,並提供 20 的字體大小
  • 建立 TextBlock 並為它指定 TextElement
  • 呼叫 createTextLine() 以便從文字區塊建立 300 像素寬的字行
  • 將每一行放在 Stage (addChild()) 上,並設定它的位置 (xy)
package {
    import flash.display.Sprite;
    import flash.text.engine.TextBlock;
    import flash.text.engine.TextElement;
    import flash.text.engine.TextLine;
    import flash.text.engine.ElementFormat;
    import flash.text.engine.FontDescription;
    
    public class TextBlock_createTextLineExample extends Sprite {
        
        public function TextBlock_createTextLineExample():void {
            
            var str:String = "I am a TextElement, created from a String and assigned " +
            "to the content property of a TextBlock. The createTextLine() method " +
            "then created these lines, 300 pixels wide, for display." ;
            
            var fontDescription:FontDescription = new FontDescription("Arial");
            var format:ElementFormat = new ElementFormat(fontDescription);
            format.fontSize = 16;
            var textElement:TextElement = new TextElement(str, format); 
            var textBlock:TextBlock = new TextBlock();
            textBlock.content = textElement; 
            createLines(textBlock); 
        }
        
        private function createLines(textBlock:TextBlock):void 
        {            
            var lineWidth:Number = 300;
            var xPos:Number = 15.0;
            var yPos:Number = 20.0;
            
            var textLine:TextLine = textBlock.createTextLine (null, lineWidth);
            while (textLine)
            {
                textLine.x = xPos;
                textLine.y = yPos;
                yPos += textLine.height + 2;
                addChild (textLine);
                textLine = textBlock.createTextLine (textLine, lineWidth);
            }
        }
    }
}

dump

()方法 
public function dump():String

語言版本: ActionScript 3.0
執行階段版本: Flash Player 10, AIR 1.5

將 TextBlock 的基礎內容傾印為 XML 字串。在自動化測試中,這樣的處理非常有用,而且包括了文字、格式化和版面資訊。

以下說明該輸出:

	 >block<
	 	[0-N LINE]
	 >/block<
	 

對於每一行輸出的說明,請參閱 TextLine.dump() 方法。

注意:輸出的內容與格式未來可能有所變更。Adobe 不保證對此方法提供舊版相容。

傳回值
String

相關 API 元素

findNextAtomBoundary

()方法 
public function findNextAtomBoundary(afterCharIndex:int):int

語言版本: ActionScript 3.0
執行階段版本: Flash Player 10, AIR 1.5, Flash Lite 4

從指定的字元索引尋找下一個 Atom 界限的索引,不包括指定索引上的字元。Atom 界限之間的字元可以組合起來並在 TextLine 中形成一個 Atom,例如「e」與用來組合的重音符號。

參數

afterCharIndex:int — 指定要從中搜尋下一個 Atom 界限之字元索引。

傳回值
int — 指定字元索引中下一個 Atom 界限的索引。

擲回值
RangeError — 指定的 index 超出範圍。
 
IllegalOperationError — 索引字元所屬的 TextLine 無效。

相關 API 元素

findNextWordBoundary

()方法 
public function findNextWordBoundary(afterCharIndex:int):int

語言版本: ActionScript 3.0
執行階段版本: Flash Player 10, AIR 1.5, Flash Lite 4

從指定的字元索引尋找下一個單字界限的索引,不包括指定之索引上的字元。單字界限會依據字元的 Unicode 屬性來決定。

參數

afterCharIndex:int — 指定要從中搜尋下一個單字界限之字元的索引。

傳回值
int — 指定之字元索引中下一個單字界限的索引。

擲回值
RangeError — 指定的 index 超出範圍。
 
IllegalOperationError — 索引字元所屬的 TextLine 無效。

findPreviousAtomBoundary

()方法 
public function findPreviousAtomBoundary(beforeCharIndex:int):int

語言版本: ActionScript 3.0
執行階段版本: Flash Player 10, AIR 1.5, Flash Lite 4

尋找指定之字元索引的上一個 Atom 界限的索引,不包括指定之索引上的字元。Atom 界限之間的字元可以組合起來並在 TextLine 中形成一個 Atom,例如「e」與用來組合的重音符號。

參數

beforeCharIndex:int — 指定要從中搜尋上一個 Atom 界限之字元索引。

傳回值
int — 指定之字元索引的上一個 Atom 界限的索引。

擲回值
RangeError — 指定的 index 超出範圍。
 
IllegalOperationError — 索引字元所屬的 TextLine 無效。

相關 API 元素

findPreviousWordBoundary

()方法 
public function findPreviousWordBoundary(beforeCharIndex:int):int

語言版本: ActionScript 3.0
執行階段版本: Flash Player 10, AIR 1.5, Flash Lite 4

尋找指定之字元索引的上一個單字界限的索引,不包括指定之索引上的字元。單字界限會依據字元的 Unicode 屬性來決定。

參數

beforeCharIndex:int — 指定要從中搜尋上一個單字界限之字元的索引。

傳回值
int — 指定之字元索引的上一個單字界限的索引。

擲回值
RangeError — 指定的 index 超出範圍。
 
IllegalOperationError — 索引字元所屬的 TextLine 無效。

getTextLineAtCharIndex

()方法 
public function getTextLineAtCharIndex(charIndex:int):flash.text.engine:TextLine

語言版本: ActionScript 3.0
執行階段版本: Flash Player 10, AIR 1.5, Flash Lite 4

傳回 TextLine,其中包含 charIndex 參數所指定的字元。

參數

charIndex:int — 字元的索引值 (從零開始,例如,第一個字元是 0,第二個字元是 1,依此類推)。

傳回值
flash.text.engine:TextLine — 包含位於 charIndex 之字元的 TextLine。

擲回值
RangeError — 指定的字元索引超出範圍。

recreateTextLine

()方法 
public function recreateTextLine(textLine:flash.text.engine:TextLine, previousLine:flash.text.engine:TextLine = null, width:Number = 1000000, lineOffset:Number = 0.0, fitSomething:Boolean = false):flash.text.engine:TextLine

語言版本: ActionScript 3.0
執行階段版本: Flash Player 10.1, AIR 2, Flash Lite 4

指示文字區塊重複使用現有的文字行,以便從其內容建立一行文字,從 previousLine 參數指定的點開始,並結束於 width 參數指定的點。此文字行是 TextLine 物件,而您可以將此物件加入顯示清單。透過重複使用現有文字行,因為減少物件的建立,所以可以增強效能。

正要重新建立的 textLine 會從原本所在的文字區塊中釋放 (若有的話)。此外,所有的屬性 (包括自 DisplayObjectContainerInteractiveObjectDisplayObject 繼承的屬性) 都會重設為其預設值。最後,該行的所有子系都會移除,包括圖形元素及其他裝飾,以及該行的所有事件偵聽程式也都會移除。為了改善效能,此完整重設的唯一例外是不會從其父輩移除該行本身。

在已經斷行的某個文字區塊範圍內斷行,可能會變更斷行發生所在之行和區域外面的有效性。行的狀態可以從 VALID 變更為 INVALID 或 POSSIBLY_INVALID。如果新的斷行剛好完美對齊於狀態為 POSSIBLY_INVALID 的上一斷行,上一斷行及所有之後的 POSSIBLY_INVALID 行都將變回 VALID 的狀態。如果是值已經設定為不屬於 TextLineValidity 成員的字行,這些字行的有效性將無法變更為 VALID,但是可能會變更為 INVALID。對文字區塊做了任何變更之後,請檢查 firstInvalidLine 屬性,以查看應該在何處開始或繼續重新斷行。

您可以在文字中加入 Unicode Zero Width Space (ZWSP) 字元,藉以手動建立文字斷行。這對於某些語言特別有用 (如泰語),因為這類語言需要字典,才能正確斷行。Flash 執行階段不包含這類字典。

為降低對記憶體的工作負荷,當建立所有需要的文字行之後,除非希望文字行重複重新斷行 (例如,因為重新調整物件框),否則使用者應該呼叫 releaseLineCreationData() 方法允許文字區塊丟棄與斷行關聯的暫存資料。

參數

textLine:flash.text.engine:TextLine — 指定重複使用之前建立的 TextLine。
 
previousLine:flash.text.engine:TextLine (default = null) — 指定上一個斷行 (從此之後開始斷行)。第一行斷行時,可以為 null
 
width:Number (default = 1000000) — 指定該行的所需寬度 (以像素為單位)。實際的寬度可能比較小。
 
lineOffset:Number (default = 0.0) — 選擇性參數,可指定該行原點與定位停駐點原點之間的差異 (以像素為單位)。當行未對齊,但行的定位點需要對齊時,便可使用此方法。這個參數的預設值是 0.0
 
fitSomething:Boolean (default = false) — 選擇性參數,可指示 Flash Player 至少將一個字元放入文字行,不論指定的寬度為何 (即使寬度為零或負數,而這樣可能會導致例外的擲回)。

傳回值
flash.text.engine:TextLine — 如果文字區塊是空的,或是指定的寬度小於下一個元素的寬度,則為文字行或 null。若要區分這些案例,請檢查文字區塊的 textLineCreationResult 屬性。

擲回值
ArgumentError — 如果 textLine 是 null。
 
ArgumentError — 如果 previousLine 指定的 TextLine 是無效的。
 
ArgumentError — 如果 previousLine 指定的 TextLine 是由其他不同的 TextBlock 所擁有。
 
ArgumentError — 如果 previousLine 指定的 TextLine 同時也被其他 textLine 指定。
 
ArgumentError — 如果 width 小於零 (除非 fitSomething 為 true)。
 
ArgumentError — 如果 width 大於 TextLine.MAX_LINE_WIDTH
 
IllegalOperationError — 如果文字區塊內容中的一或多個元素具有 null ElementFormat

相關 API 元素


範例  ( 如何使用本範例 )

此範例會重複使用 TextLine 物件 textLine
var elementFormat:ElementFormat = new ElementFormat();
elementFormat.fontDescription = new FontDescription("Arial");
elementFormat.fontSize = 48;

var textElement:TextElement = new TextElement("Text you'll never see", elementFormat)
var textBlock:TextBlock = new TextBlock(textElement);
var textLine:TextLine = textBlock.createTextLine();
textLine.x = 50;
textLine.y = 50;
addChild(textLine);

// Reuse the element format to preserve the text formatting
var elementTwo:TextElement = new TextElement("Text you see", elementFormat);  
textBlock.content = elementTwo;
textBlock.recreateTextLine(textLine);

// Set the position (and any other display object properties like alpha, children, etc.)
// otherwise, they're all set to default properties.
textLine.x = 50;  
textLine.y = 50;

releaseLineCreationData

()方法 
public function releaseLineCreationData():void

語言版本: ActionScript 3.0
執行階段版本: Flash Player 10.1, AIR 2, Flash Lite 4

指示文字區塊釋放所有與文字行建立有關聯的暫存資料。為最小化應用程式佔用的記憶體,當您從文字區塊中完成文字行的建立後,您應該呼叫 releaseLineCreationData() 方法。但是,為最大化重新斷行 (例如當物件框重新調整大小時) 的效能,不應該呼叫 releaseLineCreationData() 方法。應用程式必須決定在記憶體與效能之間的平衡。

建立不計劃變動之文字的建議程序是:初始化文字區塊、根據需要隨時呼叫 createTextLine() 方法建立想要的輸出,然後呼叫 releaseLineCreationData() 方法。

相關 API 元素

releaseLines

()方法 
public function releaseLines(firstLine:flash.text.engine:TextLine, lastLine:flash.text.engine:TextLine):void

語言版本: ActionScript 3.0
執行階段版本: Flash Player 10, AIR 1.5, Flash Lite 4

從 TextBlock 所維護的字行清單中,移除一部分的文字行範圍。這麼做會在沒有其它參照存在的情況下,允許針對字行進行記憶體回收程序。

將移除行的 textBlocknextLine,和 previousLine 成員設為 null。將 TextBlock 中的移除行與跟在其後之所有行的 validity 設為 TextLineValidity.INVALID

參數

firstLine:flash.text.engine:TextLine — 指定要釋放的第一行。
 
lastLine:flash.text.engine:TextLine — 指定要釋放的最後一行。


擲回值
ArgumentError — 如果 firstLinelastLine 所指定的 TextLine 未列於文字區塊所維護的文字行清單中。

相關 API 元素

TextBlockExample.as

這個範例會顯示日文和英文文字的三個 TextBlock 段落。日文文字會轉換為 Unicode 字元碼的字串。當您按一下按鈕時,此範例會將文字從水平旋轉為垂直或從垂直旋轉為水平。
package { 
    import fl.controls.Button;
     import flash.text.engine.TextBlock;
    import flash.text.engine.TextLine;
    import flash.text.engine.TextElement;
    import flash.text.engine.ElementFormat;
    import flash.text.engine.TextRotation;
    import flash.text.engine.TextBaseline;
    import flash.text.engine.LineJustification;
    import flash.text.engine.FontDescription;
    import flash.text.engine.EastAsianJustifier; 
    import flash.display.Loader;
    import flash.display.Sprite;
    import flash.display.Stage;
    import flash.events.MouseEvent;
    import flash.system.Capabilities;
    
    public class TextBlockExample extends Sprite {
        
        var vertical:Boolean;    
        var container:Sprite;
        var textBlocks:Vector.<TextBlock>;
        var loader:Loader = new Loader();
        var directionButton:Button = new Button();
        
        public function TextBlockExample():void {
            addChild(directionButton);
            directionButton.width = 30;
            directionButton.move(50, 350);
            directionButton.addEventListener(MouseEvent.CLICK, clickHandler);
            createContent();
            createLines();
        }

        private function createEmptyBlock():TextBlock {
        
            var textBlock:TextBlock = new TextBlock();
            textBlock.baselineZero = TextBaseline.IDEOGRAPHIC_CENTER;
            textBlock.textJustifier = new EastAsianJustifier("ja", LineJustification.ALL_BUT_LAST);
            textBlock.lineRotation = vertical? TextRotation.ROTATE_90: TextRotation.ROTATE_0;
            return textBlock;    
        }
        
        private function paragraph1(format:ElementFormat):TextBlock {
        
            var textBlock:TextBlock = createEmptyBlock();
            textBlock.content = new TextElement(
            String.fromCharCode(
                0x5185, 0x95A3, 0x5E9C, 0x304C, 0x300C, 0x653F, 0x5E9C, 0x30A4,
                0x30F3, 0x30BF, 0x30FC, 0x30CD, 0x30C3, 0x30C8, 0x30C6, 0x30EC, 
                0x30D3, 0x300D, 0x306E, 0x52D5, 0x753B, 0x914D, 0x4FE1, 0x5411, 
                0x3051, 0x306B, 0x30A2, 0x30C9, 0x30D3, 0x30B7, 0x30B9, 0x30C6, 
                0x30E0, 0x30BA, 0x793E, 0x306E
            ) +
            "FMS 2" +
            String.fromCharCode(0x3092, 0x63A1, 0x7528, 0x3059, 0x308B, 0x3068, 
                0x767a, 0x8868, 0x3057, 0x307e, 0x3057, 0x305F, 0x3002), format);
            return textBlock;
        }

        private function paragraph2(format:ElementFormat):TextBlock {
            
            var textBlock:TextBlock = createEmptyBlock();
            textBlock.content = new TextElement(
            String.fromCharCode(
                0x30AF, 0x30ED, 0x30B9, 0x30D7, 0x30E9, 0x30C3, 0x30C8, 0x30D5, 
                0x30A9, 0x30FC, 0x30E0, 0x4E0A, 0x3067, 0x518D, 0x751F, 0x53EF, 
                0x80FD, 0x306A
            ) + 
            "Flash Video" +
            String.fromCharCode(
                0x3092, 0x914D, 0x4FE1, 0x3001, 0x653F, 0x5E9C, 0x6700, 0x65B0, 
                0x60C5, 0x5831, 0x3092, 0x3088, 0x308A, 0x591A, 0x304F, 0x306E, 
                0x56FD, 0x6C11, 0x306B, 0x9AD8, 0x54C1, 0x8CEA, 0x306A, 0x753B, 
                0x50CF, 0x3067, 0x7C21, 0x5358, 0x304B, 0x3064, 0x30EA, 0x30A2, 
                0x30EB, 0x30BF, 0x30A4, 0x30E0, 0x306B, 0x63D0, 0x4F9B, 0x3059, 
                0x308B, 0x3053, 0x3068, 0x304C, 0x53EF, 0x80FD, 0x306B, 0x306A, 
                0x308A, 0x307e, 0x3057, 0x305F, 0x3002), format);
            return textBlock;    
        }

        private function paragraph3(format:ElementFormat):TextBlock {
            
            var textBlock:TextBlock = createEmptyBlock();
            textBlock.content = new TextElement(
            String.fromCharCode(0x3010) +
            "2007" +
            String.fromCharCode(0x5E74) + "2" + String.fromCharCode(0x6708) +
            "21" +
            String.fromCharCode(0x65E5, 0x3011),
            format);
            return textBlock;    
        }

        private function createContent():void {
            
            var font:FontDescription = new FontDescription();
            if (Capabilities.os.search("Mac OS") > -1) 
                font.fontName = String.fromCharCode(0x5C0F, 0x585A, 0x660E, 0x671D) + " Pro R"; // "Kozuka Mincho Pro R"                    koFont.fontName = "Adobe " + String.fromCharCode(0xBA85, 0xC870) + " Std M"; // "Adobe Myungjo Std M"
            else 
                font.fontName = "Kozuka Mincho Pro R";        
            var format:ElementFormat = new ElementFormat();
            format.fontDescription = font;
            format.fontSize = 12;
            format.locale = "ja";
            format.color = 0x000000;
            if (!vertical) 
                format.textRotation = TextRotation.ROTATE_0; 
            textBlocks = new Vector.<TextBlock>();
            textBlocks.push(
                paragraph1(format),
                paragraph2(format),
                paragraph3(format)//,
            );
        }

        private function createLines():void {    
        
            if (container != null) {
                removeChild(container);
            }            
            container = new Sprite();
            container.y = 45;
            container.x = 40;
            addChild(container);
            var linePosition:Number = vertical? this.stage.stageWidth - 120: 12;
        
            for (var i:uint = 0; i < textBlocks.length; i++) {
                var textBlock:TextBlock = textBlocks[i];
                var previousLine:TextLine = null;
        
                while (true) {
                    var textLine:TextLine = textBlock.createTextLine(
                        previousLine, 
                        300);
                    if (textLine == null) 
                        break;
                    if (vertical) 
                    {
                        textLine.x = linePosition;
                        linePosition -= 24;
                        directionButton.label = " -- ";
                    }
                    else 
                    {
                        textLine.y = linePosition+50;
                        linePosition += 24;
                        directionButton.label = " | ";
                    }
                    container.addChild(textLine);                
                    previousLine = textLine;
                }
                if (vertical) 
                    linePosition -= 16;
                else 
                    linePosition += 16; 
            }
        }

        private function clickHandler(event:MouseEvent):void {
            
            vertical = !vertical;
            createContent();
            createLines();
        }
    }
}




[ X ]為什麼顯示英文?
「ActionScript 3.0 參考」的內容是以英文顯示

並非所有「ActionScript 3.0 參考」的內容都翻譯為所有語言。當語言元素未翻譯時,就會以英文顯示。例如,ga.controls.HelpBox 類別並沒有翻譯為任何語言。因此在參考的繁體中文版本中,ga.controls.HelpBox 類別就會以英文顯示。