2012-08-01 65 views
1

我正在研究Adobe Flash/ActionScript 3中的迷你應用程序,其中我必須通過單擊一組按鈕來更改場景中某些對象的顏色。對於相同的對象,我必須設置一些模式(使用圖像)。如何將圖像設置爲flash/as3中影片剪輯的背景?

我可以處理顏色的變化,但我不知道如何把圖像作爲背景。

怎麼辦?

謝謝!

回答

3

您可以使用Graphics來繪製圖像。您可以使用Bitmap來顯示圖像。

// Display the image 
var bitmap:Bitmap = new Bitmap(myBitmapData); 

// Reference for later 
var background:DisplayObject = bitmap; 

現在您可以將此背景添加到您的對象。

// Add the background at the lowest depth level 
myObject.addChildAt(background, 0); 
+0

謝謝!我會嘗試使用這個和一些口罩.. – Michael 2012-08-01 15:11:52