el Dude
el Dude

Reputation: 5183

flash as3 passing string with special characters (like newlines `\n`) from JS to flash

I've encountered with followng:

for example we have html

<div id="123">123\n456</div>

when I take div's contents as innerHTML

var a = document.getElementById('123').innerHTML

and pass it to a flash object

top.flashObj.FlashFunction(a);

then it treats it not as 123\n456 but

123
456

I mean that a var comes in flash with REAL newline character.

What should I do to avoid such things as passing vars with special chars JS>SWF and vice versa?

Upvotes: 0

Views: 309

Answers (1)

Bennett Keller
Bennett Keller

Reputation: 1714

I'll usually do \\n instead and then run a regex replace on it:

myString.replace( /\\\n/g, "\n" );

Upvotes: 1

Related Questions