Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/flash/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Actionscript 3 修改舞台上的TLF文本字段属性_Actionscript 3_Flash_Tlf - Fatal编程技术网

Actionscript 3 修改舞台上的TLF文本字段属性

Actionscript 3 修改舞台上的TLF文本字段属性,actionscript-3,flash,tlf,Actionscript 3,Flash,Tlf,我在舞台上有一个TLF文本字段。我试图在简单的flash文档中对此进行测试 我的代码接收一些我解析的xml。xml会有所不同,并且不会始终更改文本字段的所有属性。例如,在一种情况下,我只想改变字体的大小。在另一种情况下,我只想更改字体的对齐方式 我正在使用TLF文本字段,因为我们将翻译成阿拉伯语,我已经使用了从右到左的文本 以下是我需要在代码中编辑的一些属性: 字号 字体 对齐 领先的 粗体、斜体、下划线(重量) 任何编码帮助都会很好。我已经看到了一些关于文本流和文本布局的想法,但我显然没有

我在舞台上有一个TLF文本字段。我试图在简单的flash文档中对此进行测试

我的代码接收一些我解析的xml。xml会有所不同,并且不会始终更改文本字段的所有属性。例如,在一种情况下,我只想改变字体的大小。在另一种情况下,我只想更改字体的对齐方式

我正在使用TLF文本字段,因为我们将翻译成阿拉伯语,我已经使用了从右到左的文本

以下是我需要在代码中编辑的一些属性:

  • 字号
  • 字体
  • 对齐
  • 领先的
  • 粗体、斜体、下划线(重量)

任何编码帮助都会很好。我已经看到了一些关于文本流和文本布局的想法,但我显然没有正确地使用它,因为我无法让它工作。

很久以前,我放弃并停止使用TLF字段。我有一个项目,它请求动态加载项并从/到stage删除tlf文件。这是来自此项目的代码:

这将动态生成默认格式

        var config:Configuration    = new Configuration();
        var defTextFormat:  TextLayoutFormat = new TextLayoutFormat();
        defTextFormat.textAlign   = TextAlign.LEFT;
        defTextFormat.fontFamily  = m_strFontName;
        defTextFormat.fontSize    = m_nFontSize;
        defTextFormat.fontWeight  = FontWeight.BOLD
        defTextFormat.paddingLeft = 3;
        defTextFormat.paddingTop  = 3;
        defTextFormat.paragraphStartIndent = 3;
        defTextFormat.paragraphSpaceBefore = 3;

        config.defaultLinkActiveFormat  = defTextFormat;
        config.defaultLinkHoverFormat   = defTextFormat;
        config.defaultLinkNormalFormat  = defTextFormat;
        config.textFlowInitialFormat    = ITextLayoutFormat( defTextFormat );

        m_textFlow = new TextFlow( config );
成员m_textFlow持有对TLF字段的引用。 要添加和删除元素,请使用m_textFlow.addChild(p);其中p是段落元素 见:

要更改元素的字体大小和颜色,例如:

var _p:ParagraphElement = ParagraphElement( m_textFlow.getChildAt( iChild ) );
for ( var iParChild: uint = 0; iParChild < _p.numChildren; ++iParChild )
{
   _p.getChildAt( iParChild ).color = color;
       _p.getChildAt( iParChild ).fontSize = nRatio;
var\u p:ParagraphElement=ParagraphElement(m_textFlow.getChildAt(iChild));
对于(变量iParChild:uint=0;iParChild<\u p.numChildren;++iParChild)
{
_p、 getChildAt(iParChild).color=color;
_p、 getChildAt(iParChild).fontSize=nRatio;

也许这能帮你