Flash MX ActionScript class for the Macromedia XML Newsfeed
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...
Posted by: Mike Chambers - kl: 17:43, 20 May, 2002 - #60so, now we just need examples if jsp, zope, assembly, pascal, ....
; )
Posted by: Mike Chambers - kl: 17:43, 20 May, 2002 - #61Cobol 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? :-)
Posted by: Jarle - kl: 17:47, 20 May, 2002 - #62here 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
Posted by: Mike Chambers - kl: 21:14, 20 May, 2002 - #65hello
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?
Posted by: Mark - kl: 18:03, 11 February, 2003 - #561hey 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:
Posted by: michael e. gunn - kl: 03:02, 24 March, 2003 - #685Okay, that didn't work. I'll email you with the script...
Posted by: michael e. gunn - kl: 03:03, 24 March, 2003 - #686I´ve been looking at http://www.hitormiss.org/projects/blogger_xml/ , trying to build an .swf that will read from my Blogger blog. -- Any idea on how to do this? from the link above it seems I can get the XML template; now i´m just searching for a .fla that will actually read from it. I found here (http://www.samuelwan.com/mainmenu.swf) something that seems close, but not quite there yet. any ideas welcome!!!
Posted by: Marco A. Morales - kl: 19:34, 12 May, 2003 - #877how to edit the flash component on flash mx 2004?
Posted by: tommy - kl: 01:32, 06 November, 2003 - #1350