AS3 共通のTextFormatを複数のクラスで用いてみる。
2009年07月15日(水)
共通のテキストフォーマットを複数のクラスで用いてみる。
なんかこれ絶対損してます。とりあえずはコレで!
staticを利用することにより
インスタンスをつくらず直接利用できるところがミソです。
定数をいろいろ定義するファイルとしてクラスを利用するという概念も
あるのですね。
package {
import flash.text.TextFormat;
import flash.text.TextFormatAlign;
public class TextStyle {
static var chart_textformat:TextFormat=new TextFormat();
chart_textformat.font="_sans";
chart_textformat.size=20;
chart_textformat.color=0x555555;
chart_textformat.align=TextFormatAlign.CENTER;
}
}
これが利用するクラス
package {
import TextStyle;
public class SampleClass {
var chart_textformat=TextStyle.chart_textformat;
}
}
関連記事
- AS3 共通のTextFormatを複数のクラスで用いてみる。
- AS3 TextFormatを外部クラスにしてみましたが
- AS3 TextFormatでfontを変更して適用した
- AS3 リンゲージしたmcをリンゲージ名で配置
- AS3 TweenerのsetTimeScaleを試すつもりが
- AS3 円運動のクラス
- AS3 県の定義クラス PrefList
- AS3 fl.transitions
- AS3 TextFormat setTextFormatの種明かし編
- !important
- AS3 EventをDispatchする。
- AS3 クラスの参照
- AS3 Flash IDEを判別 System.capabilities.playerTypeで
- AS3 TextFieldのプロパティ
- syntaxhighlighterでのbrush call種類