• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 373
  • Last Modified:

AS3/ XML: Need to load in an image from xml

Listed is my code.  All of my text is loading in fine but I am a little confused on how my images get loaded in.  Do I need to place a movieClip on the stage and load the image into that?  I have tried this but with no success.  The only thing I see is the movieClip.  Or..  do I need to create another loader to hold the images.

To catch you up:
I have an mc with 2 text fields inside both being populated successfully from xml.  Now within this same mc I need to load in an image from the same xml...  Please review my code and help if you can...

calloutCopy8_mc.picBox_mc.html = contentInput.callout.picture;  code in question


calloutCopy8_mc is the mc...  picBox_mc is the mc within that I am trying to load the xml image into...

Thanks again...
var xmlLoader:URLLoader = new URLLoader();
var xmlData:XML = new XML();
 
xmlLoader.addEventListener(Event.COMPLETE, LoadXML);
 
xmlLoader.load(new URLRequest("CalloutContent.xml"));
 
function LoadXML(e:Event):void {
	trace("LoadXML");
	xmlData = new XML(e.target.data);
	ParseContent(xmlData);
}
 
function ParseContent(contentInput:XML):void {
	trace("ParseContent");
	calloutCopy8_mc.picBox_mc.html = contentInput.callout.picture;
	
 
        txtBox_mc.buttonText.htmlText = contentInput.callout.button;
	txtBox2_mc.buttonText.htmlText = contentInput.callout.button2;
	txtBox3_mc.buttonText.htmlText = contentInput.callout.button3;
	txtBox_mc_btm.buttonText.htmlText = contentInput.callout.button4;
	txtBox5_mc.buttonText.htmlText = contentInput.callout.button5;
	txtBox6_mc.buttonText.htmlText = contentInput.callout.button6;
	txtBox7_mc.buttonText.htmlText = contentInput.callout.button7;
	txtBox8_mc.buttonText.htmlText = contentInput.callout.button8;
	calloutCopy_mc.Header.htmlText = contentInput.callout.heading;
	calloutCopy_mc.Copy.htmlText = contentInput.callout.texting;
	calloutCopy2_mc.Header.htmlText = contentInput.callout.heading2;
	calloutCopy2_mc.Copy.htmlText = contentInput.callout.texting2;
	calloutCopy3_mc.Header.htmlText = contentInput.callout.heading3;
	calloutCopy3_mc.Copy.htmlText = contentInput.callout.texting3;
	calloutCopy4_mc.Header.htmlText = contentInput.callout.heading4;
	calloutCopy4_mc.Copy.htmlText = contentInput.callout.texting4;
	calloutCopy5_mc.Header.htmlText = contentInput.callout.heading5;
	calloutCopy5_mc.Copy.htmlText = contentInput.callout.texting5;
	calloutCopy6_mc.Header.htmlText = contentInput.callout.heading6;
	calloutCopy6_mc.Copy.htmlText = contentInput.callout.texting6;
	calloutCopy7_mc.Header.htmlText = contentInput.callout.heading7;
	calloutCopy7_mc.Copy.htmlText = contentInput.callout.texting7;
	calloutCopy8_mc.Header.htmlText = contentInput.callout.heading8;
	calloutCopy8_mc.Copy.htmlText = contentInput.callout.texting8;
	
	
	trace("XML Output");
	trace("------------------------");
	trace(contentInput);
 
}

Open in new window

0
cubical38
Asked:
cubical38
  • 3
1 Solution
 
Eaddy BarnesITCommented:
You will also need to load the images in with a loader..
here is a link to a gallery i made.
have a look at the script and let me know if you understand.

http://dl.getdropbox.com/u/45567/gallery.rar

GE
0
 
cubical38Author Commented:
This does make sense, but it is not working with the dynamic text boxes I have in place.  Is there a way to implement this without changing what I have in place?

Thanks for the reply...
0
 
cubical38Author Commented:
Thanks
0
 
cubical38Author Commented:
Everything works...
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Ruby Fundamentals

This course will introduce you to Ruby, as well as teach you about classes, methods, variables, data structures, loops, enumerable methods, and finishing touches.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now