[flexcoders] Re: Viewing HTML
Drome- Thank you so much for your help. I was able to modify your regEx to make it work for my needs. I just needed to add in a piece for return characters and form feeds as well. The regex i used was: var pattern:RegExp = /\n|\r|\f/gi var htmlstr : String = htmlTextString.replace(pattern, ); var m:String = ExternalInterface.call(changeDocumentTitle,htmlstr); And the code for the js method being: SCRIPT LANGUAGE=JavaScript function changeDocumentTitle(a) { var generator=window.open('','name','height=400,width=500'); generator.document.write(a); generator.document.close(); return successful;//this gets assigned to flex variable 'm' above } /SCRIPT --- In flexcoders@yahoogroups.com, drome.dario [EMAIL PROTECTED] wrote: Just a thing I missed: I think that the effect being experienced by Suzy is a bug in the flex/flash serializer used by ExternalInterface. Let's hope that some adobe engineer read this or may exist any effective place where to send a request for bug consideration? --- In flexcoders@yahoogroups.com, drome.dario drome.dario@ wrote: Hi, It is not a problem with whitespace between tags, as Suzy said, it is a problem because of the cr/lf in the html code, let me explain: Supose that we have a string variable named param whose value is hello Brian\nHow are you?, then when one uses, i.e., ExternalInterface.call(jsFunc, param) flex tell the browser to evaluate a chunk of javascript code similar to this one: jsFunc(hello Brian How are you?); that is a totally illegal javascript sentence. However, if the value of param is hello Brian\\nHow are you?, then, the javascript code being evaluated would be: jsFunc(hello Brian\nHow are you?); which is good for the javascript interpreter. Thus, the solution is to replace all newline-chars with \\n string: var pattern:RegExp = /\n/gi; htmlstr = htmlstr.replace(pattern, \\n ); ExternalInterface.call(ShowHTML, htmlstr); In that way, the html's original layout is not changed and, the most important: IT WORKS! --- In flexcoders@yahoogroups.com, Brian Riggs bringrags@ wrote: One thing you could try is to assign the String to an (e4x) XML object, set XML.ignoreWhitespace to true, and then output the result using XML.toXMLString(). This should cause whitespace between tags to be stripped out. -- Brian --- In flexcoders@yahoogroups.com, Suzy Lawson suzylawson@ wrote: Christophe's blog in this case doesn't help. His iFrame points to a static HTML page. I have a String like this: //whether it be js or Flex...and my string has spaces b/w lines just like this var htmlString : String = htmlhead titletest/testbodymy body body/html; there's no way I know of to assign this to a new window or Flex object and have it display correctly. If I make the String above lal one line, then it works OK. --- In flexcoders@yahoogroups.com, tonyx_788 tonyx_788@ wrote: hi Suzy i think Phil is talking about coenraets blog, this is the link hope it helps http://www.coenraets.com/apps/iframe/index.htm **Saludos** Tony --- In flexcoders@yahoogroups.com, Phil Marston p.marston@ wrote: Hi Suzy, I can't remember which blog I saw it on (one of the Adobe guys I think), but I saw an example using an IFrame to load the HTML in. Then a custom component in the Flex movie sent messages to Javascript so the IFrame always appeared in the right place and the right size over the Flex page - it worked really nicely and sound like just what you need - sorry I can't be more help, but perhaps this'll jog the memory of someone who as a memory! HTH Phil Suzy Lawson wrote: Hello Group- I have an app that receives XML data over the socket. Specifically, it is data that is in 2 formats (plain text and HTML). The HTML that gets sent represents the FULL html code (i.e. the top-level 'html', 'meta', 'head', 'style', 'div', 'body' tags etc..). Sometimes the tags have namespaces and even 'class' attributes assigned to them which relate to styles defined w/i the style tag. For this reason, I can't just set the XML value to the 'htmlText' attribute of a text field. I tried using the ExternalInterface API and pass the HTML (see example below) to a javscript method which opens a new window and calls 'document.write(passedValueFromFlex)', but that does not work b/c of the extra rows between tags. If I manually remove the white spaces from each row where
[flexcoders] Re: Viewing HTML
Glad to be useful. --- In flexcoders@yahoogroups.com, Suzy Lawson [EMAIL PROTECTED] wrote: Drome- Thank you so much for your help. I was able to modify your regEx to make it work for my needs. I just needed to add in a piece for return characters and form feeds as well. The regex i used was: var pattern:RegExp = /\n|\r|\f/gi var htmlstr : String = htmlTextString.replace(pattern, ); var m:String = ExternalInterface.call (changeDocumentTitle,htmlstr); And the code for the js method being: SCRIPT LANGUAGE=JavaScript function changeDocumentTitle(a) { var generator=window.open('','name','height=400,width=500'); generator.document.write(a); generator.document.close(); return successful;//this gets assigned to flex variable 'm' above } /SCRIPT --- In flexcoders@yahoogroups.com, drome.dario drome.dario@ wrote: Just a thing I missed: I think that the effect being experienced by Suzy is a bug in the flex/flash serializer used by ExternalInterface. Let's hope that some adobe engineer read this or may exist any effective place where to send a request for bug consideration? --- In flexcoders@yahoogroups.com, drome.dario drome.dario@ wrote: Hi, It is not a problem with whitespace between tags, as Suzy said, it is a problem because of the cr/lf in the html code, let me explain: Supose that we have a string variable named param whose value is hello Brian\nHow are you?, then when one uses, i.e., ExternalInterface.call(jsFunc, param) flex tell the browser to evaluate a chunk of javascript code similar to this one: jsFunc(hello Brian How are you?); that is a totally illegal javascript sentence. However, if the value of param is hello Brian\\nHow are you?, then, the javascript code being evaluated would be: jsFunc(hello Brian\nHow are you?); which is good for the javascript interpreter. Thus, the solution is to replace all newline-chars with \\n string: var pattern:RegExp = /\n/gi; htmlstr = htmlstr.replace(pattern, \\n ); ExternalInterface.call(ShowHTML, htmlstr); In that way, the html's original layout is not changed and, the most important: IT WORKS! --- In flexcoders@yahoogroups.com, Brian Riggs bringrags@ wrote: One thing you could try is to assign the String to an (e4x) XML object, set XML.ignoreWhitespace to true, and then output the result using XML.toXMLString(). This should cause whitespace between tags to be stripped out. -- Brian --- In flexcoders@yahoogroups.com, Suzy Lawson suzylawson@ wrote: Christophe's blog in this case doesn't help. His iFrame points to a static HTML page. I have a String like this: //whether it be js or Flex...and my string has spaces b/w lines just like this var htmlString : String = htmlhead titletest/testbodymy body body/html; there's no way I know of to assign this to a new window or Flex object and have it display correctly. If I make the String above lal one line, then it works OK. --- In flexcoders@yahoogroups.com, tonyx_788 tonyx_788@ wrote: hi Suzy i think Phil is talking about coenraets blog, this is the link hope it helps http://www.coenraets.com/apps/iframe/index.htm **Saludos** Tony --- In flexcoders@yahoogroups.com, Phil Marston p.marston@ wrote: Hi Suzy, I can't remember which blog I saw it on (one of the Adobe guys I think), but I saw an example using an IFrame to load the HTML in. Then a custom component in the Flex movie sent messages to Javascript so the IFrame always appeared in the right place and the right size over the Flex page - it worked really nicely and sound like just what you need - sorry I can't be more help, but perhaps this'll jog the memory of someone who as a memory! HTH Phil Suzy Lawson wrote: Hello Group- I have an app that receives XML data over the socket. Specifically, it is data that is in 2 formats (plain text and HTML). The HTML that gets sent represents the FULL html code (i.e. the top- level 'html', 'meta', 'head', 'style', 'div', 'body' tags etc..). Sometimes the tags have namespaces and even 'class' attributes assigned to them which relate to styles defined w/i the style tag. For this reason, I can't just set the XML value to the 'htmlText' attribute of a text field. I tried using the ExternalInterface API and pass the HTML (see
[flexcoders] Re: Viewing HTML
Yeah, that was Christophe's blog I believe. The problem with that is the iFrame is loading an HTML page that already exists on a server. What I need is a way to display HTML stored in client-side memory as a String. (wether it be in javascript or FLex). --- In flexcoders@yahoogroups.com, Phil Marston [EMAIL PROTECTED] wrote: Hi Suzy, I can't remember which blog I saw it on (one of the Adobe guys I think), but I saw an example using an IFrame to load the HTML in. Then a custom component in the Flex movie sent messages to Javascript so the IFrame always appeared in the right place and the right size over the Flex page - it worked really nicely and sound like just what you need - sorry I can't be more help, but perhaps this'll jog the memory of someone who as a memory! HTH Phil Suzy Lawson wrote: Hello Group- I have an app that receives XML data over the socket. Specifically, it is data that is in 2 formats (plain text and HTML). The HTML that gets sent represents the FULL html code (i.e. the top-level 'html', 'meta', 'head', 'style', 'div', 'body' tags etc..). Sometimes the tags have namespaces and even 'class' attributes assigned to them which relate to styles defined w/i the style tag. For this reason, I can't just set the XML value to the 'htmlText' attribute of a text field. I tried using the ExternalInterface API and pass the HTML (see example below) to a javscript method which opens a new window and calls 'document.write(passedValueFromFlex)', but that does not work b/c of the extra rows between tags. If I manually remove the white spaces from each row where the HTML is one long String...it works fine. Using a parser to handle that would be near impossible to create though. Does anyone have any ideas for a solution (to display HTML) Thanks. message plainTextThis is the message./plainText htmlTextlt;htmlgt; lt;headgt; lt;/headgt; lt;body lang=EN-USgt; This is the lt;bgt;messagelt;/bgt;. lt;/bodygt; lt;/htmlgt; /htmlText /message -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links -- __ Phil Marston Learning Technologist Learning Technology Unit Edward Wright G33, University of Aberdeen, Aberdeen, AB24 3QY, UK [EMAIL PROTECTED] Tel: +44(0)1224 273329 / +44(0)7798 723660 http://www.abdn.ac.uk/diss/ltu/pmarston/ http://www.abdn.ac.uk/diss/ltu/ __ The University of Aberdeen Open Day 29th August 2006 Booking is essential www.abdn.ac.uk/openday email [EMAIL PROTECTED] or call 0800 027 1495 Yahoo! Groups Sponsor ~-- Get to your groups with one click. Know instantly when new email arrives http://us.click.yahoo.com/.7bhrC/MGxNAA/yQLSAA/nhFolB/TM ~- -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links * To visit your group on the web, go to: http://groups.yahoo.com/group/flexcoders/ * To unsubscribe from this group, send an email to: [EMAIL PROTECTED] * Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
[flexcoders] Re: Viewing HTML
hi Suzy i think Phil is talking about coenraets blog, this is the link hope it helps http://www.coenraets.com/apps/iframe/index.htm **Saludos** Tony --- In flexcoders@yahoogroups.com, Phil Marston [EMAIL PROTECTED] wrote: Hi Suzy, I can't remember which blog I saw it on (one of the Adobe guys I think), but I saw an example using an IFrame to load the HTML in. Then a custom component in the Flex movie sent messages to Javascript so the IFrame always appeared in the right place and the right size over the Flex page - it worked really nicely and sound like just what you need - sorry I can't be more help, but perhaps this'll jog the memory of someone who as a memory! HTH Phil Suzy Lawson wrote: Hello Group- I have an app that receives XML data over the socket. Specifically, it is data that is in 2 formats (plain text and HTML). The HTML that gets sent represents the FULL html code (i.e. the top-level 'html', 'meta', 'head', 'style', 'div', 'body' tags etc..). Sometimes the tags have namespaces and even 'class' attributes assigned to them which relate to styles defined w/i the style tag. For this reason, I can't just set the XML value to the 'htmlText' attribute of a text field. I tried using the ExternalInterface API and pass the HTML (see example below) to a javscript method which opens a new window and calls 'document.write(passedValueFromFlex)', but that does not work b/c of the extra rows between tags. If I manually remove the white spaces from each row where the HTML is one long String...it works fine. Using a parser to handle that would be near impossible to create though. Does anyone have any ideas for a solution (to display HTML) Thanks. message plainTextThis is the message./plainText htmlTextlt;htmlgt; lt;headgt; lt;/headgt; lt;body lang=EN-USgt; This is the lt;bgt;messagelt;/bgt;. lt;/bodygt; lt;/htmlgt; /htmlText /message -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links -- __ Phil Marston Learning Technologist Learning Technology Unit Edward Wright G33, University of Aberdeen, Aberdeen, AB24 3QY, UK [EMAIL PROTECTED] Tel: +44(0)1224 273329 / +44(0)7798 723660 http://www.abdn.ac.uk/diss/ltu/pmarston/ http://www.abdn.ac.uk/diss/ltu/ __ The University of Aberdeen Open Day 29th August 2006 Booking is essential www.abdn.ac.uk/openday email [EMAIL PROTECTED] or call 0800 027 1495 Yahoo! Groups Sponsor ~-- Get to your groups with one click. Know instantly when new email arrives http://us.click.yahoo.com/.7bhrC/MGxNAA/yQLSAA/nhFolB/TM ~- -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links * To visit your group on the web, go to: http://groups.yahoo.com/group/flexcoders/ * To unsubscribe from this group, send an email to: [EMAIL PROTECTED] * Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
[flexcoders] Re: Viewing HTML
Suzy, Taking Christophe's example, I think that you can inject your in- memory-html into the HTMLDocument inside the iframe. --- In flexcoders@yahoogroups.com, Suzy Lawson [EMAIL PROTECTED] wrote: Yeah, that was Christophe's blog I believe. The problem with that is the iFrame is loading an HTML page that already exists on a server. What I need is a way to display HTML stored in client-side memory as a String. (wether it be in javascript or FLex). --- In flexcoders@yahoogroups.com, Phil Marston p.marston@ wrote: Hi Suzy, I can't remember which blog I saw it on (one of the Adobe guys I think), but I saw an example using an IFrame to load the HTML in. Then a custom component in the Flex movie sent messages to Javascript so the IFrame always appeared in the right place and the right size over the Flex page - it worked really nicely and sound like just what you need - sorry I can't be more help, but perhaps this'll jog the memory of someone who as a memory! HTH Phil Suzy Lawson wrote: Hello Group- I have an app that receives XML data over the socket. Specifically, it is data that is in 2 formats (plain text and HTML). The HTML that gets sent represents the FULL html code (i.e. the top-level 'html', 'meta', 'head', 'style', 'div', 'body' tags etc..). Sometimes the tags have namespaces and even 'class' attributes assigned to them which relate to styles defined w/i the style tag. For this reason, I can't just set the XML value to the 'htmlText' attribute of a text field. I tried using the ExternalInterface API and pass the HTML (see example below) to a javscript method which opens a new window and calls 'document.write(passedValueFromFlex)', but that does not work b/c of the extra rows between tags. If I manually remove the white spaces from each row where the HTML is one long String...it works fine. Using a parser to handle that would be near impossible to create though. Does anyone have any ideas for a solution (to display HTML) Thanks. message plainTextThis is the message./plainText htmlTextlt;htmlgt; lt;headgt; lt;/headgt; lt;body lang=EN-USgt; This is the lt;bgt;messagelt;/bgt;. lt;/bodygt; lt;/htmlgt; /htmlText /message -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links -- __ Phil Marston Learning Technologist Learning Technology Unit Edward Wright G33, University of Aberdeen, Aberdeen, AB24 3QY, UK p.marston@ Tel: +44(0)1224 273329 / +44(0)7798 723660 http://www.abdn.ac.uk/diss/ltu/pmarston/ http://www.abdn.ac.uk/diss/ltu/ __ The University of Aberdeen Open Day 29th August 2006 Booking is essential www.abdn.ac.uk/openday email openday@ or call 0800 027 1495 Yahoo! Groups Sponsor ~-- You can search right from your browser? It's easy and it's free. See how. http://us.click.yahoo.com/_7bhrC/NGxNAA/yQLSAA/nhFolB/TM ~- -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links * To visit your group on the web, go to: http://groups.yahoo.com/group/flexcoders/ * To unsubscribe from this group, send an email to: [EMAIL PROTECTED] * Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
[flexcoders] Re: Viewing HTML
One thing you could try is to assign the String to an (e4x) XML object, set XML.ignoreWhitespace to true, and then output the result using XML.toXMLString(). This should cause whitespace between tags to be stripped out. -- Brian --- In flexcoders@yahoogroups.com, Suzy Lawson [EMAIL PROTECTED] wrote: Christophe's blog in this case doesn't help. His iFrame points to a static HTML page. I have a String like this: //whether it be js or Flex...and my string has spaces b/w lines just like this var htmlString : String = htmlhead titletest/testbodymy body body/html; there's no way I know of to assign this to a new window or Flex object and have it display correctly. If I make the String above lal one line, then it works OK. --- In flexcoders@yahoogroups.com, tonyx_788 tonyx_788@ wrote: hi Suzy i think Phil is talking about coenraets blog, this is the link hope it helps http://www.coenraets.com/apps/iframe/index.htm **Saludos** Tony --- In flexcoders@yahoogroups.com, Phil Marston p.marston@ wrote: Hi Suzy, I can't remember which blog I saw it on (one of the Adobe guys I think), but I saw an example using an IFrame to load the HTML in. Then a custom component in the Flex movie sent messages to Javascript so the IFrame always appeared in the right place and the right size over the Flex page - it worked really nicely and sound like just what you need - sorry I can't be more help, but perhaps this'll jog the memory of someone who as a memory! HTH Phil Suzy Lawson wrote: Hello Group- I have an app that receives XML data over the socket. Specifically, it is data that is in 2 formats (plain text and HTML). The HTML that gets sent represents the FULL html code (i.e. the top-level 'html', 'meta', 'head', 'style', 'div', 'body' tags etc..). Sometimes the tags have namespaces and even 'class' attributes assigned to them which relate to styles defined w/i the style tag. For this reason, I can't just set the XML value to the 'htmlText' attribute of a text field. I tried using the ExternalInterface API and pass the HTML (see example below) to a javscript method which opens a new window and calls 'document.write(passedValueFromFlex)', but that does not work b/c of the extra rows between tags. If I manually remove the white spaces from each row where the HTML is one long String...it works fine. Using a parser to handle that would be near impossible to create though. Does anyone have any ideas for a solution (to display HTML) Thanks. message plainTextThis is the message./plainText htmlTextlt;htmlgt; lt;headgt; lt;/headgt; lt;body lang=EN-USgt; This is the lt;bgt;messagelt;/bgt;. lt;/bodygt; lt;/htmlgt; /htmlText /message -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links -- __ Phil Marston Learning Technologist Learning Technology Unit Edward Wright G33, University of Aberdeen, Aberdeen, AB24 3QY, UK p.marston@ Tel: +44(0)1224 273329 / +44(0)7798 723660 http://www.abdn.ac.uk/diss/ltu/pmarston/ http://www.abdn.ac.uk/diss/ltu/ __ The University of Aberdeen Open Day 29th August 2006 Booking is essential www.abdn.ac.uk/openday email openday@ or call 0800 027 1495 Yahoo! Groups Sponsor ~-- Everything you need is one click away. Make Yahoo! your home page now. http://us.click.yahoo.com/AHchtC/4FxNAA/yQLSAA/nhFolB/TM ~- -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links * To visit your group on the web, go to: http://groups.yahoo.com/group/flexcoders/ * To unsubscribe from this group, send an email to: [EMAIL PROTECTED] * Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
[flexcoders] Re: Viewing HTML
Hi, It is not a problem with whitespace between tags, as Suzy said, it is a problem because of the cr/lf in the html code, let me explain: Supose that we have a string variable named param whose value is hello Brian\nHow are you?, then when one uses, i.e., ExternalInterface.call(jsFunc, param) flex tell the browser to evaluate a chunk of javascript code similar to this one: jsFunc(hello Brian How are you?); that is a totally illegal javascript sentence. However, if the value of param is hello Brian\\nHow are you?, then, the javascript code being evaluated would be: jsFunc(hello Brian\nHow are you?); which is good for the javascript interpreter. Thus, the solution is to replace all newline-chars with \\n string: var pattern:RegExp = /\n/gi; htmlstr = htmlstr.replace(pattern, \\n ); ExternalInterface.call(ShowHTML, htmlstr); In that way, the html's original layout is not changed and, the most important: IT WORKS! --- In flexcoders@yahoogroups.com, Brian Riggs [EMAIL PROTECTED] wrote: One thing you could try is to assign the String to an (e4x) XML object, set XML.ignoreWhitespace to true, and then output the result using XML.toXMLString(). This should cause whitespace between tags to be stripped out. -- Brian --- In flexcoders@yahoogroups.com, Suzy Lawson suzylawson@ wrote: Christophe's blog in this case doesn't help. His iFrame points to a static HTML page. I have a String like this: //whether it be js or Flex...and my string has spaces b/w lines just like this var htmlString : String = htmlhead titletest/testbodymy body body/html; there's no way I know of to assign this to a new window or Flex object and have it display correctly. If I make the String above lal one line, then it works OK. --- In flexcoders@yahoogroups.com, tonyx_788 tonyx_788@ wrote: hi Suzy i think Phil is talking about coenraets blog, this is the link hope it helps http://www.coenraets.com/apps/iframe/index.htm **Saludos** Tony --- In flexcoders@yahoogroups.com, Phil Marston p.marston@ wrote: Hi Suzy, I can't remember which blog I saw it on (one of the Adobe guys I think), but I saw an example using an IFrame to load the HTML in. Then a custom component in the Flex movie sent messages to Javascript so the IFrame always appeared in the right place and the right size over the Flex page - it worked really nicely and sound like just what you need - sorry I can't be more help, but perhaps this'll jog the memory of someone who as a memory! HTH Phil Suzy Lawson wrote: Hello Group- I have an app that receives XML data over the socket. Specifically, it is data that is in 2 formats (plain text and HTML). The HTML that gets sent represents the FULL html code (i.e. the top-level 'html', 'meta', 'head', 'style', 'div', 'body' tags etc..). Sometimes the tags have namespaces and even 'class' attributes assigned to them which relate to styles defined w/i the style tag. For this reason, I can't just set the XML value to the 'htmlText' attribute of a text field. I tried using the ExternalInterface API and pass the HTML (see example below) to a javscript method which opens a new window and calls 'document.write(passedValueFromFlex)', but that does not work b/c of the extra rows between tags. If I manually remove the white spaces from each row where the HTML is one long String...it works fine. Using a parser to handle that would be near impossible to create though. Does anyone have any ideas for a solution (to display HTML) Thanks. message plainTextThis is the message./plainText htmlTextlt;htmlgt; lt;headgt; lt;/headgt; lt;body lang=EN-USgt; This is the lt;bgt;messagelt;/bgt;. lt;/bodygt; lt;/htmlgt; /htmlText /message -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links -- __ Phil Marston Learning Technologist Learning Technology Unit Edward Wright G33, University of Aberdeen, Aberdeen, AB24 3QY, UK p.marston@ Tel: +44(0)1224 273329 / +44(0)7798 723660 http://www.abdn.ac.uk/diss/ltu/pmarston/ http://www.abdn.ac.uk/diss/ltu/ __ The University of Aberdeen Open Day 29th August 2006 Booking is essential
[flexcoders] Re: Viewing HTML
Just a thing I missed: I think that the effect being experienced by Suzy is a bug in the flex/flash serializer used by ExternalInterface. Let's hope that some adobe engineer read this or may exist any effective place where to send a request for bug consideration? --- In flexcoders@yahoogroups.com, drome.dario [EMAIL PROTECTED] wrote: Hi, It is not a problem with whitespace between tags, as Suzy said, it is a problem because of the cr/lf in the html code, let me explain: Supose that we have a string variable named param whose value is hello Brian\nHow are you?, then when one uses, i.e., ExternalInterface.call(jsFunc, param) flex tell the browser to evaluate a chunk of javascript code similar to this one: jsFunc(hello Brian How are you?); that is a totally illegal javascript sentence. However, if the value of param is hello Brian\\nHow are you?, then, the javascript code being evaluated would be: jsFunc(hello Brian\nHow are you?); which is good for the javascript interpreter. Thus, the solution is to replace all newline-chars with \\n string: var pattern:RegExp = /\n/gi; htmlstr = htmlstr.replace(pattern, \\n ); ExternalInterface.call(ShowHTML, htmlstr); In that way, the html's original layout is not changed and, the most important: IT WORKS! --- In flexcoders@yahoogroups.com, Brian Riggs bringrags@ wrote: One thing you could try is to assign the String to an (e4x) XML object, set XML.ignoreWhitespace to true, and then output the result using XML.toXMLString(). This should cause whitespace between tags to be stripped out. -- Brian --- In flexcoders@yahoogroups.com, Suzy Lawson suzylawson@ wrote: Christophe's blog in this case doesn't help. His iFrame points to a static HTML page. I have a String like this: //whether it be js or Flex...and my string has spaces b/w lines just like this var htmlString : String = htmlhead titletest/testbodymy body body/html; there's no way I know of to assign this to a new window or Flex object and have it display correctly. If I make the String above lal one line, then it works OK. --- In flexcoders@yahoogroups.com, tonyx_788 tonyx_788@ wrote: hi Suzy i think Phil is talking about coenraets blog, this is the link hope it helps http://www.coenraets.com/apps/iframe/index.htm **Saludos** Tony --- In flexcoders@yahoogroups.com, Phil Marston p.marston@ wrote: Hi Suzy, I can't remember which blog I saw it on (one of the Adobe guys I think), but I saw an example using an IFrame to load the HTML in. Then a custom component in the Flex movie sent messages to Javascript so the IFrame always appeared in the right place and the right size over the Flex page - it worked really nicely and sound like just what you need - sorry I can't be more help, but perhaps this'll jog the memory of someone who as a memory! HTH Phil Suzy Lawson wrote: Hello Group- I have an app that receives XML data over the socket. Specifically, it is data that is in 2 formats (plain text and HTML). The HTML that gets sent represents the FULL html code (i.e. the top-level 'html', 'meta', 'head', 'style', 'div', 'body' tags etc..). Sometimes the tags have namespaces and even 'class' attributes assigned to them which relate to styles defined w/i the style tag. For this reason, I can't just set the XML value to the 'htmlText' attribute of a text field. I tried using the ExternalInterface API and pass the HTML (see example below) to a javscript method which opens a new window and calls 'document.write(passedValueFromFlex)', but that does not work b/c of the extra rows between tags. If I manually remove the white spaces from each row where the HTML is one long String...it works fine. Using a parser to handle that would be near impossible to create though. Does anyone have any ideas for a solution (to display HTML) Thanks. message plainTextThis is the message./plainText htmlTextlt;htmlgt; lt;headgt; lt;/headgt; lt;body lang=EN-USgt; This is the lt;bgt;messagelt;/bgt;. lt;/bodygt; lt;/htmlgt; /htmlText /message -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links