# Create Dynamic XML - Flash communication (working)

**URL:** https://forum.kirupa.com/t/create-dynamic-xml-flash-communication-working/267061
**Category:** flash
**Created:** [July 28, 2008, 8:49am UTC](https://forum.kirupa.com/t/create-dynamic-xml-flash-communication-working/267061 "2008-07-28T08:49:02Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![wootwoot](https://avatars.discourse-cdn.com/v4/letter/w/85f322/32.png) [@wootwoot](https://forum.kirupa.com/u/wootwoot)
#### Post date: [July 28, 2008, 8:49am UTC](https://forum.kirupa.com/t/create-dynamic-xml-flash-communication-working/267061/1 "2008-07-28T08:49:02Z")

</div>

Hey everyone!

Ever wanted flash to be able to load info from external files(such as xml) as soon as these files were updated?

–updated–problem solved using _Method 2_ discussed below-- 31 July

Two ways that i know how to do this  
**Method 1-**

> use a timer so that flash will load the xml file every second or so then load it if a value in the xml is different that the stored value.

_This is how i did it:_

1. Use a timer to reload the xml file every 1 second.  
This causes problems with constantly loading images every one second – (bad).
2. Use a timer but write a script to check if xml is new - if new, load it,  
otherwise dont.

_Checking if XML is new or old:_  
php creates xml with time of creation node using the time() function “\<time\>1217229719\</time\>”  
When flash loads an xml it stores the time value in variable “time\_xml”. Every 1 second it loads a new xml in a tempory loader and compares the \<time\> value in this loader with the one stored in “time\_xml”. If they are different, it loads the temp data into flash and sets the time\_xml to the new \<time\>, otherwise it does nothing.

This creates real time flash - XML updating but it is very taxing on the flash application, making sluggish.

_Here is file:_  
Read the fla comments to get it to work on server  
2 files, unrar and copy the fla into the folder “flash xml”

files too big, download from:

> **[Create Dynamic XML - Flash communication (working)](https://board.flashkit.com/board/showthread.php?p=4076930#post4076930)**
>
> Hey everyone! 
>  
> Ive managed to create a working version for flash to load xml as soon as it is changed. 
>  
> The only problem is that it is really draining on the system. And i want to know if there is a better way to approach it. 
>  
> This is how i did...

**Method 2 -**

> Since javascript can communicate with flash, use php to tell javascript when php creates the xml, then javascript will tell flash to load the file. (best solution)

This is an _excellent tutorial_ showing how this is done.

Link  
[http://kb.adobe.com/selfservice/view…nalId=tn\_15683](http://kb.adobe.com/selfservice/viewContent.do?externalId=tn_15683)

google cached link  
[http://209.85.141.104/search?q=cache…ient=firefox-a](http://209.85.141.104/search?q=cache:AlWhBWP-yxwJ:kb.adobe.com/selfservice/viewContent.do%3FexternalId%3Dtn_15683+javascript+to+actionscript&hl=en&ct=clnk&cd=4&gl=nz&client=firefox-a)
