RangeError:错误 #1125 索引超出范围
// MAIN BLIT CANVAS
var canvas:BitmapData = new BitmapData(1024, 768, false);
addChild(new Bitmap(canvas));
addChild(sl);
// PROPERTIES
var ind:int;
var offset:int;
var rect:Rectangle;
var zp:Point = new Point();
var destX:int = 0;
var currentX:int = 0;
// LOAD PHOTOS FROM LIBRARY
var photos:Vector.<BitmapData> = new Vector.<BitmapData>();
for(var i:int=1; i<5; i++)
{
var ref:Class = getDefinitionByName("p"+i) as Class;
photos.push(new ref());
}
// LOAD BITMAPDATA INTO MEMORY
for(i=0; i<4;i++)
canvas.copyPixels(photos[i], new Rectangle(0,0,1,1), zp);
// FIGURE OUT POSITION OF SLIDER AND CALL RENDER
stage.addEventListener(Event.ENTER_FRAME, function(e:Event):void {
destX = Math.ceil((sl.thumb.x/908) * 13312);
currentX += (destX - currentX) * 0.15;
render();
});
// RENDER PIXELS TO CANVAS
function render():void
{
ind = currentX / 1024;
offset = currentX % 1024;
rect = new Rectangle(offset, 0, 1024-offset, 768);
canvas.copyPixels(photos[ind], rect, zp);
if(currentX < 13312)
canvas.copyPixels(photos[ind+1], canvas.rect, new Point(1024-offset, 0));
}
//START DRAGGING SLIDER
sl.thumb.addEventListener(MouseEvent.MOUSE_DOWN, function(e:MouseEvent):void {
sl.thumb.startDrag(false, new Rectangle(0, 0, 909, 0));
});
//START DRAGGING SLIDER
stage.addEventListener(MouseEvent.MOUSE_UP, function(e:MouseEvent):void {
sl.thumb.stopDrag();
});
是什么导致错误?