// get some initial variables from the stage. // The picture used for the pano scroll has to be a movie and named nav 1 var movieWidth:Number = stage.stageWidth; var movieHeight:Number = stage.stageHeight; var panoWidth:Number = nav1.width; var panoHeight:Number = nav1.height; // set of initial position nav1.x = 0; nav1.y = 0; addEventListener("enterFrame",frame_handler); function frame_handler(e:Event) { // get mouse position var mousex:Number = mouseX; var mousey:Number = mouseY; // center of movie var xspeed:Number = movieWidth/2; var yspeed:Number = movieHeight/2; // sets movement speed ( greater number, slower movement ) var c:Number = 75; // sets the dead center where nothing moves var center:Number = 50; // sets the dead rim where nothing moves var rim:Number = 20; // scrollspeed calculation var posx:Number = 0 - ((mousex - xspeed)/c); var posy:Number = 0 - ((mousey - yspeed)/c); // if the mouse is in the rim do nothing, only continue if it is inside if ( mousex > rim && mousex < movieWidth - rim && mousey > rim && mousey < movieHeight - rim ) { // movement in x direction if it is not in the center if ( ( mousex > xspeed + center ) || ( mousex < xspeed - center ) ) { // only move it to the end of the pano. Don't scroll further if ( nav1.x <= 0 && nav1.x >= (movieWidth - panoWidth)) { nav1.x += posx; // don't know if it is necessary. Just to be save. If the movement was to far set it back if ( nav1.x > 0 ) { nav1.x = 0; } else if ( nav1.x < (movieWidth - panoWidth) ) { nav1.x = movieWidth - panoWidth; } } } // movement in y direction if it is not in the center if ( ( mousey > yspeed + center ) || ( mousey < yspeed - center ) ) { // only move it to the end of the pano. Don't scroll further if ( nav1.y <= 0 && nav1.y >= (movieHeight - panoHeight)) { nav1.y += posy; // don't know if it is necessary. Just to be save. If the movement was to far set it back if ( nav1.y > 0 ) { nav1.y = 0; } else if ( nav1.y < (movieHeight - panoHeight) ) { nav1.y = movieHeight - panoHeight; } } } } }