javascript - Crazy "unexpected token illegal" error when calling a Flash ExternalInterface method -


i have swf few publicly accessible methods defined via externalinterface. of methods allow person change text , images in swf. 1 takes "snapshot" of swf -- generates jpg image what's visible, calls global function in javascript binary data of snapshot function's argument. data not in base64 or anything; it's raw bytes string.

function updateswfelement(elementid, val) {   document.getelementbyid("theswf").updateelement(elementid, val); } function takesnapshot() {   document.getelementbyid("theswf").takesnapshot(); // returns undefined } function snapshotcomplete(data) {   // function called asynchronously flash after takesnapshot()    // has completed.   // "data" contains image's bytes. typeof(data) === "string" .   dosomethingwiththedata(data); } 

now turns out specific set of updateelement() calls, calling "takesnapshot()" throw dreaded syntaxerror: unexpected token illegal message. breakpoint set inside snapshotcomplete not fire.

note not same issue others have had "gremlin" gets source code (copy/pasted jsfiddle or whatnot) causes syntax error. there's nothing wrong source files. somehow call method on swf makes js choke up.

my hunch trying shoehorn raw bytes string bad idea, , i've instructed swf author base64-encode output. couldn't think of way prove i'm right.

what think going on here, , what's way test it?

if not author of swf file can write own swf wrapper , call method wrapper swf convert base64 , return javascript. yes, it's little bit tricky :)


Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -