Hello!

I've found a nice code (pasted at the bottom of
this mail) to display a rotating set of movieclips.

One problem with it is though that it assumes
a hardcoded set of 7 movieclips in the library,
called "0", "1", ... "6" and attaches them to the
stage by calling attachMovie(i, "mc"+i, i);

I'd like to change that to a MovieClip-based class
which would take an arbitary array of MovieClips
and attach them to itself:

class Ellipse extends MovieClip {
    private var mcs:Array = [];
...
    public function setMovieClips(mcs:Array) {
        this.mcs = mcs;

        for (var i:Number = 0; i < mcs.length; i++) {
            var mc:MovieClip = mcs[i];
             // XXX  this.attachMovie(i, "mc"+i, i);

And here comes the problem - how do I attach
MovieClips (referred by "mc" above) to the Ellipse?

There are only 2 methods - attachMovie() and
duplicateMovieClip() - and they both need a linkage
name as the argument.

I.e. my general question is: how do I remove
a child-MovieClip from one parent-MovieClip
and assign it to another parent-MovieClip?

Regards
Alex

PS: Here is the original code

var N:Number = 7;
var A:Number = 150;
var B:Number = 50;
var X:Number = 200;
var Y:Number = 150;
var GR:Number = Math.PI / 180;

for (var i:Number = 0; i < N; i++) {
        attachMovie(i, "mc"+i, i);
        this["mc"+i].alpha = 0+i*(360/N);
        this["mc"+i].onEnterFrame = function() {
                this.alpha += (_root._xmouse - X) / 100;

                this._x = X + A * Math.cos(this.alpha * GR);
                this._y = this._xscale = this._yscale =
                              Y + B * Math.sin(this.alpha * GR);

                this.swapDepths(this._y);
        };
}
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to