XML to Object help 2004-03-03 - By Merrill, Jason
Back Ah - I see the light now. THanks!
Jason Merrill ICF Consulting Government e-Learning Solutions icfconsulting.com
:::>-- --Original Message-- -- :::>From: Darron J. Schall [mailto:darron@(protected)] :::>Sent: Wednesday, March 03, 2004 12:17 PM :::>To: flashnewbie@(protected) :::>Subject: Re: [Flashnewbie] XML to Object help :::> :::> :::>The attributes are stored in a attribues object after being :::>converted from :::>the XML document. :::> :::>#include "XMLtoObject.as" :::>x = new XML () :::>x.ignoreWhite = true; // this is essential! :::>x.load ("m1Exam.xml") :::>x.onLoad = function (){ :::> pxml = this.toObject (); :::> :::> trace(pxml.moduleExam.question[0].attributes.ID); :::> delete x; :::>} :::> :::>Again, Use Debug -> List Variables to see everything in the :::>object. It's :::>really handy for debugging, and will save you time as you :::>can quickly find :::>what you're looking for. That's all I did here! :::> :::>-d :::> :::>-- -- Original Message -- -- :::>From: "Merrill, Jason" <JMerrill@(protected)> :::>To: <flashnewbie@(protected)> :::>Sent: Wednesday, March 03, 2004 12:08 PM :::>Subject: RE: [Flashnewbie] XML to Object help :::> :::> :::>You're right! Thanks Darron. They documented it wrong! I :::>was using their :::>trace example. I should have known better. :::> :::>OK, so now, a follow up problem. I'm trying to get the :::>attribute of the :::>question node. Based on my XML, can you see what I'm doing :::>wrong? Here is :::>the revised code: :::> :::>#include "XMLtoObject.as" :::>x = new XML () :::>x.ignoreWhite = 1 // this is essential! :::>x.load ('m1Exam.xml') :::>x.onLoad = function (){ :::> pxml = this.toObject (); :::>trace (pxml) // returns [object Object] as expected :::>trace (pxml.moduleExam.question[0].ID) // returns undefined :::>trace (pxml.moduleExam.question[1].ID) // returns undefined :::>trace (pxml.moduleExam.question[0].statement) // returns 0. :::>Identify the... :::>as expected :::>trace (pxml.moduleExam.question[1].statement) // returns 1. It is :::>unnecessary to ... as expected :::>delete(x); :::>} :::> :::> Jason Merrill :::> ICF Consulting Government e-Learning Solutions :::> icfconsulting.com :::> :::> :::> :::> :::> :::> :::> :::> :::> :::>:::>-- --Original Message-- -- :::>:::>From: Darron J. Schall [mailto:darron@(protected)] :::>:::>Sent: Wednesday, March 03, 2004 11:52 AM :::>:::>To: flashnewbie@(protected) :::>:::>Subject: Re: [Flashnewbie] XML to Object help :::>:::> :::>:::> :::>:::>Don't kick yourself too hard for this one: :::>:::> :::>:::>The XML load is asynchronous, so you get a callback :::>when the load is :::>:::>complete. You need to put your trace statements in the :::>:::>onLoad so that pxml :::>:::>can be created before you try and see what's in it. :::>:::> :::>:::>x.onLoad = function (){ :::>:::> pxml = this.toObject (); :::>:::> trace (pxml); :::>:::> // etc; :::>:::> :::>:::> // Also, be sure to delete the xml object to save memory :::>:::> delete x; :::>:::>} :::>:::> :::>:::> :::>:::>Then, go to Debug -> List Variables in the IDE when you :::>:::>test the movie to :::>:::>see what the object structure looks like. That will help :::>:::>you determine the :::>:::>path to what you're looking for. :::>:::> :::>:::>-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) :::>:::> :::>:::> :::>:::> :::>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)
|
|