Reading and displaying RSS feeds in Flash MX 2004-03-11 - By Merrill, Jason
Back (Darron - your code you posted doesn't seem to work, fyi - but you make some correct points about his code changes.)
Bryan, you changed my code on me man! :) Use this:
#include "XMLtoObject.as" myXML = new XML () myXML.ignoreWhite = 1 myXML.load ('index.xml'); myXML.onLoad = function (success){ if (success) { o = this.toObject (); trace(o.rss.channel.item[5].title) trace(o.rss.attributes.version) } }
So in others words, to get:
"Alien faces and writing found on Mars?"
You would do this:
o.rss.channel.item[6].title;
To get an attribute, like version in your XML file, you would do this:
o.rss.attributes.version
Let me know if you get this working. If you can't I can e-mail a MX 2004 sample file that works with your XML.
Jason Merrill ICF Consulting Government e-Learning Solutions icfconsulting.com
:::>-- --Original Message-- -- :::>From: BRYAN MASON [mailto:BMASON@(protected)] :::>Sent: Thursday, March 11, 2004 12:47 PM :::>To: 'flashnewbie@(protected)' :::>Subject: RE: [Flashnewbie] Reading and displaying RSS feeds :::>in Flash MX :::> :::> :::>Jason, :::> :::>Here is the link to the XML feed that I am trying to work with: :::> :::>http://z.about.com/6/g/paranormal/b/index.xml :::> :::>Bryan :::> :::>-- --Original Message-- -- :::>From: Merrill, Jason [mailto:JMerrill@(protected)] :::>Sent: Thursday, March 11, 2004 12:03 PM :::>To: flashnewbie@(protected) :::>Subject: RE: [Flashnewbie] Reading and displaying RSS feeds :::>in Flash MX :::> :::> :::>:::>The output window says "undefined". What am I doing wrong? :::> :::>Well, "trace(o.Section[1].Content[1])" - that was only an :::>example. I would :::>need to know what your XML file looks like to tell you how :::>you should access :::>the data. Can you post a sample? :::> :::> :::> :::> Jason Merrill :::> ICF Consulting Government e-Learning Solutions :::> icfconsulting.com :::> :::> :::> :::> :::> :::> :::> :::> :::> :::>:::>-- --Original Message-- -- :::>:::>From: BRYAN MASON [mailto:BMASON@(protected)] :::>:::>Sent: Thursday, March 11, 2004 11:31 AM :::>:::>To: 'flashnewbie@(protected)' :::>:::>Subject: RE: [Flashnewbie] Reading and displaying RSS feeds :::>:::>in Flash MX :::>:::> :::>:::> :::>:::>Jason, :::>:::> :::>:::>OK. I need a little help. In my FLA, I have placed the :::>:::>following code on :::>:::>frame 1: :::>:::> :::>:::>#include "XMLtoObject.as" :::>:::>myXML = new XML () :::>:::>myXML.ignoreWhite = 1 :::>:::>myXML.load ('index.xml') :::>:::>myXML.onLoad = function (success){ :::>:::> if (success) { :::>:::> var o = this.toObject (); :::>:::> } :::>:::>} :::>:::>trace(o.Section[1].Content[1]) :::>:::> :::>:::>The .as file is in the same dir as the FLA. I saved the XML :::>:::>that I got from :::>:::>the web to a file in the same dir as the FLA for testing :::>:::>purposes. Also, I :::>:::>added a "var" right in front of the "o =". Is that correct? :::>:::> :::>:::>The output window says "undefined". What am I doing wrong? :::>:::> :::>:::>TIA :::>:::> :::>:::>Bryan :::>:::> :::>:::>-- --Original Message-- -- :::>:::>From: Merrill, Jason [mailto:JMerrill@(protected)] :::>:::>Sent: Wednesday, March 10, 2004 3:35 PM :::>:::>To: flashnewbie@(protected) :::>:::>Subject: RE: [Flashnewbie] Reading and displaying RSS feeds :::>:::>in Flash MX :::>:::> :::>:::> :::>:::>If you need help getting the XMLtoObject.as class up and :::>:::>running with your :::>:::>XML file, gimme a holler. :::>:::> :::>:::> Jason Merrill :::>:::> ICF Consulting Government e-Learning Solutions :::>:::> icfconsulting.com :::>:::> :::>:::> :::>:::> :::>:::> :::>:::> :::>:::> :::>:::> :::>:::> :::>:::> :::>:::>:::>-- --Original Message-- -- :::>:::>:::>From: BRYAN MASON [mailto:BMASON@(protected)] :::>:::>:::>Sent: Wednesday, March 10, 2004 3:16 PM :::>:::>:::>To: 'flashnewbie@(protected)' :::>:::>:::>Subject: RE: [Flashnewbie] Reading and displaying RSS feeds :::>:::>:::>in Flash MX :::>:::>:::> :::>:::>:::> :::>:::>:::>I will definitely check it out. I agree that once the class :::>:::>:::>is implemented, :::>:::>:::>it is much more flexible and straightforward. Jessie was :::>:::>:::>doing it the other :::>:::>:::>way so that I could see the nuts and bolts of it all. :::>:::>:::> :::>:::>:::>Bryan :::>:::>:::> :::>:::>:::>-- --Original Message-- -- :::>:::>:::>From: Merrill, Jason [mailto:JMerrill@(protected)] :::>:::>:::>Sent: Wednesday, March 10, 2004 3:11 PM :::>:::>:::>To: flashnewbie@(protected) :::>:::>:::>Subject: RE: [Flashnewbie] Reading and displaying RSS feeds :::>:::>:::>in Flash MX :::>:::>:::> :::>:::>:::> :::>:::>:::>This is the reason I use classes like the link I posted :::>:::>earlier. It :::>:::>:::>automatically creates arrays and objects for each node :::>:::>:::>item, so your XML :::>:::>:::>file can be structured however you want, and its easy to :::>:::>:::>access text values :::>:::>:::>and attributes. If there is only one node at a particular :::>:::>:::>level, it remains :::>:::>:::>a string. If there is more than one, it creates an array :::>:::>:::>for each node and :::>:::>:::>so on down the file. Really, if you have time, give it a :::>:::>:::>shot. It makes it :::>:::>:::>so easy to traverse the XML file, I don't bother :::>:::>hardcoding XML node :::>:::>:::>references anymore. Just my thoughts, as its saved me a :::>:::>:::>lot of headaches. :::>:::>:::> :::>:::>:::> :::>:::>:::> Jason Merrill :::>:::>:::> ICF Consulting Government e-Learning Solutions :::>:::>:::> icfconsulting.com :::>:::>:::> :::>:::>:::> :::>:::>:::> :::>:::>:::> :::>:::>:::> :::>:::>:::> :::>:::>:::> :::>:::>:::> :::>:::>:::> The :::>:::>:::>:::>real thing that I :::>:::>:::>:::>want to get from this are the individual item :::>nodes. If I :::>:::>:::>:::>understand your :::>:::>:::>:::>code correctly, it assumes that there is only :::>one item node :::>:::>:::>:::>with a title, :::>:::>:::>:::>link and description. I think that I misled you when I :::>:::>:::>:::>posted the XML :::>:::>:::>:::>structure earlier. If that is the case, I apologize. :::>:::>:::>:::> :::>:::>:::>NOTICE: :::>:::>:::>This message is for the designated recipient only and may :::>:::>:::>contain privileged :::>:::>:::>or confidential information. If you have received it in :::>:::>:::>error, please notify :::>:::>:::>the sender immediately and delete the original. Any other :::>:::>:::>use of this e-mail :::>:::>:::>by you is prohibited. :::>:::>:::> :::>:::>:::>-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- -- :::>:::>:::>-- ------ :::>:::>:::>Supported by Fig Leaf Software :::>:::>:::>-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- -- :::>:::>:::>-- ------ :::>:::>:::>Lower Prices for Certified Training! Check out new :::>:::>lower prices for :::>:::>:::>Certified Macromedia Training from Fig Leaf Software. :::>:::>Expand your :::>:::>:::>skill set with courses in ColdFusion, Flash, Rich Internet :::>:::>:::>Applications and .NET in the new year. Fig Leaf :::>:::>Software provides :::>:::>:::>the highest caliber instruction at our training centers in :::>:::>:::>Washington :::>:::>:::>D.C., Atlanta, Chicago, Baltimore, Northern Virginia, :::>:::>or on-site at :::>:::>:::>your location. :::>:::>:::> :::>:::>:::>Get the details at http://training.figleaf.com/ :::>:::>:::>-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- -- :::>:::>:::>-- ---- -- :::>:::>:::>To unsubscribe, e-mail: :::>:::>:::>flashnewbie-unsubscribe@(protected) :::>:::>:::>For additional commands, e-mail: :::>:::>:::>flashnewbie-help@(protected) :::>:::>:::> :::>:::>:::> :::>:::>:::>-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- -- :::>:::>:::>-- ------ :::>:::>:::>Supported by Fig Leaf Software :::>:::>:::>-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- -- :::>:::>:::>-- ------ :::>:::>:::>Lower Prices for Certified Training! Check out new :::>:::>lower prices for :::>:::>:::>Certified Macromedia Training from Fig Leaf Software. :::>:::>Expand your :::>:::>:::>skill set with courses in ColdFusion, Flash, Rich Internet :::>:::>:::>Applications and .NET in the new year. Fig Leaf :::>:::>Software provides :::>:::>:::>the highest caliber instruction at our training centers in :::>:::>:::>Washington :::>:::>:::>D.C., Atlanta, Chicago, Baltimore, Northern Virginia, :::>:::>or on-site at :::>:::>:::>your location. :::>:::>:::> :::>:::>:::>Get the details at http://training.figleaf.com/ :::>:::>:::>-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- -- :::>:::>:::>-- ---- -- :::>:::>:::>To unsubscribe, e-mail: :::>:::>:::>flashnewbie-unsubscribe@(protected) :::>:::>:::>For additional commands, e-mail: :::>:::>:::>flashnewbie-help@(protected) :::>:::>:::> :::>:::>:::> :::>:::>:::> :::>:::> :::>:::>-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- -- :::>:::>-- ------ :::>:::>Supported by Fig Leaf Software :::>:::>-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- -- :::>:::>-- ------ :::>:::>Lower Prices for Certified Training! Check out new :::>lower prices for :::>:::>Certified Macromedia Training from Fig Leaf Software. :::>Expand your :::>:::>skill set with courses in ColdFusion, Flash, Rich Internet :::>:::>Applications and .NET in the new year. Fig Leaf :::>Software provides :::>:::>the highest caliber instruction at our training centers in :::>:::>Washington :::>:::>D.C., Atlanta, Chicago, Baltimore, Northern Virginia, :::>or on-site at :::>:::>your location. :::>:::> :::>:::>Get the details at http://training.figleaf.com/ :::>:::>-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- -- :::>:::>-- ---- -- :::>:::>To unsubscribe, e-mail: :::>:::>flashnewbie-unsubscribe@(protected) :::>:::>For additional commands, e-mail: :::>:::>flashnewbie-help@(protected) :::>:::> :::>:::> :::>:::>-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- -- :::>:::>-- ------ :::>:::>Supported by Fig Leaf Software :::>:::>-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- -- :::>:::>-- ------ :::>:::>Lower Prices for Certified Training! Check out new :::>lower prices for :::>:::>Certified Macromedia Training from Fig Leaf Software. :::>Expand your :::>:::>skill set with courses in ColdFusion, Flash, Rich Internet :::>:::>Applications and .NET in the new year. Fig Leaf :::>Software provides :::>:::>the highest caliber instruction at our training centers in :::>:::>Washington :::>:::>D.C., Atlanta, Chicago, Baltimore, Northern Virginia, :::>or on-site at :::>:::>your location. :::>:::> :::>:::>Get the details at http://training.figleaf.com/ :::>:::>-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- -- :::>:::>-- ---- -- :::>:::>To unsubscribe, e-mail: :::>:::>flashnewbie-unsubscribe@(protected) :::>:::>For additional commands, e-mail: :::>:::>flashnewbie-help@(protected) :::>:::> :::>:::> :::>:::> :::> :::>-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- -- :::>-- ------ :::>Supported by Fig Leaf Software :::>-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- -- :::>-- ------ :::>Lower Prices for Certified Training! Check out new lower prices for :::>Certified Macromedia Training from Fig Leaf Software. Expand your :::>skill set with courses in ColdFusion, Flash, Rich Internet :::>Applications and .NET in the new year. Fig Leaf Software provides :::>the highest caliber instruction at our training centers in :::>Washington :::>D.C., Atlanta, Chicago, Baltimore, Northern Virginia, or on-site at :::>your location. :::> :::>Get the details at http://training.figleaf.com/ :::>-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- -- :::>-- ---- -- :::>To unsubscribe, e-mail: :::>flashnewbie-unsubscribe@(protected) :::>For additional commands, e-mail: :::>flashnewbie-help@(protected) :::> :::> :::>-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- -- :::>-- ------ :::>Supported by Fig Leaf Software :::>-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- -- :::>-- ------ :::>Lower Prices for Certified Training! Check out new lower prices for :::>Certified Macromedia Training from Fig Leaf Software. Expand your :::>skill set with courses in ColdFusion, Flash, Rich Internet :::>Applications and .NET in the new year. Fig Leaf Software provides :::>the highest caliber instruction at our training centers in :::>Washington :::>D.C., Atlanta, Chicago, Baltimore, Northern Virginia, or on-site at :::>your location. :::> :::>Get the details at http://training.figleaf.com/ :::>-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- -- :::>-- ---- -- :::>To unsubscribe, e-mail: :::>flashnewbie-unsubscribe@(protected) :::>For additional commands, e-mail: :::>flashnewbie-help@(protected) :::> :::> :::>
-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ------ Supported by Fig Leaf Software -- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ------ Lower Prices for Certified Training! Check out new lower prices for Certified Macromedia Training from Fig Leaf Software. Expand your skill set with courses in ColdFusion, Flash, Rich Internet Applications and .NET in the new year. Fig Leaf Software provides the highest caliber instruction at our training centers in Washington D.C., Atlanta, Chicago, Baltimore, Northern Virginia, or on-site at your location.
Get the details at http://training.figleaf.com/ -- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- -- To unsubscribe, e-mail: flashnewbie-unsubscribe@(protected) For additional commands, e-mail: flashnewbie-help@(protected)
|
|