consider the code below:
package
{
import flash.display.Sprite;
import flash.display.BitmapData;
import flash.display.Bitmap;
import flash.events.Event;
public class SampleBitmap extends Sprite
{
public function SampleBitmap() {
//生成两个BitmapData对象dataA, dataB
//dataA是100×100的深绿色矩形
var dataA:BitmapData = new BitmapData(100,100,true, 0xff669900);
//dataB是100×100的橙黄色矩形
var dataB:BitmapData = new BitmapData(100,100,true, 0xffFF9900);
//分别生成三个位图显示对象
var bitmapA:Bitmap = new Bitmap(dataA);
var bitmapB:Bitmap = new Bitmap(dataB);
var bitmapC:Bitmap = new Bitmap(dataB.clone()); //将dataB复制了一份
bitmapA.bitmapData = dataB;
//bitmapA:将dataB替换了dataA,此时bitmapA和bitmapB持有的都是dataB
bitmapB.x = 200;
bitmapC.x = 400;
bitmapA.x = 500;
bitmapA.y = 500;
//加入显示列表
addChild(bitmapA);
addChild(bitmapB);
addChild(bitmapC);
trace(stage.width);
//改变dataB的像素信息,把它中心20×20的像素都改成了红色
for (var i:int = 40; i<60; i++) {
for (var j:int = 40; j<60; j++) {
dataB.setPixel(i,j,0xFF0000);
}
}
trace(this.width); //the output is 600
trace(this.height);//the output is 600
this.graphics.beginFill(0x00ff00);
this.graphics.drawRect(0,0,this.width,this.height); //trace了一下,this.width,this.height都为600px
this.graphics.endFill();
}
}
}
the result is:

and: my question is: why the green don’t cover all the three yellow rect??
Problem lies in this line :
Here, this actually refers to the container (instance of SampleBitmap Class) whose width is determined by the three boxes you added into it.
What you were perhaps looking for (assuming you wished cover full stage) was :
EDIT
Just compiled your code and your claim :
is false as the output is 400 & 600