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.

10 thoughts on “Flash MX ActionScript class for the Macromedia XML Newsfeed”

  1. 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? :-)

  2. 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:

Comments are closed.

Scroll to Top