Re: [Flashcoders] XML Question
You would do xml..product.(@prodCode == id); Yep, that simple. Taka On Thu, Nov 4, 2010 at 11:17 AM, Matt S. mattsp...@gmail.com wrote: I know this is easy, but I'm having trouble finding the answer: if I'm iterating through XML like so: return xml.category.(@name == cat[0]).subcategory.subcategory2.(@name == cat[1]).product.(@prodCode == String(id)); where cat is an array, eg cat = [men,shirts] but what I want to do is search the ENTIRE XML for the first occurrence, in any category/subcategory, of a @prodCode that matches id, how would I do that? eg,I want to do something like return xml.category.*.subcategory.subcategory2.*.product.(@prodCode == String(id)); but that's obviously not the actual code. Does anyone have any suggestions? Thanks! .m ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] XML Question
Yep, I knew it was gonna be something dead-simple ;) . Thanks Taka! .m On Thu, Nov 4, 2010 at 2:27 PM, Taka Kojima t...@gigafied.com wrote: You would do xml..product.(@prodCode == id); Yep, that simple. Taka On Thu, Nov 4, 2010 at 11:17 AM, Matt S. mattsp...@gmail.com wrote: I know this is easy, but I'm having trouble finding the answer: if I'm iterating through XML like so: return xml.category.(@name == cat[0]).subcategory.subcategory2.(@name == cat[1]).product.(@prodCode == String(id)); where cat is an array, eg cat = [men,shirts] but what I want to do is search the ENTIRE XML for the first occurrence, in any category/subcategory, of a @prodCode that matches id, how would I do that? eg,I want to do something like return xml.category.*.subcategory.subcategory2.*.product.(@prodCode == String(id)); but that's obviously not the actual code. Does anyone have any suggestions? Thanks! .m ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] XML Question
- Original Message From: Merrill, Jason jason.merr...@bankofamerica.com To: Flash Coders List flashcoders@chattyfig.figleaf.com Sent: Thu, May 6, 2010 11:08:04 AM Subject: RE: [Flashcoders] XML Question Jason Merrill says he sent an earlier reply concerning my question about how to write my switch statement. No, I don't recall seeing it. I just resurrected it with Google, and thank you! This works: Well, THAT's annoying (not your fault though)- do you see this reply? I hope I'm not being filtered because I work for Bank of America - wouldn't be the first time that's happened - I get a lot of e-mails I send lost because people send a lot of phishing spam using our company name. I would assume it was my own fault. John ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] XML Question
i agree with kenneth - swf address forms the basis of my navigation i take the current url from the swfaddress event in my model, pass it through a function to make sure the url exists and then dispatch the page change event to the rest of the application which updates the page view and the navigation a On 5 May 2010 19:28, Kenneth Kawamoto kennethkawam...@gmail.com wrote: If I understood you correctly, you want to filter the XML data according to a variable passed to the SWF. If so you'd do something like: var pageDetails:String = xmlData.PAGE.(@pg_name == loaderInfo.parameters.page).DETAILS; // page is the name of the var passed to the SWF here But I strongly recommend you to have a look at SWFAddress, which is absolutely indispensable framework if you are creating a site driven by dynamic data ;) Kenneth Kawamoto http://www.materiaprima.co.uk/ John Singleton wrote: - Original Message From: kennethkawam...@gmail.com kennethkawam...@gmail.com To: Flash Coders List flashcoders@chattyfig.figleaf.com Sent: Wed, May 5, 2010 12:48:28 PM Subject: Re: [Flashcoders] XML Question Say for example you are in the home section and obtaining the data for it, you'd do: var pageData:XML = xmlData.PAGE.(@pg_name == index)[0]; Then build the page based on pageData XML. k. Now, how can I build a switch statement to determine which page? I plan to pass a var to my swf, then call the data based on the value of the var (in this case, index). As stated previously, my switch statement, for reasons I don't understand, is giving me the value indexcontent; that is, all the values of pg_name: function completeXMLListener(e:Event):void { var xmlData:XML = XML (e.target.data); trace(xmldata.pa...@pg_name.tostring()) switch (xmldata.pa...@pg_name.tostring()) { case index: pageDetails = xmlData.PAGE.DETAILS.toString(); break; case contact: pageDetails = xmlData.PAGE.DETAILS.toString(); break; default: pageDetails = xmlData.PAGE.DETAILS.toString(); trace(pageDetails); break; } MyTextBlock(); } TIA, John ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] XML Question
Jason Merrill says he sent an earlier reply concerning my question about how to write my switch statement. No, I don't recall seeing it. I just resurrected it with Google, and thank you! This works: pageDetails = xmlData.PAGE.(@pg_name == contact).DETAILS.text(); Meanwhile, Kenneth Kawamoto recommends looking at SWFAddress. I am and like what I see. Thanks! John ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] XML Question
Whoops. Now I have this in my XML: DETAILSh3Senior Citizen Discount/h3 bDelta Electric and Construction Co., Inc./b finds its pricing to be fair and reasonable. Their prices are competitive and based on the local market rates. Delta Electric offers a 10% discount to Senior Citizens living in the Virgin Islands. The discount is equal to what we are offering to the Federal government. Senior Citizens are offered this discount because they are no longer working and have a lower income. The discount is only given on residential work performed in the homes of Senior Citizens and they only send a laborer out in that case. Delta Electric takes pride in offering services at affordable prices and feels it is important to give back to the community and respect their elders. /DETAILS This statement: pageDetails = xmlData.PAGE.(@pg_name == index).DETAILS.text(); prints out everything except that which is marked up (h3, b). What do? TIA, John ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] XML Question
http://www.w3schools.com/xml/xml_cdata.asp On 6 May 2010 14:56, John Singleton johnsingleton...@yahoo.com wrote: Whoops. Now I have this in my XML: DETAILSh3Senior Citizen Discount/h3 bDelta Electric and Construction Co., Inc./b finds its pricing to be fair and reasonable. Their prices are competitive and based on the local market rates. Delta Electric offers a 10% discount to Senior Citizens living in the Virgin Islands. The discount is equal to what we are offering to the Federal government. Senior Citizens are offered this discount because they are no longer working and have a lower income. The discount is only given on residential work performed in the homes of Senior Citizens and they only send a laborer out in that case. Delta Electric takes pride in offering services at affordable prices and feels it is important to give back to the community and respect their elders. /DETAILS This statement: pageDetails = xmlData.PAGE.(@pg_name == index).DETAILS.text(); prints out everything except that which is marked up (h3, b). What do? TIA, John ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] XML Question
Wrap your text with XML character data, i.e. DETAILS![CDATA[h3Senior Citizen Discount/h3... ]]/DETAILS -- Kenneth Kawamoto http://www.materiaprima.co.uk/ On 6 May 2010 13:56, John Singleton johnsingleton...@yahoo.com wrote: Whoops. Now I have this in my XML: DETAILSh3Senior Citizen Discount/h3 bDelta Electric and Construction Co., Inc./b finds its pricing to be fair and reasonable. Their prices are competitive and based on the local market rates. Delta Electric offers a 10% discount to Senior Citizens living in the Virgin Islands. The discount is equal to what we are offering to the Federal government. Senior Citizens are offered this discount because they are no longer working and have a lower income. The discount is only given on residential work performed in the homes of Senior Citizens and they only send a laborer out in that case. Delta Electric takes pride in offering services at affordable prices and feels it is important to give back to the community and respect their elders. /DETAILS This statement: pageDetails = xmlData.PAGE.(@pg_name == index).DETAILS.text(); prints out everything except that which is marked up (h3, b). What do? TIA, John ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] XML Question
- Original Message From: kennethkawam...@gmail.com kennethkawam...@gmail.com To: Flash Coders List flashcoders@chattyfig.figleaf.com Sent: Thu, May 6, 2010 9:08:22 AM Subject: Re: [Flashcoders] XML Question Wrap your text with XML character data, i.e. DETAILS![CDATA[h3Senior Citizen Discount/h3... ]]/DETAILS Thank you. John ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
RE: [Flashcoders] XML Question
Jason Merrill says he sent an earlier reply concerning my question about how to write my switch statement. No, I don't recall seeing it. I just resurrected it with Google, and thank you! This works: Well, THAT's annoying (not your fault though)- do you see this reply? I hope I'm not being filtered because I work for Bank of America - wouldn't be the first time that's happened - I get a lot of e-mails I send lost because people send a lot of phishing spam using our company name. Jason Merrill Bank of America Global Learning Learning Performance Solutions Join the Bank of America Flash Platform Community and visit our Instructional Technology Design Blog (note: these are for Bank of America employees only) ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] XML Question
Hi, Your switch uses page_name, but your XML says pg_name. Not sure about the other question at the moment, but it looks like you are repeating your self in the switch statement - if all your pages have DETAILS, do you need to switch? I am guessing you may have pages that differ? HTH a little, Glen On 05/05/2010 13:49, John Singleton wrote: Hi; I have this in an external xml file: PAGE pg_name='index' DETAILSThis is some more of the home page./DETAILS /PAGE My objective is to use a switch statement like this: switch (xmlda...@page_name.tostring()) { case index: pageDetails = xmlData.DETAILS.toString(); case contact: pageDetails = xmlData.DETAILS.toString(); } and pass a var to the swf so I can change the content (DETAILS) of the page based on the same. I know I'm going about this the wrong way, but I don't know how to do it correctly. Also, my switch statement doesn't work anyway. Please advise. TIA, John ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] XML Question
On 05/05/2010 13:49, John Singleton wrote: Hi; I have this in an external xml file: PAGE pg_name='index' DETAILSThis is some more of the home page./DETAILS /PAGE My objective is to use a switch statement like this: switch (xmlda...@page_name.tostring()) { case index: pageDetails = xmlData.DETAILS.toString(); case contact: pageDetails = xmlData.DETAILS.toString(); } and pass a var to the swf so I can change the content (DETAILS) of the page based on the same. I know I'm going about this the wrong way, but I don't know how to do it correctly. Also, my switch statement doesn't work anyway. Please advise. You need attention to detail with XML. Compare your switch variable with the XML.. TIA, John ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] XML Question
i'd also recommend having a root node and an xml type declaration at the start a On 5 May 2010 14:05, Paul Andrews p...@ipauland.com wrote: On 05/05/2010 13:49, John Singleton wrote: Hi; I have this in an external xml file: PAGE pg_name='index' DETAILSThis is some more of the home page./DETAILS /PAGE My objective is to use a switch statement like this: switch (xmlda...@page_name.tostring()) { case index: pageDetails = xmlData.DETAILS.toString(); case contact: pageDetails = xmlData.DETAILS.toString(); } and pass a var to the swf so I can change the content (DETAILS) of the page based on the same. I know I'm going about this the wrong way, but I don't know how to do it correctly. Also, my switch statement doesn't work anyway. Please advise. You need attention to detail with XML. Compare your switch variable with the XML.. TIA, John ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] XML Question
- Original Message From: allandt bik-elliott (thefieldcomic.com) alla...@gmail.com i'd also recommend having a root node and an xml type declaration at the start Right. Ok, here's my revised code: ?xml version=1.0? SITE PAGE pg_name='index' DETAILSThis is some more of the home page./DETAILS /PAGE PAGE pg_name='contact' DETAILSThis is some more of the contact page./DETAILS /PAGE /SITE function completeXMLListener(e:Event):void { var xmlData:XML = XML (e.target.data); trace(xmldata.pa...@pg_name.tostring()) switch (xmldata.pa...@pg_name.tostring()) { case index: pageDetails = xmlData.PAGE.DETAILS.toString(); case contact: pageDetails = xmlData.PAGE.DETAILS.toString(); default: pageDetails = xmlData.PAGE.DETAILS.toString(); trace(pageDetails); } MyTextBlock(); } The first trace nicely prints out what I would expect (I think, should have been on two lines): indexcontact The second trace also prints: DETAILSThis is some more of the home page./DETAILS DETAILSThis is some more of the contact page./DETAILS indicating, of course, that the default is firing. Why? TIA, John ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] XML Question
You forgot your break; statements, sir. On Wed, May 5, 2010 at 11:12 AM, John Singleton johnsingleton...@yahoo.comwrote: - Original Message From: allandt bik-elliott (thefieldcomic.com) alla...@gmail.com i'd also recommend having a root node and an xml type declaration at the start Right. Ok, here's my revised code: ?xml version=1.0? SITE PAGE pg_name='index' DETAILSThis is some more of the home page./DETAILS /PAGE PAGE pg_name='contact' DETAILSThis is some more of the contact page./DETAILS /PAGE /SITE function completeXMLListener(e:Event):void { var xmlData:XML = XML (e.target.data); trace(xmldata.pa...@pg_name.tostring()) switch (xmldata.pa...@pg_name.tostring()) { case index: pageDetails = xmlData.PAGE.DETAILS.toString(); case contact: pageDetails = xmlData.PAGE.DETAILS.toString(); default: pageDetails = xmlData.PAGE.DETAILS.toString(); trace(pageDetails); } MyTextBlock(); } The first trace nicely prints out what I would expect (I think, should have been on two lines): indexcontact The second trace also prints: DETAILSThis is some more of the home page./DETAILS DETAILSThis is some more of the contact page./DETAILS indicating, of course, that the default is firing. Why? TIA, John ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders -- -jonathan howe ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
RE: [Flashcoders] XML Question
Your switch statement doesn't work because it should look like this instead: PAGE pg_name='index' DETAILSThis is some more of the home page./DETAILS /PAGE switch (xmldata.pa...@pg_name) { case index: pageDetails = xmlData.DETAILS.toString(); break; case contact: pageDetails = xmlData.DETAILS.toString(); break; } That said, the line: pageDetails = xmlData.DETAILS.toString(); is repeated over and over in your switch, which is pointless. Instead of a switch statement, use E4X syntax in XML to get the right data - something like this: pageDetails = xmlData.PAGE.(@pg_name == someValue).DETAILS.text(); Jason Merrill Bank of America Global Learning Learning Performance Solutions Join the Bank of America Flash Platform Community and visit our Instructional Technology Design Blog (note: these are for Bank of America employees only) -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of John Singleton Sent: Wednesday, May 05, 2010 8:49 AM To: flashcoders@chattyfig.figleaf.com Subject: [Flashcoders] XML Question Hi; I have this in an external xml file: PAGE pg_name='index' DETAILSThis is some more of the home page./DETAILS /PAGE My objective is to use a switch statement like this: switch (xmlda...@page_name.tostring()) { case index: pageDetails = xmlData.DETAILS.toString(); case contact: pageDetails = xmlData.DETAILS.toString(); } and pass a var to the swf so I can change the content (DETAILS) of the page based on the same. I know I'm going about this the wrong way, but I don't know how to do it correctly. Also, my switch statement doesn't work anyway. Please advise. TIA, John ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] XML Question
It's not just about missing break, your switch statement fundamentally does not make sense (sorry ;) switch (xmldata.pa...@pg_name.tostring()) ... this evaluates to indexcontact as your trace shows, therefore none of your cases will pass the test. In order to make this work you have to iterate nodes with for/for each, but no need to even do that - instead use E4X to access nodes you want. -- Kenneth Kawamoto http://www.materiaprima.co.uk/ On 5 May 2010 16:23, jonathan howe jonathangh...@gmail.com wrote: You forgot your break; statements, sir. On Wed, May 5, 2010 at 11:12 AM, John Singleton johnsingleton...@yahoo.comwrote: - Original Message From: allandt bik-elliott (thefieldcomic.com) alla...@gmail.com i'd also recommend having a root node and an xml type declaration at the start Right. Ok, here's my revised code: ?xml version=1.0? SITE PAGE pg_name='index' DETAILSThis is some more of the home page./DETAILS /PAGE PAGE pg_name='contact' DETAILSThis is some more of the contact page./DETAILS /PAGE /SITE function completeXMLListener(e:Event):void { var xmlData:XML = XML (e.target.data); trace(xmldata.pa...@pg_name.tostring()) switch (xmldata.pa...@pg_name.tostring()) { case index: pageDetails = xmlData.PAGE.DETAILS.toString(); case contact: pageDetails = xmlData.PAGE.DETAILS.toString(); default: pageDetails = xmlData.PAGE.DETAILS.toString(); trace(pageDetails); } MyTextBlock(); } The first trace nicely prints out what I would expect (I think, should have been on two lines): indexcontact The second trace also prints: DETAILSThis is some more of the home page./DETAILS DETAILSThis is some more of the contact page./DETAILS indicating, of course, that the default is firing. Why? TIA, John ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] XML Question
- Original Message From: jonathan howe jonathangh...@gmail.com To: Flash Coders List flashcoders@chattyfig.figleaf.com Sent: Wed, May 5, 2010 11:23:25 AM Subject: Re: [Flashcoders] XML Question You forgot your break; statements, sir. You're right, however it makes no difference in the outcome. It still defaults to the default: function completeXMLListener(e:Event):void { var xmlData:XML = XML (e.target.data); trace(xmldata.pa...@pg_name.tostring()) switch (xmldata.pa...@pg_name.tostring()) { case index: pageDetails = xmlData.PAGE.DETAILS.toString(); break; case contact: pageDetails = xmlData.PAGE.DETAILS.toString(); break; default: pageDetails = xmlData.PAGE.DETAILS.toString(); trace(pageDetails); break; } MyTextBlock(); } and that is not what I want. I just put a couple of traces in the other cases and they didn't fire. Please explain. TIA. John On Wed, May 5, 2010 at 11:12 AM, John Singleton href=mailto:johnsingleton...@yahoo.com;johnsingleton...@yahoo.comwrote: - Original Message From: allandt bik-elliott ( target=_blank href=http://thefieldcomic.com;thefieldcomic.com) ymailto=mailto:alla...@gmail.com; href=mailto:alla...@gmail.com;alla...@gmail.com i'd also recommend having a root node and an xml type declaration at the start Right. Ok, here's my revised code: ?xml version=1.0? SITE PAGE pg_name='index' DETAILSThis is some more of the home page./DETAILS /PAGE PAGE pg_name='contact' DETAILSThis is some more of the contact page./DETAILS /PAGE /SITE function completeXMLListener(e:Event):void { var xmlData:XML = XML (e.target.data); trace( ymailto=mailto:xmldata.pa...@pg_name.tostring; href=mailto:xmldata.pa...@pg_name.tostring;xmldata.pa...@pg_name.tostring()) switch ( ymailto=mailto:xmldata.pa...@pg_name.tostring; href=mailto:xmldata.pa...@pg_name.tostring;xmldata.pa...@pg_name.tostring()) { case index: pageDetails = xmlData.PAGE.DETAILS.toString(); case contact: pageDetails = xmlData.PAGE.DETAILS.toString(); default: pageDetails = xmlData.PAGE.DETAILS.toString(); trace(pageDetails); } MyTextBlock(); } The first trace nicely prints out what I would expect (I think, should have been on two lines): indexcontact The second trace also prints: DETAILSThis is some more of the home page./DETAILS DETAILSThis is some more of the contact page./DETAILS indicating, of course, that the default is firing. Why? TIA, John ___ Flashcoders mailing list href=mailto:Flashcoders@chattyfig.figleaf.com;Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders -- -jonathan howe ___ Flashcoders mailing list href=mailto:Flashcoders@chattyfig.figleaf.com;Flashcoders@chattyfig.figleaf.com href=http://chattyfig.figleaf.com/mailman/listinfo/flashcoders; target=_blank http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] XML Question
- Original Message From: kennethkawam...@gmail.com kennethkawam...@gmail.com To: Flash Coders List flashcoders@chattyfig.figleaf.com Sent: Wed, May 5, 2010 11:53:53 AM Subject: Re: [Flashcoders] XML Question It's not just about missing break, your switch statement fundamentally does not make sense (sorry ;) switch ( ymailto=mailto:xmldata.pa...@pg_name.tostring; href=mailto:xmldata.pa...@pg_name.tostring;xmldata.pa...@pg_name.tostring()) ... this evaluates to indexcontact as your trace shows, therefore none of your cases will pass the test. In order to make this work you have to iterate nodes with for/for each, but no need to even do that - instead use E4X to access nodes you want. Right. That's what I said at the outset, that I knew I was doing something fundamentally wrong, but don't know how to do it correctly. Here I am with Moock trying to figure it out but I'm missing it. Could you give an example? TIA, John -- Kenneth Kawamoto http://www.materiaprima.co.uk/ On 5 May 2010 16:23, jonathan howe href=mailto:jonathangh...@gmail.com;jonathangh...@gmail.com wrote: You forgot your break; statements, sir. On Wed, May 5, 2010 at 11:12 AM, John Singleton ymailto=mailto:johnsingleton...@yahoo.com; href=mailto:johnsingleton...@yahoo.com;johnsingleton...@yahoo.comwrote: - Original Message From: allandt bik-elliott ( href=http://thefieldcomic.com;thefieldcomic.com) ymailto=mailto:alla...@gmail.com; href=mailto:alla...@gmail.com;alla...@gmail.com i'd also recommend having a root node and an xml type declaration at the start Right. Ok, here's my revised code: ?xml version=1.0? SITE PAGE pg_name='index' DETAILSThis is some more of the home page./DETAILS /PAGE PAGE pg_name='contact' DETAILSThis is some more of the contact page./DETAILS /PAGE /SITE function completeXMLListener(e:Event):void { var xmlData:XML = XML (e.target.data); trace( ymailto=mailto:xmldata.pa...@pg_name.tostring; href=mailto:xmldata.pa...@pg_name.tostring;xmldata.pa...@pg_name.tostring()) switch ( href=mailto:xmldata.pa...@pg_name.tostring;xmldata.pa...@pg_name.tostring()) { case index: pageDetails = xmlData.PAGE.DETAILS.toString(); case contact: pageDetails = xmlData.PAGE.DETAILS.toString(); default: pageDetails = xmlData.PAGE.DETAILS.toString(); trace(pageDetails); } MyTextBlock(); } The first trace nicely prints out what I would expect (I think, should have been on two lines): indexcontact The second trace also prints: DETAILSThis is some more of the home page./DETAILS DETAILSThis is some more of the contact page./DETAILS indicating, of course, that the default is firing. Why? TIA, John ___ Flashcoders mailing list href=mailto:Flashcoders@chattyfig.figleaf.com;Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] XML Question
Say for example you are in the home section and obtaining the data for it, you'd do: var pageData:XML = xmlData.PAGE.(@pg_name == index)[0]; Then build the page based on pageData XML. -- Kenneth Kawamoto http://www.materiaprima.co.uk/ On 5 May 2010 17:30, John Singleton johnsingleton...@yahoo.com wrote: - Original Message From: kennethkawam...@gmail.com kennethkawam...@gmail.com To: Flash Coders List flashcoders@chattyfig.figleaf.com Sent: Wed, May 5, 2010 11:53:53 AM Subject: Re: [Flashcoders] XML Question It's not just about missing break, your switch statement fundamentally does not make sense (sorry ;) switch ( ymailto=mailto:xmldata.pa...@pg_name.tostring; href=mailto:xmldata.pa...@pg_name.tostring;xmldata.pa...@pg_name.tostring()) ... this evaluates to indexcontact as your trace shows, therefore none of your cases will pass the test. In order to make this work you have to iterate nodes with for/for each, but no need to even do that - instead use E4X to access nodes you want. Right. That's what I said at the outset, that I knew I was doing something fundamentally wrong, but don't know how to do it correctly. Here I am with Moock trying to figure it out but I'm missing it. Could you give an example? TIA, John -- Kenneth Kawamoto http://www.materiaprima.co.uk/ On 5 May 2010 16:23, jonathan howe href=mailto:jonathangh...@gmail.com;jonathangh...@gmail.com wrote: You forgot your break; statements, sir. On Wed, May 5, 2010 at 11:12 AM, John Singleton ymailto=mailto:johnsingleton...@yahoo.com; href=mailto:johnsingleton...@yahoo.com;johnsingleton...@yahoo.comwrote: - Original Message From: allandt bik-elliott ( href=http://thefieldcomic.com;thefieldcomic.com) ymailto=mailto:alla...@gmail.com; href=mailto:alla...@gmail.com;alla...@gmail.com i'd also recommend having a root node and an xml type declaration at the start Right. Ok, here's my revised code: ?xml version=1.0? SITE PAGE pg_name='index' DETAILSThis is some more of the home page./DETAILS /PAGE PAGE pg_name='contact' DETAILSThis is some more of the contact page./DETAILS /PAGE /SITE function completeXMLListener(e:Event):void { var xmlData:XML = XML (e.target.data); trace( ymailto=mailto:xmldata.pa...@pg_name.tostring; href=mailto:xmldata.pa...@pg_name.tostring;xmldata.pa...@pg_name.tostring()) switch ( href=mailto:xmldata.pa...@pg_name.tostring;xmldata.pa...@pg_name.tostring()) { case index: pageDetails = xmlData.PAGE.DETAILS.toString(); case contact: pageDetails = xmlData.PAGE.DETAILS.toString(); default: pageDetails = xmlData.PAGE.DETAILS.toString(); trace(pageDetails); } MyTextBlock(); } The first trace nicely prints out what I would expect (I think, should have been on two lines): indexcontact The second trace also prints: DETAILSThis is some more of the home page./DETAILS DETAILSThis is some more of the contact page./DETAILS indicating, of course, that the default is firing. Why? TIA, John ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
RE: [Flashcoders] XML Question
I think you just need a root node. var xmlData:XML = new XML (rootPAGE pg_name='index'DETAILSpage/DETAILS /PAGE/root); trace(xmldata.pa...@pg_name.tostring() == index); // true var xmlData:XML = new XML (PAGE pg_name='index'DETAILSpageDETAILS /PAGE); trace(xmldata.pa...@pg_name.tostring() == index); // false _ _ _ Erik Mattheis Senior Web Developer Minneapolis T 952 346 6610 C 612 377 2272 Weber Shandwick Advocacy starts here. PRWeek Global Agency Report Card 2009 - Gold Medal Winner The Holmes Report Global Agency of the Year PR News Agency of the Year -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of John Singleton Sent: Wednesday, May 05, 2010 11:03 AM To: Flash Coders List Subject: Re: [Flashcoders] XML Question - Original Message From: jonathan howe jonathangh...@gmail.com To: Flash Coders List flashcoders@chattyfig.figleaf.com Sent: Wed, May 5, 2010 11:23:25 AM Subject: Re: [Flashcoders] XML Question You forgot your break; statements, sir. You're right, however it makes no difference in the outcome. It still defaults to the default: function completeXMLListener(e:Event):void { var xmlData:XML = XML (e.target.data); trace(xmldata.pa...@pg_name.tostring()) switch (xmldata.pa...@pg_name.tostring()) { case index: pageDetails = xmlData.PAGE.DETAILS.toString(); break; case contact: pageDetails = xmlData.PAGE.DETAILS.toString(); break; default: pageDetails = xmlData.PAGE.DETAILS.toString(); trace(pageDetails); break; } MyTextBlock(); } and that is not what I want. I just put a couple of traces in the other cases and they didn't fire. Please explain. TIA. John On Wed, May 5, 2010 at 11:12 AM, John Singleton href=mailto:johnsingleton...@yahoo.com;johnsingleton...@yahoo.comwrote: - Original Message From: allandt bik-elliott ( target=_blank href=http://thefieldcomic.com;thefieldcomic.com) ymailto=mailto:alla...@gmail.com; href=mailto:alla...@gmail.com;alla...@gmail.com i'd also recommend having a root node and an xml type declaration at the start Right. Ok, here's my revised code: ?xml version=1.0? SITE PAGE pg_name='index' DETAILSThis is some more of the home page./DETAILS /PAGE PAGE pg_name='contact' DETAILSThis is some more of the contact page./DETAILS /PAGE /SITE function completeXMLListener(e:Event):void { var xmlData:XML = XML (e.target.data); trace( ymailto=mailto:xmldata.pa...@pg_name.tostring; href=mailto:xmldata.pa...@pg_name.tostring;xmldata.pa...@pg_name.tostring()) switch ( ymailto=mailto:xmldata.pa...@pg_name.tostring; href=mailto:xmldata.pa...@pg_name.tostring;xmldata.pa...@pg_name.tostring()) { case index: pageDetails = xmlData.PAGE.DETAILS.toString(); case contact: pageDetails = xmlData.PAGE.DETAILS.toString(); default: pageDetails = xmlData.PAGE.DETAILS.toString(); trace(pageDetails); } MyTextBlock(); } The first trace nicely prints out what I would expect (I think, should have been on two lines): indexcontact The second trace also prints: DETAILSThis is some more of the home page./DETAILS DETAILSThis is some more of the contact page./DETAILS indicating, of course, that the default is firing. Why? TIA, John ___ Flashcoders mailing list href=mailto:Flashcoders@chattyfig.figleaf.com;Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders -- -jonathan howe ___ Flashcoders mailing list href=mailto:Flashcoders@chattyfig.figleaf.com;Flashcoders@chattyfig.figleaf.com href=http://chattyfig.figleaf.com/mailman/listinfo/flashcoders; target=_blank http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] XML Question
I think you just need a root node. No way. Your first example traces true just because there is only one pg_name attribute. Consider this: var xmlData:XML = root PAGE pg_name='index'DETAILSpage/DETAILS/PAGE PAGE pg_name='contact'DETAILSpage/DETAILS/PAGE /root; trace(xmldata.pa...@pg_name.tostring() == index); // false because it evaluates as indexcontract -- Kenneth Kawamoto http://www.materiaprima.co.uk/ On 5 May 2010 17:49, Mattheis, Erik (MIN - WSW) ematth...@webershandwick.com wrote: I think you just need a root node. var xmlData:XML = new XML (rootPAGE pg_name='index'DETAILSpage/DETAILS /PAGE/root); trace(xmldata.pa...@pg_name.tostring() == index); // true var xmlData:XML = new XML (PAGE pg_name='index'DETAILSpageDETAILS /PAGE); trace(xmldata.pa...@pg_name.tostring() == index); // false _ _ _ Erik Mattheis Senior Web Developer Minneapolis T 952 346 6610 C 612 377 2272 Weber Shandwick Advocacy starts here. PRWeek Global Agency Report Card 2009 - Gold Medal Winner The Holmes Report Global Agency of the Year PR News Agency of the Year -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of John Singleton Sent: Wednesday, May 05, 2010 11:03 AM To: Flash Coders List Subject: Re: [Flashcoders] XML Question - Original Message From: jonathan howe jonathangh...@gmail.com To: Flash Coders List flashcoders@chattyfig.figleaf.com Sent: Wed, May 5, 2010 11:23:25 AM Subject: Re: [Flashcoders] XML Question You forgot your break; statements, sir. You're right, however it makes no difference in the outcome. It still defaults to the default: function completeXMLListener(e:Event):void { var xmlData:XML = XML (e.target.data); trace(xmldata.pa...@pg_name.tostring()) switch (xmldata.pa...@pg_name.tostring()) { case index: pageDetails = xmlData.PAGE.DETAILS.toString(); break; case contact: pageDetails = xmlData.PAGE.DETAILS.toString(); break; default: pageDetails = xmlData.PAGE.DETAILS.toString(); trace(pageDetails); break; } MyTextBlock(); } and that is not what I want. I just put a couple of traces in the other cases and they didn't fire. Please explain. TIA. John On Wed, May 5, 2010 at 11:12 AM, John Singleton href=mailto:johnsingleton...@yahoo.com;johnsingleton...@yahoo.comwrote: - Original Message From: allandt bik-elliott ( target=_blank href=http://thefieldcomic.com;thefieldcomic.com) ymailto=mailto:alla...@gmail.com; href=mailto:alla...@gmail.com;alla...@gmail.com i'd also recommend having a root node and an xml type declaration at the start Right. Ok, here's my revised code: ?xml version=1.0? SITE PAGE pg_name='index' DETAILSThis is some more of the home page./DETAILS /PAGE PAGE pg_name='contact' DETAILSThis is some more of the contact page./DETAILS /PAGE /SITE function completeXMLListener(e:Event):void { var xmlData:XML = XML (e.target.data); trace( ymailto=mailto:xmldata.pa...@pg_name.tostring; href=mailto:xmldata.pa...@pg_name.tostring;xmldata.pa...@pg_name.tostring()) switch ( ymailto=mailto:xmldata.pa...@pg_name.tostring; href=mailto:xmldata.pa...@pg_name.tostring;xmldata.pa...@pg_name.tostring()) { case index: pageDetails = xmlData.PAGE.DETAILS.toString(); case contact: pageDetails = xmlData.PAGE.DETAILS.toString(); default: pageDetails = xmlData.PAGE.DETAILS.toString(); trace(pageDetails); } MyTextBlock(); } The first trace nicely prints out what I would expect (I think, should have been on two lines): indexcontact The second trace also prints: DETAILSThis is some more of the home page./DETAILS DETAILSThis is some more of the contact page./DETAILS indicating, of course, that the default is firing. Why? TIA, John ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] XML Question
- Original Message From: kennethkawam...@gmail.com kennethkawam...@gmail.com To: Flash Coders List flashcoders@chattyfig.figleaf.com Sent: Wed, May 5, 2010 12:48:28 PM Subject: Re: [Flashcoders] XML Question Say for example you are in the home section and obtaining the data for it, you'd do: var pageData:XML = xmlData.PAGE.(@pg_name == index)[0]; Then build the page based on pageData XML. k. Now, how can I build a switch statement to determine which page? I plan to pass a var to my swf, then call the data based on the value of the var (in this case, index). As stated previously, my switch statement, for reasons I don't understand, is giving me the value indexcontent; that is, all the values of pg_name: function completeXMLListener(e:Event):void { var xmlData:XML = XML (e.target.data); trace(xmldata.pa...@pg_name.tostring()) switch (xmldata.pa...@pg_name.tostring()) { case index: pageDetails = xmlData.PAGE.DETAILS.toString(); break; case contact: pageDetails = xmlData.PAGE.DETAILS.toString(); break; default: pageDetails = xmlData.PAGE.DETAILS.toString(); trace(pageDetails); break; } MyTextBlock(); } TIA, John ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
RE: [Flashcoders] XML Question
Now, how can I build a switch statement to determine which page? Did you read my reply? I didn't see a response to it. Jason Merrill Bank of America Global Learning Learning Performance Solutions Join the Bank of America Flash Platform Community and visit our Instructional Technology Design Blog (note: these are for Bank of America employees only) -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of John Singleton Sent: Wednesday, May 05, 2010 1:28 PM To: Flash Coders List Subject: Re: [Flashcoders] XML Question - Original Message From: kennethkawam...@gmail.com kennethkawam...@gmail.com To: Flash Coders List flashcoders@chattyfig.figleaf.com Sent: Wed, May 5, 2010 12:48:28 PM Subject: Re: [Flashcoders] XML Question Say for example you are in the home section and obtaining the data for it, you'd do: var pageData:XML = xmlData.PAGE.(@pg_name == index)[0]; Then build the page based on pageData XML. k. Now, how can I build a switch statement to determine which page? I plan to pass a var to my swf, then call the data based on the value of the var (in this case, index). As stated previously, my switch statement, for reasons I don't understand, is giving me the value indexcontent; that is, all the values of pg_name: function completeXMLListener(e:Event):void { var xmlData:XML = XML (e.target.data); trace(xmldata.pa...@pg_name.tostring()) switch (xmldata.pa...@pg_name.tostring()) { case index: pageDetails = xmlData.PAGE.DETAILS.toString(); break; case contact: pageDetails = xmlData.PAGE.DETAILS.toString(); break; default: pageDetails = xmlData.PAGE.DETAILS.toString(); trace(pageDetails); break; } MyTextBlock(); } TIA, John ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] XML Question
If I understood you correctly, you want to filter the XML data according to a variable passed to the SWF. If so you'd do something like: var pageDetails:String = xmlData.PAGE.(@pg_name == loaderInfo.parameters.page).DETAILS; // page is the name of the var passed to the SWF here But I strongly recommend you to have a look at SWFAddress, which is absolutely indispensable framework if you are creating a site driven by dynamic data ;) Kenneth Kawamoto http://www.materiaprima.co.uk/ John Singleton wrote: - Original Message From: kennethkawam...@gmail.com kennethkawam...@gmail.com To: Flash Coders List flashcoders@chattyfig.figleaf.com Sent: Wed, May 5, 2010 12:48:28 PM Subject: Re: [Flashcoders] XML Question Say for example you are in the home section and obtaining the data for it, you'd do: var pageData:XML = xmlData.PAGE.(@pg_name == index)[0]; Then build the page based on pageData XML. k. Now, how can I build a switch statement to determine which page? I plan to pass a var to my swf, then call the data based on the value of the var (in this case, index). As stated previously, my switch statement, for reasons I don't understand, is giving me the value indexcontent; that is, all the values of pg_name: function completeXMLListener(e:Event):void { var xmlData:XML = XML (e.target.data); trace(xmldata.pa...@pg_name.tostring()) switch (xmldata.pa...@pg_name.tostring()) { case index: pageDetails = xmlData.PAGE.DETAILS.toString(); break; case contact: pageDetails = xmlData.PAGE.DETAILS.toString(); break; default: pageDetails = xmlData.PAGE.DETAILS.toString(); trace(pageDetails); break; } MyTextBlock(); } TIA, John ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] XML question with a test case
Thank you - I'll do, but On Sat, Feb 6, 2010 at 7:01 PM, Juan Pablo Califano califa010.flashcod...@gmail.com wrote: Because your second query returns an empty list instead of null. So, instead of checking for null, just check the length of the result. trace(describeType(xml1.lobby)); trace(xml1.lobby.length()); // 1 trace(describeType(xml2.lobby)); trace(xml2.lobby.length()); // 0 wouldn't it sometimes throw an error that I call a method length() on a null-object? Regards Alex ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] XML question with a test case
I don't think so. I think that's precisely the reason why it returns an empty list instead of null. So you can safely chain toghether diferent node names in your query. Cheers Juan Pablo Califano 2010/2/6 Alexander Farber alexander.far...@gmail.com Thank you - I'll do, but On Sat, Feb 6, 2010 at 7:01 PM, Juan Pablo Califano califa010.flashcod...@gmail.com wrote: Because your second query returns an empty list instead of null. So, instead of checking for null, just check the length of the result. trace(describeType(xml1.lobby)); trace(xml1.lobby.length()); // 1 trace(describeType(xml2.lobby)); trace(xml2.lobby.length()); // 0 wouldn't it sometimes throw an error that I call a method length() on a null-object? Regards Alex ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] XML question with a test case
Thank you ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] XML question
Is your XML object set to ignoreWhite? http://livedocs.macromedia.com/flash/mx2004/main_7_2/wwhelp/wwhimpl/common/html/wwhelp.htm?context=Flash_MX_2004file=1896.html Scott On 24/08/06, Wouter [EMAIL PROTECTED] wrote: Hi list, I got an MS Acces database with data, which I converted to XML (direct export from Access) and I read that in flash.so far so good, but when I display the text in a textfield there are a lot of empty lines between the linesI found out that there are somehowe some \r in there that probably cause this.but how do I get them out? I tried to replace all the \r but that did not help Any ideas? ___ 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 ___ 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
RE: [Flashcoders] XML question
Thanx! But ignoreWhite = true So that`s not it...any other ideas? -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Scott Hyndman Sent: Thursday, August 24, 2006 4:14 PM To: Flashcoders mailing list Subject: Re: [Flashcoders] XML question Is your XML object set to ignoreWhite? http://livedocs.macromedia.com/flash/mx2004/main_7_2/wwhelp/wwhimpl/common/h tml/wwhelp.htm?context=Flash_MX_2004file=1896.html Scott On 24/08/06, Wouter [EMAIL PROTECTED] wrote: Hi list, I got an MS Acces database with data, which I converted to XML (direct export from Access) and I read that in flash.so far so good, but when I display the text in a textfield there are a lot of empty lines between the linesI found out that there are somehowe some \r in there that probably cause this.but how do I get them out? I tried to replace all the \r but that did not help Any ideas? ___ 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 ___ 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 ___ 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
Re: [Flashcoders] XML question
You could remove the line breaks from your XML file. \r is a carriage return. In Windows, it accompanies a newline character when someone presses enter. Scott On 24/08/06, Wouter [EMAIL PROTECTED] wrote: Thanx! But ignoreWhite = true So that`s not it...any other ideas? -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Scott Hyndman Sent: Thursday, August 24, 2006 4:14 PM To: Flashcoders mailing list Subject: Re: [Flashcoders] XML question Is your XML object set to ignoreWhite? http://livedocs.macromedia.com/flash/mx2004/main_7_2/wwhelp/wwhimpl/common/h tml/wwhelp.htm?context=Flash_MX_2004file=1896.html Scott On 24/08/06, Wouter [EMAIL PROTECTED] wrote: Hi list, I got an MS Acces database with data, which I converted to XML (direct export from Access) and I read that in flash.so far so good, but when I display the text in a textfield there are a lot of empty lines between the linesI found out that there are somehowe some \r in there that probably cause this.but how do I get them out? I tried to replace all the \r but that did not help Any ideas? ___ 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 ___ 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 ___ 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 ___ 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
RE: [Flashcoders] XML question
Hey Scott, Thanx again! You happen to know a smart way to delete those white lines? Wouter -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Scott Hyndman Sent: Thursday, August 24, 2006 5:18 PM To: Flashcoders mailing list Subject: Re: [Flashcoders] XML question You could remove the line breaks from your XML file. \r is a carriage return. In Windows, it accompanies a newline character when someone presses enter. Scott On 24/08/06, Wouter [EMAIL PROTECTED] wrote: Thanx! But ignoreWhite = true So that`s not it...any other ideas? -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Scott Hyndman Sent: Thursday, August 24, 2006 4:14 PM To: Flashcoders mailing list Subject: Re: [Flashcoders] XML question Is your XML object set to ignoreWhite? http://livedocs.macromedia.com/flash/mx2004/main_7_2/wwhelp/wwhimpl/co mmon/h tml/wwhelp.htm?context=Flash_MX_2004file=1896.html Scott On 24/08/06, Wouter [EMAIL PROTECTED] wrote: Hi list, I got an MS Acces database with data, which I converted to XML (direct export from Access) and I read that in flash.so far so good, but when I display the text in a textfield there are a lot of empty lines between the linesI found out that there are somehowe some \r in there that probably cause this.but how do I get them out? I tried to replace all the \r but that did not help Any ideas? ___ 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 ___ 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 ___ 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 ___ 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 ___ 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
RE: [Flashcoders] XML question
Did you try condenseWhite on your textfield? http://livedocs.macromedia.com/flash/8/main/wwhelp/wwhimpl/common/html/w whelp.htm?context=LiveDocs_Partsfile=2740.html From the help files: var my_str:String = Hello\tWorld\nHow are you?\t\t\tEnd; this.createTextField(first_txt, this.getNextHighestDepth(), 10, 10, 160, 120); first_txt.html = true; first_txt.multiline = true; first_txt.wordWrap = true; first_txt.condenseWhite = false; first_txt.border = true; first_txt.htmlText = my_str; this.createTextField(second_txt, this.getNextHighestDepth(), 180, 10, 160, 120); second_txt.html = true; second_txt.multiline = true; second_txt.wordWrap = true; second_txt.condenseWhite = true; second_txt.border = true; second_txt.htmlText = my_str; -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Wouter Sent: Thursday, August 24, 2006 8:37 AM To: 'Flashcoders mailing list' Subject: RE: [Flashcoders] XML question Thanx! But ignoreWhite = true So that`s not it...any other ideas? -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Scott Hyndman Sent: Thursday, August 24, 2006 4:14 PM To: Flashcoders mailing list Subject: Re: [Flashcoders] XML question Is your XML object set to ignoreWhite? http://livedocs.macromedia.com/flash/mx2004/main_7_2/wwhelp/wwhimpl/comm on/h tml/wwhelp.htm?context=Flash_MX_2004file=1896.html Scott On 24/08/06, Wouter [EMAIL PROTECTED] wrote: Hi list, I got an MS Acces database with data, which I converted to XML (direct export from Access) and I read that in flash.so far so good, but when I display the text in a textfield there are a lot of empty lines between the linesI found out that there are somehowe some \r in there that probably cause this.but how do I get them out? I tried to replace all the \r but that did not help Any ideas? ___ 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 ___ 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 ___ 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 ___ 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
RE: [Flashcoders] XML question
Hey Ryan, thanx, but this doesn't seem to solve it. But I found out I can do a find and replace on the empty lines in Dreamwever so I`m gonna play with that! -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Ryan Potter Sent: Thursday, August 24, 2006 5:51 PM To: Flashcoders mailing list Subject: RE: [Flashcoders] XML question Did you try condenseWhite on your textfield? http://livedocs.macromedia.com/flash/8/main/wwhelp/wwhimpl/common/html/w whelp.htm?context=LiveDocs_Partsfile=2740.html From the help files: var my_str:String = Hello\tWorld\nHow are you?\t\t\tEnd; this.createTextField(first_txt, this.getNextHighestDepth(), 10, 10, 160, 120); first_txt.html = true; first_txt.multiline = true; first_txt.wordWrap = true; first_txt.condenseWhite = false; first_txt.border = true; first_txt.htmlText = my_str; this.createTextField(second_txt, this.getNextHighestDepth(), 180, 10, 160, 120); second_txt.html = true; second_txt.multiline = true; second_txt.wordWrap = true; second_txt.condenseWhite = true; second_txt.border = true; second_txt.htmlText = my_str; -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Wouter Sent: Thursday, August 24, 2006 8:37 AM To: 'Flashcoders mailing list' Subject: RE: [Flashcoders] XML question Thanx! But ignoreWhite = true So that`s not it...any other ideas? -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Scott Hyndman Sent: Thursday, August 24, 2006 4:14 PM To: Flashcoders mailing list Subject: Re: [Flashcoders] XML question Is your XML object set to ignoreWhite? http://livedocs.macromedia.com/flash/mx2004/main_7_2/wwhelp/wwhimpl/comm on/h tml/wwhelp.htm?context=Flash_MX_2004file=1896.html Scott On 24/08/06, Wouter [EMAIL PROTECTED] wrote: Hi list, I got an MS Acces database with data, which I converted to XML (direct export from Access) and I read that in flash.so far so good, but when I display the text in a textfield there are a lot of empty lines between the linesI found out that there are somehowe some \r in there that probably cause this.but how do I get them out? I tried to replace all the \r but that did not help Any ideas? ___ 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 ___ 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 ___ 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 ___ 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 ___ 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
RE: [Flashcoders] XML question
Here's one way: myString.split(\r).join(); myString.split(\n).join(); And if you use my XString class (search the archives): myString.squeeze( ); might do the trick, too. ___ 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
Re: [Flashcoders] XML question
But I found out I can do a find and replace on the empty lines in Dreamwever so I`m gonna play with that! If you have access to any decent text editor you should be able to get rid of them. I use UltraEdit for this, because it supports RegExp in the replace dialog. Basically, you just want to replace \r\n (or whatever the equivalent is in your text editor) with \n, and that should fix it. Be aware, though, that you will have to use different expressions for this in different editors. In essence, \r is a hard return and \n is a line feed (or newline), and some databases/operating systems/languages/etc insert only a hard return, some insert only a line feed, and some insert both. So in your text editor, find out how to do a find and replace on only the hard return character. In UltraEit, when *not* using RegExp, you can use ^r and ^n as search terms for \r and \n, and you can use ^p (paragraph break) as a search term for \r\n, and then replace it with ^n (just a newline character). With RegExp enabled in the replace dialog, you can just use the \r and \n, as is usual in RegExp. You might want to look and see if you can find a demo copy of UltraEdit just for this replacement, it's very useful for this sort of thing. I used it to reformat over 120 files all in one swoop with it, which saved me tons of time. ryanm ___ 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
Re: [Flashcoders] XML question
Here's one way: myString.split(\r).join(); myString.split(\n).join(); It sounds to me like he's trying to take a database and turn it into something that can be loaded directly by Flash, maybe for a distributed standalone app (CD, web download, etc). Depending on the size of the data, it probably would be a good idea to do this before hand, to the file itself, rather than making Flash parse it out every time the end user opens the app. ryanm ___ 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
RE: [Flashcoders] XML question
Yes, He is trying to do that exactly :) I got a db and have to use the data in Flash on a CD. :) -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of ryanm Sent: Thursday, August 24, 2006 7:53 PM To: Flashcoders mailing list Subject: Re: [Flashcoders] XML question Here's one way: myString.split(\r).join(); myString.split(\n).join(); It sounds to me like he's trying to take a database and turn it into something that can be loaded directly by Flash, maybe for a distributed standalone app (CD, web download, etc). Depending on the size of the data, it probably would be a good idea to do this before hand, to the file itself, rather than making Flash parse it out every time the end user opens the app. ryanm ___ 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 ___ 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
RE: [Flashcoders] XML question
Thx for this Ryan! The thing is that in the file I dpnt see the /r or /n...i just see this as an example: postIntroGeachte minister, Lorem ipsum sig dagelet mi cando si nado. vriendelijke groeten, /postIntro And in Flash I get all the \r in it an it looks really weird with a lot of space between lines. In dreamweaver I can copy the empty line and replace it with nothing, that fixed it I still don't really get it, but it is solved for now! Thx again! -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of ryanm Sent: Thursday, August 24, 2006 7:48 PM To: Flashcoders mailing list Subject: Re: [Flashcoders] XML question But I found out I can do a find and replace on the empty lines in Dreamwever so I`m gonna play with that! If you have access to any decent text editor you should be able to get rid of them. I use UltraEdit for this, because it supports RegExp in the replace dialog. Basically, you just want to replace \r\n (or whatever the equivalent is in your text editor) with \n, and that should fix it. Be aware, though, that you will have to use different expressions for this in different editors. In essence, \r is a hard return and \n is a line feed (or newline), and some databases/operating systems/languages/etc insert only a hard return, some insert only a line feed, and some insert both. So in your text editor, find out how to do a find and replace on only the hard return character. In UltraEit, when *not* using RegExp, you can use ^r and ^n as search terms for \r and \n, and you can use ^p (paragraph break) as a search term for \r\n, and then replace it with ^n (just a newline character). With RegExp enabled in the replace dialog, you can just use the \r and \n, as is usual in RegExp. You might want to look and see if you can find a demo copy of UltraEdit just for this replacement, it's very useful for this sort of thing. I used it to reformat over 120 files all in one swoop with it, which saved me tons of time. ryanm ___ 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 ___ 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
Re: [Flashcoders] xml question
thanks On 6/17/06, Paul Evans [EMAIL PROTECTED] wrote: On 16 Jun 2006, at 22:28, Flash guru wrote: I'm restricted to asp, but I'm a php native that is blind to the ways of asp I'm trying to leave the way of ASP behind - the following notes might be useful to you... A good quick ASP reference :- http://www.devguru.com/ In ActionScript, when you create/build the XML object, don't bother setting the XMLObject.contentType as you would for PHP. The (unusual) default was intended for communicating with ASP. On the server, asp VBScript code I have used previously to process XML sent from flash... % dim xmlObj Set xmlObj = Server.CreateObject( Microsoft.XMLDOM ) xmlObj.async = false xmlObj.load( Request.BinaryRead( Request.TotalBytes ) ) if xmlObj.parseError.errorCode 0 then 'there-was-a-parse-error else 'do-something end if % In your case the do-something is probably to just a call to the xmlObj save method? e.g. xmlObj.save( C:\path-to-target-file ) http://www.devguru.com/technologies/xml_dom/15813.asp You may also find reading up on the VBScript File System Object if you have other file type things to such as testing to see if the file already exists... http://www.devguru.com/technologies/vbscript/14048.asp And finally you may need to use Server.MapPath to find the path to your site-root folder... http://www.devguru.com/technologies/asp/9170.asp hth Paul -- [ http://www.creative-cognition.co.uk/ ] ___ 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 ___ 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
RE: [Flashcoders] xml question
If you can't use PHP, can you use anything else like ASP or Coldfusion? You'll need something like that to produce them. The Flash player, for security reasons, can't create XML files by itself on the server. You have to use something else along with Flash. This is also true of HTML - same concept. Jason Merrill Bank of America Learning Technology Solutions -Original Message- From: [EMAIL PROTECTED] [mailto:flashcoders- [EMAIL PROTECTED] On Behalf Of Flash guru Sent: Friday, June 16, 2006 5:12 PM To: Flashcoders mailing list Subject: [Flashcoders] xml question First off thanks to anyone who responds I have this interactive peice that uses xml file that need to be edited in an admin atmoshpere. My question is: Can flash produce xml files? What would be the best way to produce xml files on the fly, if flash can't produce xml files? Lastly I can't use php. ( If i could i wouldn't be writing this email ) thanks juegas ___ 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 ___ 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
Re: [Flashcoders] xml question
I'm restricted to asp, but I'm a php native that is blind to the ways of asp On 6/16/06, Merrill, Jason [EMAIL PROTECTED] wrote: If you can't use PHP, can you use anything else like ASP or Coldfusion? You'll need something like that to produce them. The Flash player, for security reasons, can't create XML files by itself on the server. You have to use something else along with Flash. This is also true of HTML - same concept. Jason Merrill Bank of America Learning Technology Solutions -Original Message- From: [EMAIL PROTECTED] [mailto:flashcoders- [EMAIL PROTECTED] On Behalf Of Flash guru Sent: Friday, June 16, 2006 5:12 PM To: Flashcoders mailing list Subject: [Flashcoders] xml question First off thanks to anyone who responds I have this interactive peice that uses xml file that need to be edited in an admin atmoshpere. My question is: Can flash produce xml files? What would be the best way to produce xml files on the fly, if flash can't produce xml files? Lastly I can't use php. ( If i could i wouldn't be writing this email ) thanks juegas ___ 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 ___ 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 ___ 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
RE: [Flashcoders] xml question
You'll have to do it with .ASP then. I'm not up on ASP myself, I have a .NET developer who can do that for me, but you can use .NET to write out XML files. Better yet, store in a database, use Webservices to access the data directly. Jason Merrill Bank of America Learning Technology Solutions -Original Message- From: [EMAIL PROTECTED] [mailto:flashcoders- [EMAIL PROTECTED] On Behalf Of Flash guru Sent: Friday, June 16, 2006 5:28 PM To: Flashcoders mailing list Subject: Re: [Flashcoders] xml question I'm restricted to asp, but I'm a php native that is blind to the ways of asp On 6/16/06, Merrill, Jason [EMAIL PROTECTED] wrote: If you can't use PHP, can you use anything else like ASP or Coldfusion? You'll need something like that to produce them. The Flash player, for security reasons, can't create XML files by itself on the server. You have to use something else along with Flash. This is also true of HTML - same concept. Jason Merrill Bank of America Learning Technology Solutions -Original Message- From: [EMAIL PROTECTED] [mailto:flashcoders- [EMAIL PROTECTED] On Behalf Of Flash guru Sent: Friday, June 16, 2006 5:12 PM To: Flashcoders mailing list Subject: [Flashcoders] xml question First off thanks to anyone who responds I have this interactive peice that uses xml file that need to be edited in an admin atmoshpere. My question is: Can flash produce xml files? What would be the best way to produce xml files on the fly, if flash can't produce xml files? Lastly I can't use php. ( If i could i wouldn't be writing this email ) thanks juegas ___ 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 ___ 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 ___ 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 ___ 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
Re: [Flashcoders] XML question
use Delegate - import mx.utils.Delegate; var a:Array = new Array(); .. .. main.onLoad = Delegate.create(this, populateXML); function populateXML():Void { trace(a); } Goodluck, On 12/7/05, Flash guru [EMAIL PROTECTED] wrote: Hey all, here's the code i'm working with: var main:XML = new XML(); main.ignoreWhite =true; main.onLoad =function(success:Boolean){ if (success) { var developers:Array = this.firstChild.childNodes; var siteUrl:Array = new Array(); var stanceUrl:Array = new Array(); var introUrl = new Array(); for (var i=0; idevelopers.length; i++){ siteUrl.push(developers[i].attributes.site ); stanceUrl.push(developers[i].attributes.stance); introUrl.push(developers[i].attributes.intro); } } else{ trace(xml not connected);} } main.load(main.xml); The problem: Why can't access the arrays out side the onload function? I want the onload to just populate the arrays, so i can use their contents somewhere else. Is this an xml thing or am i doing something wrong. If i trace any of the arrays out side the onLoad function i get undefined. Fyi ~ i've already tried making the arrays global, no go that way. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders -- Ramon Miguel M. Tayag ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
RE: [Flashcoders] XML question
Variable scope... Try declaring them *outside* the onLoad() function, because those variables conveniently drift out of scope (release themselves) as the code exits that function... Hope this helps... -- Dok Skyymap Inc. 770.321.3967 Office 770.321.3454 Fax -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Flash guru Sent: Wednesday, December 07, 2005 3:20 AM To: flashcoders@chattyfig.figleaf.com Subject: [Flashcoders] XML question Hey all, here's the code i'm working with: var main:XML = new XML(); main.ignoreWhite =true; main.onLoad =function(success:Boolean){ if (success) { var developers:Array = this.firstChild.childNodes; var siteUrl:Array = new Array(); var stanceUrl:Array = new Array(); var introUrl = new Array(); for (var i=0; idevelopers.length; i++){ siteUrl.push(developers[i].attributes.site); stanceUrl.push(developers[i].attributes.stance); introUrl.push(developers[i].attributes.intro); } } else{ trace(xml not connected);} } main.load(main.xml); The problem: Why can't access the arrays out side the onload function? I want the onload to just populate the arrays, so i can use their contents somewhere else. Is this an xml thing or am i doing something wrong. If i trace any of the arrays out side the onLoad function i get undefined. Fyi ~ i've already tried making the arrays global, no go that way. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders