hi
im trying to modify a .fla flife that i found
and it consist in move the background based on the mouse movement
this sample i got is only moving at _x position (horizontal)
and i want to make it only for _y (vertical)
i try to modify the script but im not so good on that
can anyone help me modifing it?
here it is:
//This is a fullscreen demo. Minor changes will need to be made if using the code in an embedded swf with confines < the stage
fscommand("fullscreen", "true");
Stage.scaleMode = "noScale";
//Center the stage elements
var myListener:Object = new Object();
myListener.onResize = function() {
updateLocations();
};
Stage.addListener(myListener);
updateLocations = function () {
// Values of the initial .swf width and height
initialWidth = 800;
initialHeight = 450;
// Get the current stage width and height
currentWidth = Stage.width;
currentHeight = Stage.height;
// Get the content width
contentWidth = contentClip._width;
// Position content vertically
contentClip._y = Math.round((initialHeight/2)-(contentClip._height/2));
// Center the content if the content width is less than currentWidth
if (contentClip._width<currentWidth) {
newX = Math.round(initialWidth/2-contentClip._width/2);
} else {
positionContent();
newX = Math.round(initialWidth/2-contentClip._width/2);
}
};
updateLocations();
//Number of buffer pixels to add on each side of the content
buffer = 0;
//Scroll the content relative to the mouse
this.onMouseMove = function() {
//Only fire if mouse is over the content area
if ((this._xmouse>Math.floor((initialWidth-currentWidth)/2)) && (this._xmouse<Math.floor(initialWidth+2*((currentWidth-initialWidth)/2))) && (this._ymouse>contentClip._y) && (this._ymouse<(contentClip._y+contentClip._height))) {
//Make sure the content width is larger than the currentWidth
if (contentClip._width>currentWidth) {
positionContent();
}
}
};
positionContent = function () {
// Percent of mouse position on content
mousePercent = (this._xmouse+(currentWidth-initialWidth)/2)/currentWidth;
// Total available movement of the content minus screen width
availMovement = contentClip._width-currentWidth+buffer*2;
newX = Math.floor(-mousePercent*availMovement)-(currentWidth-initialWidth)/2+(buffer*2)/2;
};
//Set the initial position to the left side of the screen if content width is more than currentWidth, else center the content
if (contentClip._width>currentWidth) {
newX = Math.floor((initialWidth-currentWidth)/2)+buffer;
} else {
//Center the content
newX = Math.floor(initialWidth/2-contentClip._width/2);
}
//The following 2 functions can be rewritten to utilize the Braingiants Bounce function for improved recycling (it is presented as is for clarity of the actual movement)
holder = contentClip._x;
easeContent = function () {
// Don't fire if the destination position is met
if (newX<>contentClip._x) {
destx = newX;
posx = holder;
velx = (destx-posx)/4;
holder += velx;
contentClip._x = Math.round(holder);
}
};
contentClip.onEnterFrame = function() {
easeContent();
};
updateLocations();
stop();
i let the fla attached
thanks