Groups | Blog | Home
all groups > flash (macromedia) > august 2004 >

flash (macromedia) : nesting woes... what level am I?


zimbot
8/5/2004 10:25:20 PM

I am struggling with one concept that I would very much like a bit of
assistance with..

And I can sum it up into 1 example..



The example is from Fibonacci flower page 80 g mulzler



The following example is attached to a movie clip that is at the root ( main
time line )

And of course it attachs the leaf



Here is what I wish to know: What if this ?viewer clip? were nested inside a
another clip

What ?path? adjustments need to be made in the below if the viewer clip were
inside another clip

?call it dog ..



so I wish to know how to make it happen with Main time line root has dog mc
and inside THAT is the viewer and that attcaches the leaf.



Any assistance would be appreciated.



thanks



In the code:



onClipEvent (load) {

function init () {

maxleaves = 300;

//

G = 1/1.618033989;

GA = 360-360*G;

//

rad = 20;

rgrowth = 1.005;

//

cur = maxleaves;

}

init();

}

onClipEvent (enterFrame) {

if (cur) {

cur--;

//

rot += GA;

rot -= int(rot/360)*360;

//

rad *= rgrowth;

x = Math.cos(rot*Math.PI/180)*rad;

y = Math.sin(rot*Math.PI/180)*rad;

//

this.attachMovie("leaf", "l"+cur, cur);

mc = this["l"+cur];

//

mc._x = x;

mc._y = y;

mc._rotation = rot;

//

}

}



David Stiller
8/6/2004 8:55:54 AM
zimbot,

Nesting clips is like nesting folders on your hard drive. If you have a
clip called viewer_mc on the main timeline, its path is _root.viewer_mc; if
you put that viewer into a movie clip called dog, its new path is
_root.dog.viewer_mc; if you stack that inside another clip called
dogcatcher, the newest path would be _root.dogcatcher.dog.veiwer_mc.

By the looks of it, though, it shouldn't make much difference in this
case. The reason I say that is because your code is written within an
onClipEvent block, which is a bit "old fashioned" nowadays. That's neither
good nor bad, mind you ... nothing *wrong* with it, just that ActionScript
now allows you to write all your code in a keyframe on the main timeline
rather than having to put your code *inside* clips. In this case, all your
methods and properties required by the viewer clip are contained within the
viewer clip, so you can put it where you like.


David
stiller ( at ) quip ( dot ) net


[quoted text, click to view]

AddThis Social Bookmark Button