Bring XML into flash using a variable
Hi everyone.
I have a movieclip (jobImage) which I'm loading an image (Image1, a subnode of Job1) into using XML. But I want to be able to click on any one of a series of buttons which will have that image replaced by a new image (eg. Button2 will load Image2, another subnode of Job1, Button3 will load Image3, etc.).
So I have the selected button pass a number back to a variable called "_root.imageTarget". If Button2 was pressed, this would happen:
_root.imageTarget = "2";
This variable is then combined with the word "Image" to form a new variable (newImage)
newImage = "Image" + _root.imageTarget;
And that variable is used to load the correct node
jobImage.loadMovie("Images/" + work_arr[Job1].newImage);
Except it doesn't work. Any ideas why? When I write the actual name of the node, the script us successful:
jobImage.loadMovie("Images/" + work_arr[Job1].Image2);
Is it not possible to use a variable to target the correct node?
Thanks for your time!
Brian
