Mailing List
Home
Forum Home
Flash Pro
Subjects
Subject: RE: Firework Effect
Web Service Results
Flash Interface with 10mb xml file
AW: [Flashcoders] Switch/Case vs If/else
AW: [Flashcoders] Switch/Case vs If/else
Flash MX 2004 Sucks
Reading and displaying RSS feeds in Flash MX
Flash and QuickTime VR
Textfield prototype question
XML to Object help
Order of events per frame
MX2004 Dataset itemClassName
memory management removeMovieClip /
Event Dispatcher between classes
Help: MX 2004 How to script a print button to print the entire sli
ScrollPane component doesn 't auto update
setInterval bug identified and fixed
setInterval bug identified and fixed
Listener Object 's best practice
 
Reading and displaying RSS feeds in Flash MX

Reading and displaying RSS feeds in Flash MX

2004-03-10       - By BRYAN MASON

 Back
Reply:     1     2     3     4     5     6     7     8     9     10     >>  

Yup. Got it, thanks!

-- --Original Message-- --
From: Merrill, Jason [mailto:JMerrill@(protected)]
Sent: Wednesday, March 10, 2004 4:33 PM
To: flashnewbie@(protected)
Subject: RE: [Flashnewbie] Reading and displaying RSS feeds in Flash MX


For some reason, the first slash is missing in that code I posted.  First
line should be:  

