Discusión: Navegación
Ver post
Old 13-Sep-2006, 01:39 PM   #2
Goten
Super Activo
Avatar de Goten
Registrado: May-2006
Location: BlastedLands
Posts: 311
crea cuatro leyers

en el primero pones el codigo AS

en el segundo creas un mc del tamaño de la ventana que quieres que sea la visualizacion del mapa le pones como hitMC

en el 3ro pones una mascara del mismo tamaño del del mc de visualizacion le pones mascara

el 4to pones el mapa o una foto que sea mas grade que la visualizacion.... le pones backgroundScene y listo

acuerdate que el 3ro es una mascara que cubre al 4to

saludos quicharts



Quote:
import mx.utils.Delegate;
//Create an object that will be used as the mouse listener
this.mouseListener = new Object();
//on Event (onMouseMove) trigger the function trackMouse and assign it to this - in this case this is _root
//Delegate class - http://livedocs.macromedia.com/flash.../00003430.html
this.mouseListener.onMouseMove = Delegate.create(this, trackMouse);
//Add a listener to the mouse and assign it to the created object
Mouse.addListener(this.mouseListener);
// setup the size and position of the hitMc
hitMc._width = mascara._width;
hitMC._height = mascara._height;
hitMc._x = mascara._x;
hitMc._y = mascara._y;
//Setup the stage height and width
stageW = mascara._width;
stageH = mascara._height;
//Function called when the mouse is moved
function trackMouse() {
if (hitMc.hitTest(_root._xmouse, _root._ymouse, true)) {
//The percentages % where the mouse is on the stage
//where x=0 it is 0% and where x=Stage.width it is 100%
this.xmousePer = this._xmouse/stageW;
this.ymousePer = this._ymouse/stageH;
//new X and Y var for the background
//Also figuring out the offset of the backgroundScene to the stage width
this.bgX = this.xmousePer*-(this.backgroundScene._width-stageW);
this.bgY = this.ymousePer*-(this.backgroundScene._height-stageH);
//Assign the new x and y to the background
this.backgroundScene._x = this.bgX;
this.backgroundScene._y = this.bgY;
//Update after the mouse move
}
updateAfterEvent();
}

}
Goten is offline   Citar y responder