Trying to load images dynamically from library NOT externally since i want these images to be loaded when the site is launched. Basically i have several buttons, each button returns an event that throws a specific image name to grab. Here is the function;
function sendDisplayData(e:MouseEvent){
display_mc.displayName.text = e.currentTarget.parent.menuItemName.text; //name of image eg. "myImageName" in the library;
//create the image object
var imgObj:Object = e.currentTarget.parent.menuItemName.text;
addChild(imgObj);
}
So basically when the function is called, i want to instantiate the names to the names of the actual movieclips in the library. The function below works but only for one image.
function sendDisplayData(e:MouseEvent){
display_mc.displayName.text = e.currentTarget.parent.menuItemName.text;
//create the image object
var image:Salads = new Salads(); //the class of the image is "Salads"
display_mc.addChild(Salads);
}
So how can i make this function dynamic by using a String and then grabbing the image related to that string from the library.