A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: [F8] promblem with a path. Can someone take a quick a look?

  1. #1
    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

  2. #2
    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!

  3. #3
    Senior Member
    Join Date
    Mar 2002
    Posts
    270
    caroach,

    THANKS! that was very helpful and seemsto be working great.
    Erik Peterson
    Project o3

  4. #4
    Senior Member caroach's Avatar
    Join Date
    Nov 2002
    Location
    Chicago, IL
    Posts
    374
    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
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center