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-11       - By Darron J. Schall

 Back
Reply:     <<     11     12     13     14     15     16     17  

> 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?

You have two errors that I can see...

1) You're encountering problems by using the "var" keyword.  The var keyword
tells Flash to define the variable as a local variable.  Because of this,
the "o" variable exits in the the mxXML, and not on the timeline where you
code is.

2)  You're calling the trace before the xml data is actually loaded.

Rewrite your code to look like this:

#include "XMLtoObject.as"
myXml = new XML ();
mxXml.owner = this; // gives the xml object a refernece to the current
timeline
myXml.ignoreWhite = 1
myXml.onLoad = function (success){
   if (success) {
       this.owner.o = this.toObject ();
   }
   trace(this.owner.o.Section[1].Content[1]);

   // clean up some memory by removing the unneed xml object -
   // note that o will still exist since it exists in the owner
   delete this;
}
myXml.load ("index.xml");

That should do it for you..

-d



-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ------
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)