// // USING ONLOAD //
Loading XML Into Flash http://www.kirupa.com/web/xml/XMLwithFlash3.htm BadassXML http://www.mosessupposes.com/utilities/index.html This is very odd, but... if you want to replace xml with another xml: my_xml = new XML(); function loadXML1 (){ my_xml = new XML(); my_xml.onLoad = loadXML1_loaded; my_xml.load("data1.xml"); } function loadXML2 (){ my_xml = new XML(); my_xml.onLoad = loadXML2_loaded; my_xml.load("data2.xml"); } function loadXML1_loaded ( success ){ { if (success)trace(this); } function loadXML2_loaded ( success ) { if (success)trace(this); } // // USING XPATH // But maybe you want to load a single xml and query parts of it - enter XPath. Using XPath http://www.informit.com/articles/article.asp?p=169633&rl=1 XPath by xfactor http://www.xfactorstudio.com/ // // USING XML2OBJECT // XML2Object http://www.sephiroth.it/file_detail.php?id=129 I think Attila is right in saying you need to not worry about changing the xml, but rather how you use the data. In order for you to do that, you need to convert ( parse ) the xml into a useable object. Then get the information you need from that object. Start by making an object that is like the xml; obj = { concept: [ {path: "images/a1.jpg", br:413, ho:550, thumbpath:"thumbnails/a1.jpg", thumbwidth:56,thumbheight:75 }, {path: "images/vue.jpg", br:550, ho:309, thumbpath:"thumbnails/vue.jpg", thumbwidth:56,thumbheight:75 } ], details: [ {path: "images/a1.jpg", br:413, ho:550, thumbpath:"thumbnails/a1.jpg", thumbwidth:56,thumbheight:75 }, {path: "images/a2.jpg", br:550, ho:413, thumbpath:"thumbnails/a2.jpg", thumbwidth:56,thumbheight:75 } ] } Then access parts of your information when needed; var array = obj.concept; for ( var i = 0; i < array.length; i++ ){ var thumbData = array [i]; var path = thumbData.path; trace( 'concept path: ' + path ); } var array = obj.details; for ( var i = 0; i < array.length; i++ ){ var thumbData = array [i]; var path = thumbData.path; trace( 'details path: ' + path ); } Once you get your thumbnails working, you can go back to the xml and work on parsing it into that object above. You can try your own parser, or the handy XML2Object - everything after this is just logic. _____________________________ Jesse Graupmann www.jessegraupmann.com www.justgooddesign.com/blog/ _____________________________ -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of ben deroo Sent: Saturday, June 09, 2007 11:10 AM To: flashcoders@chattyfig.figleaf.com Subject: Re: [Flashcoders] another stupid XML question let me rephrase the question then: when I click a button, i want xml1.xml to be loaded when I click another button, i want xml1.xml to be replaced with xml2.xml thx Ben On 6/9/07, Rákos Attila <[EMAIL PROTECTED]> wrote: > > > You are the only one who may know how to remove the thumbnails from > the stage, since you are the only one who knows how did you created > them, stored their references, etc. Your question is totally > independent of XML, it's a matter of basic scripting and movieclip > handling. > > Attila > > bd> hi, > bd> small sample: > bd> <ankematheve> > bd> <concept> > bd> <image path="images/a1.jpg" br="413" ho="550" thumbpath= > bd> "thumbnails/a1.jpg" thumbwidth="56" thumbheight="75"></image> > bd> <image path="images/vue.jpg" br="550" ho="309" thumbpath= > bd> "thumbnails/vue.jpg" thumbwidth="56" thumbheight="75"></image> > bd> </concept> > bd> <details> > bd> <image path="images/a1.jpg" br="413" ho="550" thumbpath= > bd> "thumbnails/a1.jpg" thumbwidth="56" thumbheight="75"></image> > bd> <image path="images/a2.jpg" br="550" ho="413" thumbpath= > bd> "thumbnails/a2.jpg" thumbwidth="56" thumbheight="75"></image> > bd> </details> > bd> </ankematheve> > bd> > bd> > bd> > bd> I'd like to be able to load and /or replace sections of this xml file. > bd> > bd> meaning: > bd> when I click a button on stage, i'd like thumbnails(that code has > allready > bd> been done) to appear from the <concept> node. > bd> when I click another button on stage, i'd like that content to be > removed > bd> (deleted from the stage, but not from the xml file ofcourse) and be > replaced > bd> by content from the <details> node. > bd> > bd> yup, I feel stupid, but that's ok! > bd> > bd> Ben _______________________________________________ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com