How to add a new Stage to my default Stage?
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 = ne开发者_开发百科w 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);
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 access stage
from the newly loaded SWF or its children, you will still get the same stage
object.
精彩评论