Kool. Thanks for the help. I followed your advise and got it working. However, I am now trying to follow your suggestion to make it better. This is what I have done.
function showTxt(e:MouseEvent):void {
outputTxt.text = nameTxt.text;
var myString:String=defaultName.defaultName.text;
loadImage(myString);
}
function loadImage(myString:String):void {
if(counter<myString.length)
{
var tempVar:String = myString.charAt(counter);
var tempString:String = tempVar + ".JPG";
file = new URLRequest(tempString);
myLoader = new Loader();
myLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, loadIm);
myLoader.load(file);
counter++;
}
}
function loadIm(e:Event) {
myLoader.x = posOne;
myLoader.y= posTwo;
addChild(myLoader);
posOne = posOne+ 40;
}
So, the first function is for my button, which is pressed when the user enters their name. The name is put into a variable, and it is passed to the function loadImage(). Here, I check to see if the counter, which was initialised to 0, is less than the input length. If it is, it will do the loading, and call up the Event.COMPLETE function, which places the images, and adds them to the stage.
This time however, only the first image is displaying. I have followed your advise as closely as possible, but I am obviously going wrong somewhere. Sorry about this, only two weeks into AS3.
Can you advise me on what I am doing wrong now, and what i need to change?
cheers
I think you missed the last sentence of my earlier response