You can reuse the same javascript variable names over and over again, to 
embed multiple SWFs. In fact, just separating into multiple script blocks 
doesn't do anything magical in terms of scoping your variables, you're 
already reusing them and you didn't even know it.

So, the bottom line is, you can do it all with one script block, and just 
use the same variable names over and over for each SWF, and you're fine. In 
addition, you can also move the contents of that same single script block 
(with reused names) to an external file just fine. Just make sure you link 
THAT script from the HEAD of your document to make sure your SWF replacement 
happens as early in DOM loading as possible.

It would look like this:

var flashvars = { ... }; // notice the "var" declaration on the first usage 
of each variable name.
var params = { ... };
var attrs = { ... };

swfobject.embedSWF(....,flashvars,params,attrs);

flashvars = { ... }; // notice no need for "var" since you are reusing same 
variable. doesn't hurt, but is unnecessary.
params = { ... };
attrs = { ... };

swfobject.embedSWF(...,flashvars,params,attrs);



--Kyle




--------------------------------------------------
From: "$200 Deep Cleaning" <[email protected]>
Sent: Wednesday, June 10, 2009 2:27 PM
To: "SWFObject" <[email protected]>
Subject: header scripts in external js file

>
> I have 6 different flash files on my html page which takes 6 swfobject
> chunks in my <head>. I was trying to figure out if I could move all of
> those into one external file, but quickly realized then I would have a
> bunch of vars with the same name without the script tags separating
> them. Would the only way to do that be to make a new js file for each
> one? If it is then I guess I'll just leave them in <head>
> >
> 

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"SWFObject" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/swfobject?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to