Mike points out that Macromedia has made available an ActionScript class that will parse the XML feed into a DataProviderClass “which makes it pretty easy to use”, quote Mike Chambers.
There is also an example there of how you make sure that you are able to load the XML newsfeed from the Macromedia site, as far as I can tell what he is doing in CFML is a regular redirect from a local domain url to Macromedia’s URL.
Since Macromedia isn’t showing the code for PHP, ASP or Perl – I thought I would show it..
The workaround to be able to access data from domains outside the security constraints of Flash is to redirect to the source data from your local domain. Here are some examples added to the Macromedia example. First the Macromedia example with ColdFusion:
Make a CF file and then point to this local file, to get access to the remote content on the url shown in the source below:
<cflocation url=” http://www.macromedia.com/desdev/resources/macromedia_resources.xml”/>
For PHP:
<?php
header(“location: http://www.macromedia.com/desdev/resources/macromedia_resources.xml”);
?>
ASP:
<%
Response.Redirect (“http://www.macromedia.com/desdev/resources/macromedia_resources.xml”)
%>
Perl:
print “Location: http://www.macromedia.com/desdev/resources/macromedia_resources.xml\n\n”;
Adding JSP and Python since Mike commented on them (I am not going near Pascal (can it even be done in Pascal?) and assembly), a little unsure about these two – so please let me know if this is the wrong way of doing it – or if there are better ways:
JSP:
response.sendRedirect(“http://www.macromedia.com/desdev/resources/macromedia_resources.xml”);
Python:
raise ‘Redirect’,’http://www.macromedia.com/desdev/resources/macromedia_resources.xml’
And if you want to do it with ActionScript in ColdFusion MX, Mike has the solution for that.
Its important to note that most of these scripts will only work if they are executed before any other output of the pages they are in.
thanks jarle. i was hoping someone would post something like this.
i linked it on my weblog:
http://radio.weblogs.com/0106797/2002/05/20.html#a91
thanks again…
so, now we just need examples if jsp, zope, assembly, pascal, ….
; )
Cobol too? ;-D
BTW: For Python (which Zope is built on) I think its something like
raise ‘Redirect’,’http://www.macromedia.com/desdev/resources/macromedia_resources.xml’
Maybe someone that knows Python a little better than me can add something to that? :-)
here is a link to how to do it in ServerSide ActionScript using Flash Remoting.
http://radio.weblogs.com/0106797/categories/examples/2002/05/07.html#a62
hello
I need example for using xml in the flash mx
tanx
have good time & bye
I tried the ASP version and it works great if I go to the page from the browser so the address is:
C:\Inetpub\wwwroot\xmlFeed\macromediaXML.html
but when the address is using http//…. like:
http://server/xmlFeed/macromediaXML.html
it won’t pull anything up. Any idea why this would be?
hey Jarle,
I was using the php script you listed here, and it *sort of* worked. It works on IE 5.1.4 for OS X just fine, but on Mozilla for OS X or IE for Windows 2000 it doesn’t work.
I am not quite sure why, but I’m assuming it has something to do with the fact that Flash 6’s sandbox security must check for headers differently in IE for the mac then it does in other browsers – or maybe IE handles them differently…?
Anyways, I found a script that DOES work cross-platform/cross-browser. It basically reads the entire XML file into an array, and returns the array to Flash. Here’s the script:
Okay, that didn’t work. I’ll email you with the script…
I
how to edit the flash component on flash mx 2004?