| Note:
Once the Resource Menu Component is installed, a help file for the component is
available in Macromedia Flash MX (Window > Resource Menu Help). To use the
ActionScript object, place a copy of the FResourceFeed.as
file in the same directory as the FLA file that the object will be used in. Then
include the AS file in the code for the FLA as shown below. Here is an example
of the ActionScript code necessary to load the Macromedia XML Resource feed and
then display it in the Resource Menu Component: #include
"FResourceFeed.as" var rf = new FResourceFeed(); rf.onXML
= function() { rMenu.setDataProvider(this.getDataProvider());
} rf.load("http://www.macromedia.com/devnet/resources/macromedia_resources.xml");
rMenu is an instance of the component
in the movie, and FResourceFeed is the ActionScript
object (which you can download above) to load the XML Feed.
Since a Macromedia
Flash movie running in a web browser cannot load data from a domain outside its
own, some middleware is required to pass the XML to the SWF. The SWF file could
then load the XML from the middleware and not from the Macromedia domain. The
middleware retrieves the XML from Macromedia website and returns it to the SWF. Here
is an example of the code: #include "FResourceFeed.as"
var rf = new FResourceFeed(); rf.onXML = function() { rMenu.setDataProvider(this.getDataProvider());
} rf.load("xml_feed_proxy.cfm");
xml_feed_proxy.cfm
is a very simple ColdFusion page which is included in the download and has the
following code:
<cflocation url=" http://www.macromedia.com/devnet/resources/macromedia_resources.xml"/>
Pretty
simple. Of course, the same technique could be used with Java, JSP, ASP, PHP,
or just about any other middleware language. To see live examples of the
Macromedia XML Resource feed in action, check out this week's Logged
In article. For more information about the XML feed itself, see Macromedia
Developer Center XML Resource feed. |