运行此代码
var sp:Sprite = new Sprite();
sp.graphics.beginFill(0xff);
sp.graphics.drawRect(0,0,400,400);
sp.graphics.endFill();
sp.scrollRect = new Rectangle(0,0,350,350);
addChild(sp);
var count:int = 0;
var f:Function = function(...args):void{
trace(count++,sp.width,sp.height);
if(count>5){
removeEventListener(Event.ENTER_FRAME,f);
}
}
addEventListener(Event.ENTER_FRAME,f);
得到
0 400 400
1 350 350
2 350 350
3 350 350
4 350 350
5 350 350
无论如何我可以让scrollRect在第一帧工作吗?