如何将新舞台添加到我的默认舞台?
我想向默认舞台添加一个名为 field
的新舞台(稍后我需要在其上放置不同的元素)。然后我想将 myBitmap
添加到 field
中。但什么也没发生。我不明白我应该做什么。
var field:Stage = new Stage();
field.x = 200;
field.y = 200;
field.width = 300;
field.height = 300;
stage.addChild(field);
var bdWidth:Number = 100;
var bdHeight:Number = 100;
var bdTransparent:Boolean = true;
var bdFillColorARGB:uint = 0xFF007090;
var myBitmapData:BitmapData = new BitmapData(bdWidth, bdHeight, bdTransparent, bdFillColorARGB);
var myBitmap:Bitmap = new Bitmap(myBitmapData);
myBitmap.x = 10;
myBitmap.y = 10;
field.addChild(myBitmap);
I want to add a new Stage called field
to the default one (i need to place different elements on it later). And then I want to add myBitmap
to the field
. But nothing happens. I don't understand what should i do.
var field:Stage = new Stage();
field.x = 200;
field.y = 200;
field.width = 300;
field.height = 300;
stage.addChild(field);
var bdWidth:Number = 100;
var bdHeight:Number = 100;
var bdTransparent:Boolean = true;
var bdFillColorARGB:uint = 0xFF007090;
var myBitmapData:BitmapData = new BitmapData(bdWidth, bdHeight, bdTransparent, bdFillColorARGB);
var myBitmap:Bitmap = new Bitmap(myBitmapData);
myBitmap.x = 10;
myBitmap.y = 10;
field.addChild(myBitmap);
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
SWF 中不能有多个阶段。请改用
Sprite
。SWF 中唯一的
Stage
对象是由Flash 播放器自动创建的。即使您将另一个 SWF 加载到第一个 SWF 中并从新加载的 SWF 或其子项访问stage
,您仍然会获得相同的stage
对象。You cannot have multiple stages in an SWF. Use a
Sprite
instead.The unique
Stage
object in an SWF is created automatically by Flash player. Even if you load another SWF into the first SWF and accessstage
from the newly loaded SWF or its children, you will still get the samestage
object.