[Last Call] Learn how to a build a cloud-first strategyRegister Now


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

Posted on 2009-02-20
Medium Priority
Last Modified: 2013-11-11
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 {
	xmlData = new XML(e.target.data);
function ParseContent(contentInput:XML):void {
	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");

Open in new window

Question by:cubical38
  • 3
LVL 11

Accepted Solution

Eaddy Barnes earned 2000 total points
ID: 23697110
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.



Author Comment

ID: 23776433
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...

Author Comment

ID: 24098518

Author Comment

ID: 24098530
Everything works...

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes a solution to a problem of subloading one movie into another when they have different SWF versions. Sometime back, I was working on an ActionScript project while I came across an interesting fact which I would like to share…
It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
The goal of the tutorial is to teach the user how to select the video input device. Make sure you have an input device that in connected and work and recognized by Adobe Flash Media Live Encoder and select it in the “video input” menu.
The goal of the tutorial is to teach the user how to use the auto adjust feature and what the different options do. When your video is not working right you can choose the auto adjust feature to help choose your settings.
Suggested Courses

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question