stage.addEventListener(Event.ENTER_FRAME, cameraFollowCharacter);

function cameraFollowCharacter(evt:Event){
    root.scrollRect = new Rectangle(char.x - stage.stageWidth/2, char.y - stage.stageHeight/2, stage.stageWidth, stage.stageHeight);
}

Categories:

Leave a Reply