PDA

View Full Version : create lines dynamically from txt


mhstudio
03-03-2005, 07:29 PM
i have aproblem i have a txt (variables.txt)with the following code:

&x0=0&y0=100&xf=100&yf=200

the in the first frame the following code:

loadVariables("variables.txt","controller")
stop()

in the second frame the following code to create a line, :

x0=_root.controller.x0;
y0=_root.controller.y0;
xf=_root.controller.xf;
yf=_root.controller.yf;

_root.createEmptyMovieClip("line", 1);
with (line) {
lineStyle(1,0x000000,100);
moveTo(x0,y0);
lineTo(xf,yf);
}
stop();

from here i don't have problems, the line is drawed,now comes the problem i want to add a counter to create various lines

like that:

counter=1;
x0=_root.controller.x0+counter;
y0=_root.controller.y0+counter;
xf=_root.controller.xf+counter;
yf=_root.controller.yf+counter;

_root.createEmptyMovieClip("line", 1);
with (line) {
lineStyle(1,0x000000,100);
moveTo(x0,y0);
lineTo(xf,yf);
}
stop();

and the new txt is like this:

&x01=0&y01=100&xf1=100&yf1=200

but i can't draw the line now, what's wrong?

Barn
03-03-2005, 09:58 PM
Looks to me like you are overwriting the definition of your original movieclip that you created to contain the lines by using the same and the same depth (though using the same depth would be sufficient to destroy the prior clip).

I suspect you are seeing the new line and not the original, and the original is gone.