ar secondRect:Rectangle = new Rectangle(1, 3, 11, 13);
以上代码为什么会报错,说Rectangle参数不能超过二个。为什么呢?望高手说说吧
var secondRect:Rectangle = new Rectangle(1, 3, 11, 13); 不会报错,你看看脚本是2.0还是3.0的
package {
import flash.display.Sprite;
import flash.geom.Rectangle;
public class RectangleExample extends Sprite {
public function RectangleExample() {
var firstRect:Rectangle = new Rectangle();
trace(firstRect); // (x=0, y=0, w=0, h=0)
var secondRect:Rectangle = new Rectangle(1, 3, 11, 13);
trace(secondRect); // (x=1, y=3, w=11, h=13)
var thirdRect:Rectangle = new Rectangle(5, 8, 17, 19);
trace(thirdRect); // (x=5, y=8, w=17, h=19)
var isContained:Boolean = secondRect.containsRect(thirdRect);
trace(isContained); // false
}
}
}
时间: 2024-09-27 08:40:30