|
-
[F8] promblem with a path. Can someone take a quick a look?
I having a problem with my paths, I think. I had this code working fine on the movieClip itself but something has gone wrong now that I have made it into a function on the root.
Code:
xMin = 0;
xMax = 500;
yMin = 0;
yMax = 280;
function masking() {
for (i=0; i<20; i++){
randomX = Math.random() * ( _root.xMax - _root.xMin );
randomY = Math.random() * ( _root.yMax - _root.yMin );
orgClip = "_root.mcMask.mcItem";
dupClip = "_root.mcMask.mcItem" + i;
//trace("dupClip = " + dupClip);
duplicateMovieClip(orgClip, dupClip, this.getNextHighestDepth());
trace(dupClip);
eval("_root.mcMask.mcItem"+i)._x = randomX;
eval("_root.mcMask.mcItem"+i)._y = randomY;
}
}
What am I doing wrong here? I'm guessing it has something to do with the duplicateMovieCLip() & the depth. Any tips would be appreciated as always : )
Thanks!
-
Senior Member
Try this code:
Code:
xMin = 0;
xMax = 500;
yMin = 0;
yMax = 280;
function masking() {
for (i=0; i<20; i++) {
randomX = Math.round(Math.random()*(xMax-xMin));
randomY = Math.round(Math.random()*(yMax-yMin));
orgClip = "mcMask.mcItem";
dupClip = "mcMask.mcItem"+i;
clipDepth = mcMask.getNextHighestDepth();
mcMask.mcItem.duplicateMovieClip(dupClip, clipDepth,{_y:randomY, _x:randomX});
trace(dupClip);
trace(clipDepth);
trace(randomX+" : "+randomY);
}
}
masking();
Hope this helps!
-
caroach,
THANKS! that was very helpful and seemsto be working great.
-
Senior Member
Glad to help
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|