TextArea字母的效果(Flex)

时间:2012-08-29 10:16:40

标签: actionscript-3 flex mxml

如何为组件TextArea(Spark 4)中的所有字母添加效果(阴影,光晕)?

5 个答案:

答案 0 :(得分:1)

我认为这是一个老问题,但是因为我今天遇到了同样的问题,所以我发布了我的解决方案。

您可以按照here "You can apply filters to any visual component that is derived from UIComponent"使用RichEditableText访问TextArea textDisplay组件:

  

RichEditableText可以作为textDisplay和Scroller访问   作为滚动条

RichEditableText已从UIComponent延长,因此可应用于filters({{3}})的UIComponents可应用于此。

为了将DropShadowFilter应用于组件myTextArea:TextArea中的所有字母,我使用了以下代码行:

var richTextComponent:UIComponent = myTextArea.textDisplay as UIComponent;
var shadow:spark.filters.DropShadowFilter = new spark.filters.DropShadowFilter;
richTextComponent.filters = [shadow];

希望这有助于某人: - )

答案 1 :(得分:0)

我认为你不能使用Flex(至少我从来没有)。你需要使用AS3

来做
<s:Label id="label1" text="Shadow Me" />

<fx:Script>
    <![CDATA[
    import flash.filters.*;

    private function creationComplete():void{
        var dropshadow:DropShadowFilter = new DropShadowFilter( 3,90,0x000000,.5,4,4,3,3 );
        this.label1.filters = [ dropshadow ];
    }
    ]]>
</fx:Script>

答案 2 :(得分:0)

contentBackgroundAlpha="0" borderVisible="false"

答案 3 :(得分:0)

通过使用Filter类,我们可以为s:TextArea组件应用阴影发光效果。示例代码为:

<s:TextArea contentBackgroundAlpha="0" borderAlpha="0">
        <s:filters>
              <s:DropShadowFilter distance="5" angle="45" color="#666666"/>
        </s:filters>
        <s:content>
              Testing text area content
        </s:content>
  </s:TextArea>

请参阅链接http://www.roseindia.net/tutorial/flex/flex4/components/filters.html以申请更多过滤器(DropShadowFilter,GlowFilter,BlurFilter和BevelFilter)。

答案 4 :(得分:0)

只需在TextArea组件中添加一个外观,然后在外观中为RichEditableText添加一个阴影。

<fx:Declarations>
    <s:DropShadowFilter id="shadow2"/>
</fx:Declarations>

<s:RichEditableText id="textDisplay" heightInLines="10" widthInChars="15"  filters="{[shadow2]}"/>

它对我有用,你只需调整阴影就可以看上去很好看。