ok...if you alter the for statement like this, you see a movieclip but only one movieclip...
and i click on it...its card60....i guess its somehow looping through it 3 times...and only creating one....help?
PHP Code:private function createProjects():void
{
for (var i:int = 0; i < numberOfProjects; i++)
{
var movieclip:MovieClip = new MovieClip(); //Creates the movieclip
movieclip.name = "card" + projectNumber; //Gives a name card + the current project number
movieclip.addEventListener(MouseEvent.CLICK, displayDataF); //Adds an event listener
var l:Loader = new Loader(); //Creates loader
var urlreq:URLRequest = new URLRequest("http://www.mountainguidesinternational.com/images_1/world.gif"); //Uses defult image for now
l.load(urlreq); //Loads
l.contentLoaderInfo.addEventListener(Event.COMPLETE, placeLoadedImage); //Adds an event listener for when the image is finished loading
function placeLoadedImage(e:Event):void
{
movieclip.addChild(l); //Adds the child
movieclip.width = 150;
movieclip.height = 100;
movieclip.x = randomF(0, 1200);
movieclip.y = randomF(0, 800);
addChild(movieclip); //Adds child to a movieclip already on stage
trace("image loaded and placed");
}
trace("Working on project " + projectNumber);
projectNumber++; //Before the loop is complete, the number is increased by one so it will work on the next number.
}
}




Reply With Quote