コンポーネント TextArea (Spark 4) のすべての文字に効果 (影、光彩) を追加するにはどうすればよいですか?
5 に答える
古い質問だと思いますが、今日同じ問題に陥ったので、解決策を投稿しています。
ここに記載されているように、使用のRichEditableText
コンポーネントにアクセスできます。 TextArea
textDisplay
RichEditableText は textDisplay として、Scroller はスクローラーとしてアクセスできます。
RichEditableText
は から拡張されUIComponent
ているためfilters
、 に適用できますUIComponents
( 「UIComponent から派生した任意のビジュアル コンポーネントにフィルターを適用できます」 ) を適用できます。
たとえば、DropShadowFilter
コンポーネント内のすべての文字にa を適用するためにmyTextArea:TextArea
、次のコード行を使用しました。
var richTextComponent:UIComponent = myTextArea.textDisplay as UIComponent;
var shadow:spark.filters.DropShadowFilter = new spark.filters.DropShadowFilter;
richTextComponent.filters = [shadow];
これが誰かに役立つことを願っています:-)
TextArea コンポーネントにスキンを追加してから、スキン内の RichEditableText にシャドウを追加するだけです。
<fx:Declarations>
<s:DropShadowFilter id="shadow2"/>
</fx:Declarations>
<s:RichEditableText id="textDisplay" heightInLines="10" widthInChars="15" filters="{[shadow2]}"/>
それは私にとってはうまくいきました。影を調整して見栄えを良くするだけです。
Filter クラスを使用することで、as: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>
その他のフィルター (DropShadowFilter、GlowFilter、BlurFilter、および BevelFilter) を適用するには、リンクhttp://www.roseindia.net/tutorial/flex/flex4/components/filters.htmlを参照してください。
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>
contentBackgroundAlpha="0" borderVisible="false"