パッケージflash.text.engine
クラスpublic final class GraphicElement
継承GraphicElement Inheritance ContentElement Inheritance Object

言語バージョン: ActionScript 3.0
ランタイムバージョン: Flash Player 10, AIR 1.5

GraphicElement クラスは、TextBlock または GroupElement オブジェクトのグラフィックエレメントを表します。GraphicElement オブジェクトを TextBlock オブジェクトの content プロパティに割り当てて、TextBlock.createTextLine() を使用して、グラフィックまたはイメージを表示するか、GroupElement オブジェクトに割り当てて、他のグラフィックエレメントまたはテキストエレメントと結合します。

例を表示

関連項目

ContentElement
GroupElement
TextBlock


パブリックプロパティ
 プロパティ定義元
 Inheritedconstructor : Object
指定されたオブジェクトインスタンスのクラスオブジェクトまたはコンストラクタ関数への参照です。
Object
 InheritedelementFormat : ElementFormat
エレメントに使用される ElementFormat オブジェクトです。
ContentElement
  elementHeight : Number
その行でグラフィックのために予約された高さです(ピクセル単位)。
GraphicElement
  elementWidth : Number
その行でグラフィックのために予約された幅です(ピクセル単位)。
GraphicElement
 InheritedeventMirror : EventDispatcher
このコンテンツエレメントに基づいた有効なテキスト行に送出されるすべてのイベントのコピーを受け取る EventDispatcher オブジェクトです。
ContentElement
  graphic : DisplayObject
GraphicElement のグラフィックとして使用される DisplayObject です。
GraphicElement
 InheritedgroupElement : GroupElement
[読み取り専用] このエレメントを含む GroupElement オブジェクトです。グループ内に存在しない場合は null になります。
ContentElement
 Inheritedprototype : Object
[静的] クラスまたは関数オブジェクトのプロトタイプオブジェクトへの参照です。
Object
 InheritedrawText : String
[読み取り専用] U+FDEF 文字を含む、エレメント内のテキストのコピーです。
ContentElement
 Inheritedtext : String
[読み取り専用] String 内でグラフィックエレメントを表す U+FDEF 文字を含まない、エレメント内のテキストのコピーです。
ContentElement
 InheritedtextBlock : TextBlock
[読み取り専用] このエレメントが含まれる TextBlock です。
ContentElement
 InheritedtextBlockBeginIndex : int
[読み取り専用] このエレメントの最初の文字のテキストブロック内のインデックスです。
ContentElement
 InheritedtextRotation : String
エレメントを単位として適用される回転です。
ContentElement
 InheriteduserData : *
作成者が任意のデータをエレメントに関連付けるための方法を提供します。
ContentElement
パブリックメソッド
 メソッド定義元
  
GraphicElement(graphic:DisplayObject = null, elementWidth:Number = 15.0, elementHeight:Number = 15.0, elementFormat:ElementFormat = null, eventMirror:EventDispatcher = null, textRotation:String = "rotate0")
新しい GraphicElement インスタンスを作成します。
GraphicElement
 Inherited
オブジェクトに指定されたプロパティが定義されているかどうかを示します。
Object
 Inherited
Object クラスのインスタンスが、パラメータとして指定されたオブジェクトのプロトタイプチェーン内にあるかどうかを示します。
Object
 Inherited
指定されたプロパティが存在し、列挙できるかどうかを示します。
Object
 Inherited
ループ処理に対するダイナミックプロパティの可用性を設定します。
Object
 Inherited
指定されたオブジェクトのストリング表現を返します。
Object
 Inherited
指定されたオブジェクトのプリミティブな値を返します。
Object
パブリック定数
 定数定義元
 InheritedGRAPHIC_ELEMENT : uint = 0xFDEF
[静的] テキスト内にグラフィックエレメントが存在するかどうかを示します。
ContentElement
プロパティの詳細
elementHeightプロパティ
elementHeight:Number

言語バージョン: ActionScript 3.0
ランタイムバージョン: Flash Player 10, AIR 1.5

その行でグラフィックのために予約された高さです(ピクセル単位)。グラフィックの拡大 / 縮小は、呼び出し元が受け持つことになります。

デフォルト値は 15.0 です。



実装
    public function get elementHeight():Number
    public function set elementHeight(value:Number):void
elementWidthプロパティ 
elementWidth:Number

言語バージョン: ActionScript 3.0
ランタイムバージョン: Flash Player 10, AIR 1.5

その行でグラフィックのために予約された幅です(ピクセル単位)。グラフィックの拡大 / 縮小は、呼び出し元が受け持つことになります。