/**

not:

**

But you probably figured that.  (....And you probably know you don't need
the comments section anyway - I just like to give people credit and keep
track of where I got the code from. Obviously the code starts with the line:

XML.prototype.toObject = function(input_xml)  

)

  Jason Merrill
  ICF Consulting Government e-Learning Solutions
  icfconsulting.com









:::>-- --Original Message-- --
:::>From: BRYAN MASON [mailto:BMASON@(protected)]
:::>Sent: Wednesday, March 10, 2004 4:14 PM
:::>To: 'flashnewbie@(protected)'
:::>Subject: RE: [Flashnewbie] Reading and displaying RSS feeds
:::>in Flash MX
:::>
:::>
:::>Thanks, Jason! I had not yet started on this, so no harm
:::>done. Now I know
:::>that I have the correct code. I'm going to have fun with
:::>this tomorrow. :)
:::>
:::>Bryan
:::>
:::>-- --Original Message-- --
:::>From: Merrill, Jason [mailto:JMerrill@(protected)]
:::>Sent: Wednesday, March 10, 2004 3:59 PM
:::>To: flashnewbie@(protected)
:::>Subject: RE: [Flashnewbie] Reading and displaying RSS feeds
:::>in Flash MX
:::>
:::>
:::>Dang-nabbit! I might have posted the wrong link to the
:::>class.  Here is the
:::>one I'm using.  Just post this into notepad and save as .as
:::>
:::>**
:::>* Filename: XMLtoObject.as
:::>*
:::>* converts XML nodes into hierarchical objects.
:::>*
:::>*
:::>* @(protected)     $Author: Michelangelo Capraro
:::>(michelangelo@(protected)) $
:::>* @(protected)     $Revision: 1.0 $
:::>*
:::>*/
:::>
:::>
:::>/**
:::>*   Converts the XML to an object needed for the modules
:::>*
:::>*/
:::>XML.prototype.toObject = function(input_xml)
:::>{
:::>   if (input_xml == null) {
:::>     input_xml = this;
:::>   }
:::>  
:::>   // make an empty object to attach properties and other
:::>objects to
:::>   var returnObj = new Object();
:::>   var tempObj = new Object();
:::>
:::>   // loop throught the child nodes of the returned xml...
:::>   for (var nodeIndex = 0; nodeIndex < input_xml.childNodes.length;
:::>nodeIndex++) {
:::>     var currentNode = input_xml.childNodes[nodeIndex];
:::>    
:::>     // for text nodes.....
:::>     if (!(currentNode.firstChild.nodeValue == null &&
:::>currentNode.hasChildNodes())) {
:::>       // anything thats not another nest of
:::>nodes, just
:::>make properties from them
:::>       // creating a String object lets us add
:::>properties
:::>to it later
:::>       var tempNode = new
:::>String(currentNode.firstChild.nodeValue);
:::>            
:::>       if (returnObj[currentNode.nodeName] == null) {
:::>         returnObj[currentNode.nodeName]
:::>= tempNode;
:::>        
:::>         // this is used for attaching attributes
:::>later
:::>         tempObj =
:::>returnObj[currentNode.nodeName];
:::>       } else {
:::>         // make an array if it doesn't
:::>exist already
:::>         if
:::>(returnObj[currentNode.nodeName][0] ==
:::>null) {
:::>           var tempObj =
:::>returnObj[currentNode.nodeName];
:::>          
:::>returnObj[currentNode.nodeName] =
:::>new Array();
:::>          
:::>returnObj[currentNode.nodeName][0] =
:::>tempObj;
:::>         }
:::>  
:::>returnObj[currentNode.nodeName].push(tempNode);
:::>        
:::>         // this is used for attaching attributes
:::>later
:::>         tempObj =
:::>returnObj[currentNode.nodeName][returnObj[currentNode.nodeNa
:::>me].length - 1];
:::>       }  
:::>
:::>     } else {
:::>
:::>       // this is another nested object....
:::>       // if an object of this name doesnt exists...
:::>       if (returnObj[currentNode.nodeName] == null) {
:::>         returnObj[currentNode.nodeName] =
:::>this.toObject(currentNode);
:::>        
:::>         // this is used for attaching attributes
:::>later
:::>         tempObj =
:::>returnObj[currentNode.nodeName];
:::>       } else {
:::>         // make an array if it doesn't
:::>exist already
:::>         if
:::>(returnObj[currentNode.nodeName][0] ==
:::>null) {
:::>           var tempObj =
:::>returnObj[currentNode.nodeName];
:::>          
:::>returnObj[currentNode.nodeName] =
:::>new Array();
:::>          
:::>returnObj[currentNode.nodeName][0] =
:::>tempObj;
:::>         }
:::>  
:::>returnObj[currentNode.nodeName].push(this.toObject(currentNode));
:::>        
:::>         // this is used for attaching attributes
:::>later
:::>         tempObj =
:::>returnObj[currentNode.nodeName][returnObj[currentNode.nodeNa
:::>me].length - 1];
:::>       }  
:::>
:::>     }
:::>    
:::>     tempObj.attributes = new Object();
:::>    
:::>     var attributeCounter = 0;
:::>     for (var a in currentNode.attributes) {
:::>       attributeCounter++
:::>       tempObj.attributes[a] =
:::>currentNode.attributes[a];
:::>     }
:::>     if (attributeCounter == 0) {
:::>       tempObj.attributes = null;
:::>     }
:::>      
:::>   }
:::>
:::>   // return the new object
:::>   return returnObj;
:::>
:::>}
:::>
:::>//end of code
:::>
:::>
:::>   Jason Merrill
:::>   ICF Consulting Government e-Learning Solutions
:::>   icfconsulting.com
:::>
:::>
:::>
:::>
:::>
:::>
:::>
:::>
:::>
:::>:::>-- --Original Message-- --
:::>:::>From: Merrill, Jason
:::>:::>Sent: Wednesday, March 10, 2004 3:45 PM
:::>:::>To: flashnewbie@(protected)
:::>:::>Subject: RE: [Flashnewbie] Reading and displaying RSS feeds
:::>:::>in Flash MX
:::>:::>
:::>:::>
:::>:::>Yup.  Exactly.  You can then put it in a folder like
:::>:::>"classes" next to the .swf file calling it, or just put it
:::>:::>next to the file - however you want.  Its just for
:::>:::>authoring.  You won't need to file once you publish as its
:::>:::>included in the .swf when you publish.  
:::>:::>
:::>:::>i.e. I have mine a few levels down from the .swf, like this:
:::>:::>
:::>:::>#include "../../classes/XMLtoObject.as"
:::>:::>
:::>:::>I just like it organized that way, but if the .as file is
:::>:::>right next to your .swf, just do this:
:::>:::>
:::>:::>#include "XMLtoObject.as"
:::>:::>
:::>:::>   Jason Merrill
:::>:::>   ICF Consulting Government e-Learning Solutions
:::>:::>   icfconsulting.com
:::>:::>
:::>:::>
:::>:::>
:::>:::>
:::>:::>
:::>:::>
:::>:::>
:::>:::>
:::>:::>
:::>:::>:::>-- --Original Message-- --
:::>:::>:::>From: BRYAN MASON [mailto:BMASON@(protected)]
:::>:::>:::>Sent: Wednesday, March 10, 2004 3:31 PM
:::>:::>:::>To: 'flashnewbie@(protected)'
:::>:::>:::>Subject: RE: [Flashnewbie] Reading and displaying RSS feeds
:::>:::>:::>in Flash MX
:::>:::>:::>
:::>:::>:::>
:::>:::>:::>Jason,
:::>:::>:::>
:::>:::>:::>OK, I am ready to strike off in the direction of using a
:::>:::>:::>class. Basically, I
:::>:::>:::>copy the code that's listed at that URL and create an .as
:::>:::>:::>file? Can I simply
:::>:::>:::>paste into notepad and save with the extension  .as?
:::>:::>:::>
:::>:::>:::>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)