# 3d Scroll text help

Hi i’m trying to make a 3d vector scroller using the 3d tutorials by the great senocular

my problem is i am not to good at action script and im sure my method of adding a new letter and removing it is prehistoric (see my lame code)

i was wondering is there an easier way to do this

Would it be possible to have an option with the text i want to be displayed
[color=red]TEXT = “ABCBCAACABBABACCB”[/color]
and have action script run through each letter in my [color=red]TEXT[/color] and add and remove each letter automatically

at the moment i am using a [color=red]time++[/color] and when the [color=red]time = +20[/color] i add a new letter
and when the[color=red] letter .x = -189[/color] i remove that letter

NOTE i have only done letters ABC so far

``````this.createEmptyMovieClip("theScene", 1);
theScene._x = 150;
theScene._y = 150;
focalLength = 520;
time=1
make3DPoint = function (x, y, z) {
var point = new Object();
point.x = x
point.y = y
point.z = z
return point;
};
Transform3DPointsTo2DPoints = function (points, axisRotations) {
var TransformedPointsArray = [];
var sx = Math.sin(axisRotations.x);
var cx = Math.cos(axisRotations.x);
var sy = Math.sin(axisRotations.y);
var cy = Math.cos(axisRotations.y);
var sz = Math.sin(axisRotations.z);
var cz = Math.cos(axisRotations.z);
var x, y, z, xy, xz, yx, yz, zx, zy, scaleFactor;
var i = points.length;
while (i--) {
x = points*.x
y = points*.y
z = points*.z
xy = cx*y-sx*z;
xz = sx*y+cx*z;
yz = cy*xz-sy*x;
yx = sy*xz+cy*x;
zx = cz*yx-sz*xy;
zy = sz*yx+cz*xy;
scaleFactor = focalLength/(focalLength+yz);
x = zx*scaleFactor;
y = zy*scaleFactor;
z = -yz;

TransformedPointsArray* = make3DPoint(x, y, z);
}
return TransformedPointsArray;

};
pointsArray = [
//letter A
make3DPoint(-20+200, 20, 0),
make3DPoint(0+200, -20, 0),
make3DPoint(20+200, 20, 0),
//letter B
make3DPoint(-20+200, 20, 0),
make3DPoint(-20+200, -20, 0),
make3DPoint(20+200, -10, 0),
make3DPoint(0+200, 0, 0),
make3DPoint(20+200, 10, 0),
//letter C
make3DPoint(20+200, -20, 0),
make3DPoint(-20+200, -20, 0),
make3DPoint(-20+200, 20, 0),
make3DPoint(20+200, 20, 0)
];
theScene.AxisRotations = make3DPoint(0, 0, 0);
theScene.createEmptyMovieClip("A", 1);
theScene.createEmptyMovieClip("B", 2);
theScene.createEmptyMovieClip("C", 3);
rotate = function () {
time++
this.AxisRotations.y +=0.03
var pts2D = Transform3DPointsTo2DPoints(pointsArray, this.AxisRotations);
////////////////////////////attach movie clips
if(time>20){
A=true}
//----
if(time>40){
B=true}
//----
if(time>60){
C=true}
//----
////////////////////////////
////////////////////////////remove movie clips if they reach .x-189
if(pointsArray[2].x<-189){
removeMovieClip(theScene.A)
}
if(pointsArray[6].x<-189){
removeMovieClip(theScene.B)}
if(pointsArray[9].x<-189){
removeMovieClip(theScene.C)}
//////////////////////////////
//////////////////////////////Letter A
if(A){
with (this.A) {
clear();
/////////////////////////Move 3d points.x -3
for (i=0; i<3; i++){
pointsArray*.x-=3
}
/////////////////////////Draw the letter A
lineStyle(1,0xF000F0,100)
moveTo(pts2D[0].x, pts2D[0].y);
lineTo(pts2D[1].x, pts2D[1].y);
lineTo(pts2D[2].x, pts2D[2].y);
lineTo(pts2D[0].x, pts2D[0].y);
endFill();
}
}
//////////////////////////////
//////////////////////////////Letter B
if(B){
with (this.B) {
/////////////////////////Move 3d points.x -3
for (i=3; i<8; i++){
pointsArray*.x-=3
}
clear();
/////////////////////////Draw the letter B
lineStyle(1,0xF0f0F0,100)
moveTo(pts2D[3].x, pts2D[3].y);
lineTo(pts2D[4].x, pts2D[4].y);
lineTo(pts2D[5].x, pts2D[5].y);
lineTo(pts2D[6].x, pts2D[6].y);
lineTo(pts2D[7].x, pts2D[7].y);
lineTo(pts2D[3].x, pts2D[3].y);
endFill();
}
}
//////////////////////////////
//////////////////////////////Letter C
if(C){
with (this.C) {
/////////////////////////Move 3d points.x -3
for (i=8; i<12; i++){
pointsArray*.x-=3
}
clear();
/////////////////////////Draw the letter C
lineStyle(1,0xaaf0F0,100)
moveTo(pts2D[8].x, pts2D[8].y);
lineTo(pts2D[9].x, pts2D[9].y);
lineTo(pts2D[10].x, pts2D[10].y);
lineTo(pts2D[11].x, pts2D[11].y);
endFill();
}
}

};
theScene.onEnterFrame = rotate;

``````