Hmm… it is causing flash to crash. Could the fla be corrupted? It is weird because it is not the typical “Unexpected file format” error. What version of flash did you save it with?
Well it won’t open with flash mx either :(. I’ll see if I can spend a moment getting the raw code to do something
Edit: OK there are definitly some variables being set by movieclips that are not provided in the code. What do you want the code to do when you are done? I think it would be easier for me just to recode it to make it more functional.
Alright I finally got the code to work :D, now how do you want it to spiral? The code was missing a ton of ‘this’ keywords. It had prototypical functions, but really failed to use them correctly.
Alright, is this how you want it? It is coming along quite neatly :D. I totally ditched your code if that is fine, because I found it way easier just to write my own :D. Let me know if you have any questions!
Camera=function(X,Y,Z,focalLength){
this.fL=focalLength;
this.X=X;
this.Y=Y;
this.Z=Z;
}
Camera.prototype.Move=function(X,Y,Z){
this.X+=X;
this.Y+=Y;
this.Z+=Z;
this.engine.Render();
}
Engine3D=function(Camera,Centerx,Centery){
this.camera=Camera;
this.camera.engine=this;
this.vertexBuffer = _root.createEmptyMovieClip("3Dcontainer"+(containerdepth++),containerdepth);
this.vertexBuffer._x=Centerx;
this.vertexBuffer._y=Centery;
this.depth=0;
}
Engine3D.prototype.Render=function(){
for(i in this.vertexBuffer){
this.vertexBuffer*.Draw();
}
}
Engine3D.prototype.Attach3DPoint=function(X,Y,Z){
this.depth++;
var mc=this.vertexBuffer.attachMovie("point","point"+this.depth,this.depth);
mc.parentEngine=this;
mc.X=X;
mc.Y=Y;
mc.Z=Z;
mc.Draw();
return mc;
}
MovieClip.prototype.Draw=function(){
var focalRatio=this.parentEngine.camera.fL/(this.parentEngine.camera.fL+(this.Z-this.parentEngine.camera.z))
this._x=focalRatio*(this.parentEngine.camera.X-this.X);
this._y=focalRatio*(this.parentEngine.camera.Y-this.Y);
this.swapDepths(10000-this.Z);
this._xscale=this._yscale=this._alpha=focalRatio*100;
if(focalRatio>7){
// this.removeMovieClip();
}
}
Camera1 = new Camera(0,0,-20,40);
Engine1=new Engine3D(Camera1,275,200);
//These are the variables that you will want to manipulate
Radius = 1;
Count=10;
OutwardVelocity =.5
RotationalVelocity =.1
for(var n = 0;n<Count;n++){
var mc = Engine1.attach3DPoint(0,0,0);
mc.T=n/Count*Math.PI*2;
mc.R=0;
mc.line=line.createEmptyMovieClip("line"+n,n+1);
mc.line.lineStyle(1,0,100);
mc.line.moveTo(mc._x+275,mc._y+200);
mc.onEnterFrame=function(){
this.T+=RotationalVelocity;
this.R+=OutwardVelocity;
this.X=this.R*Math.cos(this.T);
this.Z=this.R*Math.sin(this.T)+this.R/2;
this.Y=this.Z;
}
}
onEnterFrame=function(){
Engine1.Render();
//Camera1.Move(-(-275+_xmouse)/30,-(-200+_ymouse)/30,2);
}
Very cool effect and your code is much easier to understand. I didn’t write all that code just changed things around. Not exactly what I ment by spiral.
Here is an example if you still want to mess with it.
Thanks for all the help. Concidering how many hits this thread has received I think I am not the only one looking for a good 3d spiral effect.
Lol ok. So do you not want it in 3d, because what I posted actually is a spiral, it just doesn’t really look like it. I posted an example with the lines drawn.
I also posted a 2D spiral below. If this is still not quite what you want let me know