PDA

View Full Version : passing html into flashvars with swfobject


tophers78
07-22-2009, 04:41 AM
My apologies if anyone is seeing this twice. I absent-mindedly posted this in the AS3 forum (It's where I'm used to looking...I didn't even realize there was a javascript section).

Anyway...

I'm trying to embed my .swf file with swfobject, and pass the parent html code to the flash file as a string. Instead of loading the entire XML page in my flash file, it seems like I ought to be able to pass the relevant portion of the site (the portion I'm replacing with Flash) into the flash file and use that as a smaller chunk of XML.

When I attempt to pass the parent element as a string, however, it breaks the code and swfobject will not embed my flash.

Here is the javascript:


// FLASH EMBED

// Page Title
var parent1 = document.getElementById('pageTitle');

var flashvars = {};
flashvars.parentXML = parent1.toString();

var params = {};
params.scale = "noscale";
params.salign = "tl";
params.wmode = "transparent";

var attributes = {};

The offending line of code is:
flashvars.parentXML = parent1.toString();

if I add toString() it breaks swfobject. If I don't attempt to convert the html to a string, then it runs the flash embed...but I'm not sure what it's passing into Flash. Flash does not seem to be receiving either a string or html code.

Am I attempting something possible? Any ideas how to make it work?

thanks,
chris