Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/actionscript-3/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/google-apps-script/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Actionscript 3 AC3将按钮置于显示堆栈的前面_Actionscript 3_Bitmap_Flash Cs6 - Fatal编程技术网

Actionscript 3 AC3将按钮置于显示堆栈的前面

Actionscript 3 AC3将按钮置于显示堆栈的前面,actionscript-3,bitmap,flash-cs6,Actionscript 3,Bitmap,Flash Cs6,我对ActionScript3非常陌生。我有感恩节假期,我想我会尝试用flash制作一个游戏 我的问题是,我有一个位图图像,它被动态添加到场景中,并且它覆盖了一个按钮。 我初始化并加载了图像,如下所示: var myBitmapDataObject:bedroomCellPhoneD = new bedroomCellPhoneD(100, 100); var myImage:Bitmap = new Bitmap(myBitmapDataObject); addChild(myImage);

我对ActionScript3非常陌生。我有感恩节假期,我想我会尝试用flash制作一个游戏

我的问题是,我有一个位图图像,它被动态添加到场景中,并且它覆盖了一个按钮。 我初始化并加载了图像,如下所示:

var myBitmapDataObject:bedroomCellPhoneD = new bedroomCellPhoneD(100, 100);
var myImage:Bitmap = new Bitmap(myBitmapDataObject);
addChild(myImage);
然后在这张图片加载几帧后,我在场景中有一个按钮,但是按钮被覆盖了。我怎么把按钮放在前面

使用addChildAt(index)而不是addChild来控制子对象在DisplayObjectContainer中的索引位置。
例如,在您的情况下,如果您的显示列表中没有其他内容,则只需图像和按钮即可:

var myBitmapDataObject:bedroomCellPhoneD = new bedroomCellPhoneD( 100, 100 );
var myImage:Bitmap = new Bitmap( myBitmapDataObject );
// add the image on the back
addChildAt( myImage, 0 );
或者,您可以在图像后重新添加按钮,使按钮位于前面:

var myBitmapDataObject:bedroomCellPhoneD = new bedroomCellPhoneD( 100, 100 );
var myImage:Bitmap = new Bitmap( myBitmapDataObject );
// add the image
addChild( myImage );
// re-add the button on top of the image
addChild( myButton );
我希望这能帮助您:)

使用addChildAt(index)而不是addChild来控制DisplayObjectContainer中子对象的索引位置。
例如,在您的情况下,如果您的显示列表中没有其他内容,则只需图像和按钮即可:

var myBitmapDataObject:bedroomCellPhoneD = new bedroomCellPhoneD( 100, 100 );
var myImage:Bitmap = new Bitmap( myBitmapDataObject );
// add the image on the back
addChildAt( myImage, 0 );
或者,您可以在图像后重新添加按钮,使按钮位于前面:

var myBitmapDataObject:bedroomCellPhoneD = new bedroomCellPhoneD( 100, 100 );
var myImage:Bitmap = new Bitmap( myBitmapDataObject );
// add the image
addChild( myImage );
// re-add the button on top of the image
addChild( myButton );

我希望这能帮助你:)

非常感谢你!我用addChildAt(myImage,0)代替addChild(myImage),它工作得非常好!按钮在上面。谢谢你,我的好先生,非常感谢你!我用addChildAt(myImage,0)代替addChild(myImage),它工作得非常好!按钮在上面。谢谢你,我的好先生