To register for an Internet.com membership to receive newsletters and white papers, use the Register button ABOVE.
To participate in the message forums BELOW, click here


A Flash Developer Resource Site

Go Back   Flash Kit Community Forums > Flash Help > Flash Newbies

Reply
 
Thread Tools Search this Thread Display Modes
Old 07-11-2007, 11:03 AM   #1
po3
Senior Member
 
Join Date: Mar 2002
Posts: 270
[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!
__________________
Erik Peterson
Project o3
po3 is offline   Reply With Quote
Old 07-11-2007, 12:18 PM   #2
caroach
Senior Member
 
caroach's Avatar
 
Join Date: Nov 2002
Location: Chicago, IL
Posts: 374
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 is offline   Reply With Quote
Old 07-11-2007, 01:05 PM   #3
po3
Senior Member
 
Join Date: Mar 2002
Posts: 270
caroach,

THANKS! that was very helpful and seemsto be working great.
__________________
Erik Peterson
Project o3
po3 is offline   Reply With Quote
Old 07-11-2007, 01:06 PM   #4
caroach
Senior Member
 
caroach's Avatar
 
Join Date: Nov 2002
Location: Chicago, IL
Posts: 374
Glad to help
caroach is offline   Reply With Quote
Reply

Go Back   Flash Kit Community Forums > Flash Help > Flash Newbies

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 02:20 PM.


internet.commerce
Be a Commerce Partner
 »  »  »  »  »  »  »
 »  »  »  »  »  »
 

    

Acceptable Use Policy


The Network for Technology Professionals

Search:

About Internet.com

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | E-mail Offers


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.