动作脚本3.如何设置背景

时间:2013-05-08 18:45:12

标签: actionscript-3 flash actionscript background background-image

我正在创建Flash游戏,这里是重启按钮,我有从舞台上删除所有对象(儿童)的功能。

function restartGame(e:MouseEvent):void
{
    while (numChildren > 0) {
        removeChildAt(0);
}
addChild(_cards);

//here I need to add background

    startMemoryGame();

}

正常我不需要添加背景,当游戏开始时它会自动添加。在库中它被称为background.jpg,我将它转换为图形,现在我命名它只是背景添加了链接“背景”,但addChild(background);对我不起作用。 你可以帮帮我吗?谢谢。

1 个答案:

答案 0 :(得分:0)

我假设你只是在图像上设置链接,在这种情况下去:

var background:Bitmap = new Bitmap(new Background);
addChild(background);

如果它是具有链接设置的MovieClip符号,则可以执行以下操作:

var background:Background = new Background;
addChild(background);
相关问题