PDA

View Full Version : pass FlashVars via AC_RunActiveContent.js


CPedrick
11-09-2006, 08:03 PM
I've been using AC_RunActiveContent.js to load embedded flash objects to avoid the "click to activate" problem.
I need to pass a variable into the embedded object and would like to use FlashVars to do it, but don't see where that parameter is set in AC_RunActiveContent.js.
I'm finding the javascript hard to read because whomever wrote it didn't comment the code at all.
Is it possible to pass FlashVars using this utility?
How do I need to change the code to do that?
TIA,
Carolyn

Cota
11-09-2006, 08:28 PM
You'd be better off using swfObject, so much easier to use in general.
http://blog.deconcept.com/swfobject/

With AC_RunActiveContent you'll have to add them to the document.writes in the js file, basically like you normally would do.

CPedrick
11-10-2006, 04:30 PM
I've downloaded SWFObject and you're right - in general I like it much better.
One problem: I can't seem to get the Flash object to center in the window. It always appears slapped left.
I tried removing the "float: left;" in the sample #flashcontent style provided, and I also tried putting the content in a table, centered, in a table cell, centered, and centering the containing DIV tag. All to no avail.
Anybody got any thoughts on what else I might try?
TIA,
Carolyn

CPedrick
11-10-2006, 07:30 PM
Nevermind.... (as they say).
I figured it out.
The "sample" html file that explains SWFObject includes a #flashcontent style. I deleted it and the object nicely sits aligned in the center of the window.
I am mystified as to why this created a problem since there was no mention of alignment in the style - only height and width, but cutting it out appears to have solved the issue and I won't argue with success...

Cota
11-10-2006, 07:40 PM
And adding Flashvars is easy. Glad you got it sorted.

multicereal
10-16-2007, 09:06 AM
bit of a late reply but i just wanna note it's possible without modifying the AC_RunActiveContent.js file.

just add your variables as a querystring in this line (html file):
...
'movie', 'yourMovieName?var1=something&var2=something',
...
don't write '.swf', the script will add this.
the variables will be available on the _root

Petruza.com.ar
04-04-2008, 11:09 PM
Thanks multicereal! that's what I was looking for.
Indeed, I tryed another thing and worked:
Add a name-value pair at the parameter list of the AC_FL_RunContent() function call, like this:

AC_FL_RunContent(
'movie', 'MyMovie',
'width', '550',
'height', '400',
[...]
'FlashVars', 'one_var=1&other_var=2'
); //end AC code