Hello wonderful people,
I Have a project which displays 8 images as an aisle.
I need to zoom in and zoom out the images as 3D shelves. while zooming in, after a particular point the topmost image should go behind all the other… like a loop.
zooming in is ok, but the zooming out is a problem… i donno how to controle it… its an easy job for pple who knows actionscript well but not for me… ![]()
I used the tutorial “kirupa.com - Shape Movement vs. Camera Offset” to get the effect…
it is working fine for the up arrow, even i donno whats happening inside… but
when i press the down arrow all the 8 images are zooming out together.
Im attaching the file for your reference. as this is in a critical stage… please…please make it working…
Sorry, i cant attach the file… ill paste the code here.
objectsInScene = new Array();
var zConstant:Number = 800
var zValue:Number = 600
cameraView = new Object();
cameraView.x = 0;
cameraView.y = -100;
cameraView.z = 0;
cameraView.velocity = 0;
focalLength = 300;
///////////*************************************************
placeObjectIn3D = function(obj, x, y, z){
var scaleRatio = focalLength/(focalLength + z);
obj._x = x * scaleRatio;
obj._y = y * scaleRatio;
obj._xscale = obj._yscale = 100 * scaleRatio;
obj.swapDepths(Math.round(-z));
};
// TIRES
displayTire = function(clip){
var x = clip.x - cameraView.x;
var y = clip.y - cameraView.y;
var z = clip.z - cameraView.z;
if (z < 0){
clip.z += zConstant;
z = clip.z - cameraView.z;
}
placeObjectIn3D(clip, x, y, z);
};
// Asils
for (i=0; i<4; i++){
attachedObj = _mc.attachMovie(“symbol”, “tire”+i,i);
attachedObj.x = -150;
attachedObj.z = zValuei;
attachedObj.y = 0;
//attachedObj.display = displayTire;
objectsInScene.push(attachedObj);
attachedObj.onPress = function(){
trace(this._name)
}
}
ddrive()
function ddrive(){
for (var i = 0; i < objectsInScene.length; i++){
displayTire(objectsInScene);
}
}
drive = function(){
ddrive()
if (Key.isDown(Key.UP)) cameraView.velocity = 45;
else cameraView.velocity = 0;
if (Key.isDown(Key.DOWN)) cameraView.velocity = -25;
cameraView.z += cameraView.velocity;
for (var i = 0; i < objectsInScene.length; i++){
objectsInScene*.display();
}
};
//_mc is a moviclip in stage
_mc.onEnterFrame = drive;