Need some help with Flash MX Actionscript
I'm making an experimental flash 6 movie where random sized white points appear on the stage and are randomly connected by lines.
I have a movieclip called "point" which is an animation of the point fading onto the screen. It is duplicated and has it's duplicates given new names and levels at random positions and random scales on the stage.
and another movieclip called canvas, which is blank and will be used to draw the lines.
My actionscript which runs twice every second is as follows:
---------------------------------------------------------------------------
pointnum += 1;
//increment the number of points created by 1
duplicateMovieClip(point, "point"+pointnum, pointnum);
//create a new point with a new name: "point" followed by its number
set("newpointscale", (Math.random()*100)+25);
//choose a random number between 25 & 125
set("newx", (Math.random()*480));
//choose a random number between 0 & 480
set("newy", (Math.random()*270));
//choose a random number between 0 & 270
setProperty("point"+pointnum, _xscale, newpointscale);
setProperty("point"+pointnum, _yscale, newpointscale);
//set the new point's width & height to the first new random number
setProperty("point"+pointnum, _x, newx);
//set the new point's x position to the second new random number
setProperty("point"+pointnum, _y, newy);
//set the new point's y position to the third new random number
canvas.lineStyle(1, 0xFFFFFF, 25);
//set the pen colour to 25% translucent white
canvas.moveTo(newx, newy);
//move the pen to the centre of the new point
set("randomnum", Math.round(Math.random()*pointnum));
//choose a random integer below or equal to the number of the newest point
canvas.lineTo("point"+randomnum._x,"point"+randomn um._y);
//choose a random point based on the most recently chosen random integer, this is the line with the problem.
---------------------------------------------------------------------------
I can see the problem, obviously before the._x and ._y it wants a target path, but "point"+randomnum is returning the target path as a string.
Does anyone know how to convert a string to a target path in actionscript?
Andrew
I have a movieclip called "point" which is an animation of the point fading onto the screen. It is duplicated and has it's duplicates given new names and levels at random positions and random scales on the stage.
and another movieclip called canvas, which is blank and will be used to draw the lines.
My actionscript which runs twice every second is as follows:
---------------------------------------------------------------------------
pointnum += 1;
//increment the number of points created by 1
duplicateMovieClip(point, "point"+pointnum, pointnum);
//create a new point with a new name: "point" followed by its number
set("newpointscale", (Math.random()*100)+25);
//choose a random number between 25 & 125
set("newx", (Math.random()*480));
//choose a random number between 0 & 480
set("newy", (Math.random()*270));
//choose a random number between 0 & 270
setProperty("point"+pointnum, _xscale, newpointscale);
setProperty("point"+pointnum, _yscale, newpointscale);
//set the new point's width & height to the first new random number
setProperty("point"+pointnum, _x, newx);
//set the new point's x position to the second new random number
setProperty("point"+pointnum, _y, newy);
//set the new point's y position to the third new random number
canvas.lineStyle(1, 0xFFFFFF, 25);
//set the pen colour to 25% translucent white
canvas.moveTo(newx, newy);
//move the pen to the centre of the new point
set("randomnum", Math.round(Math.random()*pointnum));
//choose a random integer below or equal to the number of the newest point
canvas.lineTo("point"+randomnum._x,"point"+randomn um._y);
//choose a random point based on the most recently chosen random integer, this is the line with the problem.
---------------------------------------------------------------------------
I can see the problem, obviously before the._x and ._y it wants a target path, but "point"+randomnum is returning the target path as a string.
Does anyone know how to convert a string to a target path in actionscript?
Andrew