デフォルト値は 15.0 です。



実装
    public function get elementWidth():Number
    public function set elementWidth(value:Number):void
graphicプロパティ 
graphic:DisplayObject

言語バージョン: ActionScript 3.0
ランタイムバージョン: Flash Player 10, AIR 1.5

GraphicElement のグラフィックとして使用される DisplayObject です。

デフォルト値は null です。

GraphicElement がテキスト行の一部になる場合、グラフィックは行の子として追加されます。グラフィックを設定すると、行から古いグラフィックが削除され、新しいグラフィックが追加されます。



実装
    public function get graphic():DisplayObject
    public function set graphic(value:DisplayObject):void
コンストラクタの詳細
GraphicElement()コンストラクタ
public function GraphicElement(graphic:DisplayObject = null, elementWidth:Number = 15.0, elementHeight:Number = 15.0, elementFormat:ElementFormat = null, eventMirror:EventDispatcher = null, textRotation:String = "rotate0")

言語バージョン: ActionScript 3.0
ランタイムバージョン: Flash Player 10, AIR 1.5

新しい GraphicElement インスタンスを作成します。

グラフィックの基準点は、elementHeightelementWidth および elementFormat.baselineShift によって定義される領域の左上隅に整列します。領域のサイズに合わせたグラフィックの拡大 / 縮小は行われません。 GraphicElement に eventMirror がある場合は、グラフィックによってではなく、elementWidth プロパティと elementHeight プロパティによって、結果のミラー領域のサイズと位置が決定されます。ローダを使用している場合は、テキスト行とミラー領域の作成時にグラフィックが読み込まれないことがあります。

パラメータ
graphic:DisplayObject (default = null) — GraphicElement を設定する DisplayObject です。デフォルト値は null です。
 
elementWidth:Number (default = 15.0) — エレメントに予約された領域の幅です(ピクセル単位)。デフォルト値は 15 です。
 
elementHeight:Number (default = 15.0) — エレメントに予約された領域の高さです(ピクセル単位)。デフォルト値は 15 です。
 
elementFormat:ElementFormat (default = null) — エレメントのエレメント形式です。デフォルト値は null です。
 
eventMirror:EventDispatcher (default = null) — このコンテンツエレメントに基づいて作成されたテキスト行に送出されるすべてのイベントのコピーを受け取る EventDispatcher オブジェクトです。デフォルト値は null です。
 
textRotation:String (default = "rotate0") — 単位としてエレメントに適用される回転です。このプロパティには、flash.text.engine.TextRotation 定数を使用します。デフォルト値は、flash.text.engine.TextRotation.ROTATE_0 です。

関連項目

例の使用法
GraphicElementExample.as

次の例では、GraphicElement(赤いボックス)を使用して TextBlock を作成して表示し、キャプションを含む 2 番目の TextBlock をその下に追加します。

package {

    import flash.display.Sprite;
    import flash.display.MovieClip;
    import flash.text.engine.TextBlock;
    import flash.text.engine.TextElement;
    import flash.text.engine.GraphicElement;
    import flash.text.engine.TextLine;
    import flash.text.engine.ElementFormat;
    import flash.text.engine.FontDescription;
    
    public class GraphicElementExample extends Sprite {
        
        public function GraphicElementExample():void {
            
            var format:ElementFormat = new ElementFormat();
            format.fontSize = 14;
            var redBox:MovieClip = new MovieClip();
            redBox.graphics.beginFill(0xCC0000, 1.0);
            redBox.graphics.drawRect(0,0, 200, 200);
            redBox.graphics.endFill();   
            var graphicElement:GraphicElement = new GraphicElement(redBox,redBox.width,redBox.height, format);
            var textBlock:TextBlock = new TextBlock();
            textBlock.content = graphicElement;
            var textLine1:TextLine = textBlock.createTextLine(null,redBox.width);
            addChild(textLine1);
            textLine1.x = 15
            textLine1.y = 215
            var str:String = "Your picture here ...";
            var textElement:TextElement = new TextElement(str, format);
            textBlock = new TextBlock();
            textBlock.content = textElement;
            var textLine2 = textBlock.createTextLine(null, 300);
            addChild(textLine2);
            textLine2.x = textLine1.x;
            textLine2.y += textLine1.y + format.fontSize;        
        }
    }    
}




 

 

このページに新しいコメントが追加された場合に、電子メールでの通知を希望する。 | コメントレポート

現在のページ: http://livedocs.adobe.com/flex/3_jp/langref/flash/text/engine/GraphicElement.html