Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Become a Premium Member and unlock a new, free course in leading technologies each month.

Solved

Posted on 2007-11-29

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

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();
```

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

- Help others & share knowledge
- Earn cash & points
- Learn & ask questions

3 Comments

```
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();
//additions
duplicateMovieClip(_root.mc, "mc2", 100);
mc2._x = 0;
mc2._y = 250;
duplicateMovieClip(_root.mc, "mc3", 200);
mc3._x = 250;
mc3._y = 0;
duplicateMovieClip(_root.mc, "mc4", 300);
mc4._x = 250;
mc4._y = 250;
```

CyanBlue

```
function createSphere(__mc:MovieClip, __x:Number, __y:Number, __w:Number, __h:Number)
{
var colors = [0xDCE0B6, 0x000000, 0x000000];
var alphas = [100, 100, 0];
var ratios = [0, 254, 255];
var matrix = {matrixType:"box", x:__x, y:__y, w:__w, h:__h, r:(45 / 180) * Math.PI};
__mc.beginGradientFill("radial", colors, alphas, ratios, matrix);
__mc.moveTo(__x, __y);
__mc.lineTo(__x, __y);
__mc.lineTo(__x + __w, __y);
__mc.lineTo(__x + __w, __y + __h);
__mc.lineTo(__x, __y + __h);
__mc.endFill();
}
//
var mc1:MovieClip = this.createEmptyMovieClip("grad1", 1);
createSphere(mc1, 50, 300, 50, 50);
//
var mc2:MovieClip = this.createEmptyMovieClip("grad2", 2);
createSphere(mc2, 300, 50, 50, 50);
//
var mc3:MovieClip = this.createEmptyMovieClip("grad3", 3);
createSphere(mc3, 300, 300, 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: http://www.experts-exchange.com/Software/Photos_Graphics/Web_Graphics/Macromedia_Flash/Q_23012179.html

Thanks again!

John

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Title | # Comments | Views | Activity |
---|---|---|---|

How do I convert a CS4 FLA file to CS6? | 1 | 889 | |

High Internet Explorer CPU on Flash site in Citrix | 2 | 905 | |

How to determine issues pulling up internal device in browser. | 5 | 100 | |

Why is this simple, masked Flash animation flickering? | 20 | 218 |

Course of the Month9 days, 13 hours left to enroll

Join the community of 500,000 technology professionals and ask your questions.