Ok so I have generated this. Now I am stuck. The code is heavily commented. It goes through all the trace statements, but I see nothing on stage, and if I click everywhere on the stage, nothing is traced...
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
movieclip.x = randomF(0, 1200);
movieclip.y = randomF(0, 800);
var l:Loader = new Loader(); //Creates loader
var urlreq:URLRequest = new URLRequest("beach.jpg"); //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;
trace("image loaded and placed");
}
container.addChild(movieclip); //Adds child to a movieclip already on stage
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.
}
}
private function displayDataF(e:MouseEvent):void
{
trace(e.target.name); //If someone clicks the movieclip, it will trace the name. Nothing is traced, and the movielips aren't seen...
}




Reply With Quote