# Accessing XML data loaded in parent swf from child swf

**URL:** <https://forum.kirupa.com/t/accessing-xml-data-loaded-in-parent-swf-from-child-swf/330655>\
**Category:** flash\
**Created:** [February 22, 2013, 11:14pm UTC](https://forum.kirupa.com/t/accessing-xml-data-loaded-in-parent-swf-from-child-swf/330655 "2013-02-22T23:14:32Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![roundpaws](https://avatars.discourse-cdn.com/v4/letter/r/90db22/32.png) [@roundpaws](https://forum.kirupa.com/u/roundpaws)\
**Post date:** [February 22, 2013, 11:14pm UTC](https://forum.kirupa.com/t/accessing-xml-data-loaded-in-parent-swf-from-child-swf/330655/1 "2013-02-22T23:14:32Z")

</div>

[COLOR=#000000][FONT=verdana]I have a a.swf that loads xml data correctly using:[/FONT][/COLOR]  
[COLOR=#000000][FONT=verdana]var myXML:XML; [/FONT][/COLOR]  
[COLOR=#000000][FONT=verdana]myLoader.load(new URLRequest(“addresses.xml”));[/FONT][/COLOR]  
[COLOR=#000000][FONT=verdana]myLoader.addEventListener(Event.COMPLETE, processXML);[/FONT][/COLOR]

[COLOR=#000000][FONT=verdana]function processXML(e:Event):void {[/FONT][/COLOR]  
[COLOR=#000000][FONT=verdana]XML.ignoreWhitespace = true;[/FONT][/COLOR]  
[COLOR=#000000][FONT=verdana]myXML = new XML(e.target.data);[/FONT][/COLOR]

[COLOR=#000000][FONT=verdana]I can do a trace on a.swf and see the loaded xml just fine. And I can set variables just fine such as:[/FONT][/COLOR]  
[COLOR=#000000][FONT=verdana]photo1\_text.academic\_thumbtitle1.text = myXML.address.thumbtitle[0];[/FONT][/COLOR]

[COLOR=#000000][FONT=verdana]Then from the a.swf, I load b.swf correctly into a container movieclip with the code:[/FONT][/COLOR]

[COLOR=#000000][FONT=verdana]container.addChild(swfLoader); [/FONT][/COLOR]  
[COLOR=#000000][FONT=verdana]var url:URLRequest = new URLRequest(“academic.swf”); [/FONT][/COLOR]  
[COLOR=#000000][FONT=verdana]swfLoader.load(url); [/FONT][/COLOR]

[COLOR=#000000][FONT=verdana]In b.swf I have movieclips on the stage that will display the xml data. However, I can’t find a way to reference the xml data from b.swf so that it is recognized.[/FONT][/COLOR]

[COLOR=#000000][FONT=verdana]If I try:[/FONT][/COLOR]  
[COLOR=#000000][FONT=verdana]photo1\_text.academic\_thumbtitle1.text = myXML.address.thumbtitle[0];[/FONT][/COLOR]

[COLOR=#000000][FONT=verdana]which worked in a.swf, I don’t get an error but the XML data isn’t showing up on stage in the [/FONT][/COLOR][[COLOR=blue][FONT=inherit !important][FONT=inherit !important]movie[/FONT][/FONT][/COLOR]](http://www.actionscript.org/forums/showthread.php3?p=1144200#)[COLOR=#000000][FONT=verdana] clips (photo1\_.text.academic\_thumbtitle.text).[/FONT][/COLOR]

[COLOR=#000000][FONT=verdana]How do I reference the XML data from the child swf so that it is pulled in correctly to the stage?[/FONT][/COLOR]

[COLOR=#000000][FONT=verdana]I can’t load it in the child swf for other reasons so I am trying it in the parent. Is this possible?[/FONT][/COLOR]

[COLOR=#000000][FONT=verdana]Thanks for any help.[/FONT][/COLOR]
