Link to home
Start Free TrialLog in
Avatar of John Carney
John CarneyFlag for United States of America

asked on

In Flash Mx2004, how do I create more than one shape with Action Script?

The script below will produce one gradient ball 50x50 at x=50, y=50. How do I modify it so that it will simultaneously produce three more  shapes at these locations:
x=50, y=300
x=300, y=50
x=300, y=300

Thanks!
John
import flash.geom.*
//
var mc:MovieClip = this.createEmptyMovieClip("grad", 1);
 
var colors = [0xDCE0B6, 0x000000, 0x000000];
var alphas = [100, 100, 0];
var ratios = [0, 254, 255];
var matrix = {matrixType:"box", x:50, y:50, w:50, h:50, r:(45/180)*Math.PI};
mc.beginGradientFill("radial",colors,alphas,ratios,matrix);
mc.moveTo(50,50);
mc.lineTo(50,100);
mc.lineTo(100,100);
mc.lineTo(100,50);
mc.lineTo(50,50);
mc.endFill();

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Tom Ray
Tom Ray
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of John Carney

ASKER

Hey, thanks! I'm sorry for being checked out for so long. sibgig's solution worked perfectly right out of the box, so did Cyanblue's, (except for the one missing sphere at 50,50)

The answers were so close in time, and together taught me 2 different ways to explore doing it, I'd like to split up the points woth the majority going to sibgig for getting there first.

Oh and please take a look at my next question which builds on your answers here: https://www.experts-exchange.com/questions/23012179/Flash-MX2004-Creating-2-different-kinds-of-shapes-with-script.html

Thanks again!

John