2012-08-01 63 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