SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Addict ARSA's Avatar
    Join Date
    Apr 2003
    Location
    San Juan, Puerto Rico
    Posts
    215
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Help needed with this loop

    using this code I can manage to duplicate the movie clip, if the "dot" movie clip is in the _root. But my movie clip is not found in the _root. it is found in this path:

    _root.navigation.main.map.dot

    I tried adding the path on front of all the "dot"s in my code, but then it doesnt duplicate my dots???

    any help?

    Code:
    // finalCountNum is loaded from a PHP file
    
    // (user setings, will be changed latter for database values)
    var xpos 		= -330.4;
    var ypos 		= 72.8;
    var yspace 		= 5;
    
    
    // Duplicate the dots and place them apart on the X & Y axis
    for (i=1; i<=finalCountNum; i++;) {
    	dot.duplicateMovieClip("dot"+i, this);
    	this["dot"+i]._x = xpos;
    	this["dot"+i]._y = ypos;
    	ypos += yspace;
    	
    	// Get the last name of the dot for the debugger
    	var dotName = ["dot"+i];
    }
    Thank you!
    "I am enough of an artist to draw freely upon my imagination. Imagination is more important than knowledge. Knowledge is limited. Imagination encircles the world." - Albert Einstein

  2. #2
    Snowboarders die even younger igor.kudela's Avatar
    Join Date
    Feb 2005
    Posts
    731
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    dot.duplicateMovieClip("dot"+i, this); change it to _root.duplicateMovieClip("dot"+i, this);
    and it should work
    Igor Kudela
    NetPublisher - FREE Customizable .NET CMS

  3. #3
    SitePoint Addict ARSA's Avatar
    Join Date
    Apr 2003
    Location
    San Juan, Puerto Rico
    Posts
    215
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hello, igor.kudela

    your suggestion doesn't seem to work for me any other suggetsions?
    "I am enough of an artist to draw freely upon my imagination. Imagination is more important than knowledge. Knowledge is limited. Imagination encircles the world." - Albert Einstein

  4. #4
    SitePoint Addict ARSA's Avatar
    Join Date
    Apr 2003
    Location
    San Juan, Puerto Rico
    Posts
    215
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well so far this code kinda of works, the only problem is that I don't know how to talk to the dots once created inside the for loop, so I can replace them.

    Code:
    // (user setings, will be changed latter for database values)
    var xpos 		= -385;
    var ypos 		= 88;
    var yspace 		= 5;
    
    
    // Duplicate the dots and place them apart on the X & Y axis
    for (i=1; i<=finalCountNum; i++) {
    	duplicateMovieClip(_root.navigation.main.map.dot, "dot"+i, i);
    
    	var dotPath = "_root.navigation.main.map.";
    	var dotName = "dot" + i;
    	dotFullPath = dotPath + dotName;
    
    	dotFullPath._x = xpos;
    	dotFullPath._y = ypos;
    	
    	ypos += yspace;
    
    }
    "I am enough of an artist to draw freely upon my imagination. Imagination is more important than knowledge. Knowledge is limited. Imagination encircles the world." - Albert Einstein

  5. #5
    SitePoint Addict ARSA's Avatar
    Join Date
    Apr 2003
    Location
    San Juan, Puerto Rico
    Posts
    215
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I answered my own question, this code do the job.
    Code:
    // (user setings, will be changed latter for database values)
    var xpos 		= -385;
    var ypos 		= 88;
    var yspace 		= 5;
    
    
    // Duplicate the dots and place them apart on the X & Y axis
    for (i=1; i<=finalCountNum; i++) {
    	// duplicate movie clip
    	duplicateMovieClip(_root.navigation.main.map.dot, "dot"+i, i);
    	
    	// organize the clones
    	setProperty("_root.navigation.main.map.dot"+i, _x, xpos);
    	setProperty("_root.navigation.main.map.dot"+i, _y, ypos);
    	
    	// Add more space
    	ypos += yspace;
    
    }
    "I am enough of an artist to draw freely upon my imagination. Imagination is more important than knowledge. Knowledge is limited. Imagination encircles the world." - Albert Einstein


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •