TOOL
May 26, 2003, 9:14am
1
I’m just experimenting with some code in MX and thought that this code would loop through 15 times and draw 15 random lines…when I test the movie, nothing appears…what am I doing wrong?
Thanks.
[AS]_root.createEmptyMovieClip(“clip”, 1);
for (i; i>15; i++) {
x1 = Math.floor(Math.random()(250-2))+2;
x2 = Math.floor(Math.random() (250-2))+2;
y1 = Math.floor(Math.random()(250-2))+2;
y2 = Math.floor(Math.random() (250-2))+2;
clip.lineStyle(3, 0x000000, 100);
clip.moveTo(x1, y1);
clip.lineTo(x2, y2);
}[/AS]
If I’m not mistaken, you forgot to state what the variable i would be. I also switched the greater sign to less than 15. Try this and see if it works.
[AS]_root.createEmptyMovieClip(“clip”, 1);
for (i=0; i<15; i++) {
x1 = Math.floor(Math.random()(250-2))+2;
x2 = Math.floor(Math.random() (250-2))+2;
y1 = Math.floor(Math.random()(250-2))+2;
y2 = Math.floor(Math.random() (250-2))+2;
clip.lineStyle(3, 0x000000, 100);
clip.moveTo(x1, y1);
clip.lineTo(x2, y2);
}
[/AS]
system
May 26, 2003, 10:13am
3
yeah that worked, thanks electrongeek good to know i wasn’t that far from the correct code