2011-04-18 1 views
0

graphics.lineTo(xx、yy);を使用して私のプログラムでいくつかの線を描画しています。グラフィックスから作成されたオブジェクトにどのように奥行きを与えることができますか?

プログラムには、これらの線が描画される背景イメージがあります。 私が直面している問題は、画像が線を覆い隠し、線がユーザーに見えないことです。

これらの行にはIDがないため、どのように奥行きを割り当てることができないのですか?

ご意見やご提案がありますか?

答えて

0

あなたのコードは特に分かりませんが、私は方向性を指摘しようとします。

public class MyCustomComponent extends UIComponent 
{ 
    override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void 
    { 
     super.updateDisplayList(unscaledWidth, unscaledHeight); 
     // Your drawings here: graphics.lineTo(xx, yy); 
    } 
} 

だから今、あなたの図面が高い上になります:MyCustomComponentには、次のようなものです

<s:Group> 
    <s:BitmapImage /> 
    <MyCustomComponent /> 
</s:Group> 

:そのための最善の方法は、次のように特定のorgerを使用してアプリケーションにコンポーネントを配置することです画像よりもレベルが高い。

0

ます。たとえば、ちょうどにaddChild再び 表示リストの一番上に何かを持参する場合のzインデックスが表示リスト に設定されている

// this will place the BG on top of the myLinesSprite object 
var container:Sprite = new Sprite(); 
container.addChild(myLinesSprite); 
container.addChild(myBGimage); 

// now do another addchild 
var container:Sprite = new Sprite(); 
container.addChild(myLinesSprite); 
container.addChild(myBGimage); 
container.addChild(myLinesSprite); // updates displayList does not add twice 


// of course if you build it correctly the first time you wont have a worry 
var container:Sprite = new Sprite(); 
container.addChild(myBGimage); 
container.addChild(myLinesSprite); 
関連する問題