Hi,
I am pretty new to Flash, and I have started going through alot of this tutorials on this site, and it is really great btw. Anyhow, I was reading through the zoom in/out tutorial in the ActionScript > 3D in Flash tutorial, and I am having a little trouble figuring out where I should put the code, and actually see it work.
I did the following. I only made one figure so far, because I was just doing a test:
-
I draw a simple shape on the stage, converted it into a movie clip, and named it figureA
-
I then double clicked on it, and in the first frame, right clicked > Actions, and wrote the following code:
origin = new Object();
origin.x = 150;
origin.y = 150;
focalLength = 300;
figureA.x = -50;
figureA.y = 0;
figureA.z = 0;
figureA.dir = 1;
backAndForth = function(){
this.z += speed*this.dir;
if (this.z > 500){
this.z = 500;
this.dir = -1;
}else if (this.z < 0){
this.z = 0;
this.dir = 1;
}
var scaleRatio = focalLength/(focalLength + this.z);
this._x = origin.x + this.x * scaleRatio;
this._y = origin.y + this.y * scaleRatio;
this._xscale = this._yscale = 100 * scaleRatio;
this.swapDepths(-this.z);
};
figureA.onEnterFrame = backAndForth;
My question is what am I suppose to do next? Insert a keyframe and make a motion tween? I am kinda lost in the difference between actionscript motion or using motion tween. Any help would be greatly appreciated. Thanks