as3.0 动态文本属性大全
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 | var my_fmt = new TextFormat(); //常用样式 my_fmt.align = "center" ; my_fmt.blockIndent = 50 ; //区块缩进 my_fmt.bold = true ; my_fmt.bullet = true ; my_fmt.color = 0xff0000 ; my_fmt.font = "黑体" ; my_fmt.indent = 50 ; //首字缩进 my_fmt.italic = true ; my_fmt.kerning = true ; //字距调整 my_fmt.leading = 2 ; //行距 my_fmt.letterSpacing = 10 ; //字间距 my_fmt.leftMargin = 10 ; my_fmt.rightMargin = 10 ; my_fmt.size = 20 ; my_fmt.underline = true ; my_fmt.target = "blank" 文本字段_详细属性: accessibilityProperties : AccessibilityProperties 此显示对象的当前辅助功能选项。 alpha : Number 指示指定对象的 Alpha 透明度值。 alwaysShowSelection : Boolean 如果设置为 true 且文本字段没有焦点,Flash Player 将以灰色突出显示文本字段中的所选内容。 antiAliasType : String 用于此文本字段的消除锯齿类型。 autoSize : String 控制文本字段的自动大小调整和对齐。 background : Boolean 指定文本字段是否具有背景填充。 backgroundColor : UInt 文本字段背景的颜色。 blendMode : String BlendMode 类中的一个值,用于指定要使用的混合模式。 border : Boolean 指定文本字段是否具有边框。 borderColor : UInt 文本字段边框的颜色。 bottomScrollV : int [read-only] 一个整数(从 1 开始的索引),指示指定文本字段中当前可以看到的最后一行。 cacheAsBitmap : Boolean 如果设置为 true ,则 Flash Player 将缓存显示对象的内部位图表示形式。 caretIndex : int [read-only] 插入点(尖号)位置的索引。 condenseWhite : Boolean 一个布尔值,它指定是否应删除具有 HTML 文本的文本字段中的额外空白(空格、换行符等)。 constructor : Object 对类对象或给定对象实例的构造函数的引用。 contextMenu : ContextMenu 指定与此对象相关联的上下文菜单。 defaultTextFormat : TextFormat 指定应用于新插入文本(例如,使用 replaceSelectedText() 方法插入的文本或用户输入的文本)的格式。 displayAsPassword : Boolean 指定文本字段是否是密码文本字段。 doubleClickEnabled : Boolean 指定此对象是否接收 doubleClick 事件。 embedFonts : Boolean 指定是否使用嵌入字体轮廓进行呈现。 filters : Array 包含当前与显示对象关联的每个滤镜对象的索引数组。 focusRect : Object 指定此对象是否显示焦点矩形。 gridFitType : String 用于此文本字段的网格固定类型。 height : Number 指示显示对象的高度,以像素为单位。 htmlText : String 包含文本字段内容的 HTML 表示形式。 length : int [read-only] 文本字段中的字符数。 loaderInfo : LoaderInfo [read-only] 返回一个 LoaderInfo 对象,其中包含加载此显示对象所属的文件的相关信息。 mask : DisplayObject 调用显示对象被指定的 mask 对象遮罩。 maxChars : int 文本字段中最多可包含的字符数(即用户输入的字符数)。 maxScrollH : int [read-only] scrollH 的最大值。 maxScrollV : int [read-only] scrollV 的最大值。 mouseEnabled : Boolean 指定此对象是否接收鼠标消息。 mouseWheelEnabled : Boolean 一个布尔值,指示当用户单击某个文本字段且用户滚动鼠标滚轮时,Flash Player 是否应自动滚动多行文本字段。 mouseX : Number [read-only] 指示鼠标位置的 x 坐标,以像素为单位。 mouseY : Number [read-only] 指示鼠标位置的 y 坐标,以像素为单位。 multiline : Boolean 指示文本字段是否为多行文本字段。 name : String 指示 DisplayObject 的实例名称。 numLines : int [read-only] 定义多行文本字段中的文本行数。 opaqueBackground : Object 指定显示对象是否由于具有某种背景颜色而不透明。 parent : DisplayObjectContainer [read-only] 指示包含此显示对象的 DisplayObjectContainer 对象。 prototype : Object [ static ] 对类或函数对象的原型对象的引用。 restrict : String 指示用户可输入到文本字段中的字符集。 root : DisplayObject [read-only] 对于加载的 SWF 文件中的显示对象,root 属性是此 SWF 文件所表示的显示列表树结构部分中的顶级显示对象。 rotation : Number 指示 DisplayObject 实例距其原始方向的旋转程度,以度为单位。 scale9Grid : Rectangle 当前有效的缩放网格。 scaleX : Number 指示从注册点开始应用的对象的水平缩放比例(百分比)。 scaleY : Number 指示从对象注册点开始应用的对象的垂直缩放比例(百分比)。 scrollH : int 当前水平滚动位置。 scrollRect : Rectangle 显示对象的滚动矩形范围。 scrollV : int 文本在文本字段中的垂直位置。 selectable : Boolean 一个布尔值,指示文本字段是否可选。 selectionBeginIndex : int [read-only] 当前所选内容中第一个字符从零开始的字符索引值。 selectionEndIndex : int [read-only] 当前所选内容中最后一个字符从零开始的字符索引值。 sharpness : Number 此文本字段中字型边缘的清晰度。 stage : Stage [read-only] 显示对象的舞台。 styleSheet : StyleSheet 将样式表附加到文本字段。 tabEnabled : Boolean 指定此对象是否遵循 Tab 键顺序。 tabIndex : int 指定 SWF 文件中的对象按 Tab 键顺序排列。 text : String 作为文本字段中当前文本的字符串。 textColor : UInt 文本字段中文本的颜色(采用十六进制格式)。 textHeight : Number [read-only] 文本的高度,以像素为单位。 textWidth : Number [read-only] 文本的宽度,以像素为单位。 thickness : Number 此文本字段中字型边缘的粗细。 transform : Transform 一个对象,具有与显示对象的矩阵、颜色转换和像素范围有关的属性。 type : String 文本字段的类型。 useRichTextClipboard : Boolean 指定在复制和粘贴文本时是否同时复制和粘贴其格式。 visible : Boolean 显示对象是否可见。 width : Number 指示显示对象的宽度,以像素为单位。 wordWrap : Boolean 一个布尔值,指示文本字段是否自动换行。 x : Number 指示 DisplayObject 实例相对于父级 DisplayObjectContainer 本地坐标的 x 坐标。 y : Number 指示 DisplayObject 实例相对于父级 DisplayObjectContainer 本地坐标的 y 坐标。 var my_txt = new TextField(); //常用属性 my_txt.defaultTextFormat = my_fmt; my_txt.type = TextFieldType.INPUT; my_txt.x = stage.stageWidth / 2 - 50 ; my_txt.y = stage.stageHeight / 2 - 50 ; my_txt.height = 300 ; my_txt.width = 300 ; my_txt.background = true ;my_txt.backgroundColor = 0xf5f5f5 ; my_txt.border = true ; my_txt.borderColor = 0x0000ff ; my_txt.autoSize = TextFieldAutoSize.LEFT; my_txt.displayAsPassword = true ; //密码 my_txt.multiline = true ; my_txt.wordWrap = true ; my_txt.scaleX = 0.5 ; my_txt.scaleY = 1.5 ; my_txt.selectable = true ; my_txt.textColor = 0x000000 ; my_txt.visible = true ; var a = new Object (); a.fontStyle = "italic" ; var style = new StyleSheet(); style.setStyle( ".a" ,a); my_txt.styleSheet = style; my_txt.htmlText = "<a href='http://baidu.com' class='a'>123</a> 123123123" //my_txt.text= "This is my first test field object text." ; import flash.filters.BlurFilter; var txt_blur = new BlurFilter( 0 , 0 , 0 ); my_txt.filters = [txt_blur];my_txt.alpha = 0.5 ; //动态文本透明度配合滤镜使用才有效TextFormat对象设置: |
【推荐】还在用 ECharts 开发大屏?试试这款永久免费的开源 BI 工具!
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步