So after spending two solid days trying to get FlashVars to implement passing a simple line of text, and crying and screaming and cursing and reading 4,000 tutorials (all of which said to do the same thing, WHICH I WAS ALREADY DOING!!) I finally figured out that in was ac_fl_runcontent which was boning me!
AARRRRGGGHHH!!!
Long story short: you've got to put FlashVars in Params, and the embed and ac_fl_runcontent to get it to work everywhere.
Just thought I'd share.
if it happened anything like it does to me you would have found out a heap of other stuff you didn't need to but is still handy to know 
Yeah. I love spending two days solving a 2 minute problem.
It'd be nice if Adobe'd update their KnowledgeBase articles to tell you that that shit doesn't work anymore, though, huh?
yes it would be nice. How'd you work it out in the end, something click from an article you read or only after looking at the code for the millionth time?
in as3 flashVars are dif too.
have to peek into the loaderInfo
var paramObj:Object = LoaderInfo(this.root.loaderInfo).parameters;
Originally posted by: tenPlus yes it would be nice. How'd you work it out in the end, something click from an article you read or only after looking at the code for the millionth time?
B, Alex!
There's something that's worked for me over the years quite often: getting my wife to help debug the code. She knows nothing about programming. At all. I pull up the code and explain it to her, and she asks 1000 stupid, irrelevant questions and, 90% of the time, in the middle of explaining to her why this or that isn't important to the problem, a light goes on.
I was staring at the flash embed code and I kept seeing the acfl_runcontent section at the very top of the page and, eventually, a light bulb went on. I wonder, sez I, if I could just add a FlashVars parameter to that list, and _viola!
er not sure I followed the problem solutions so clarification for when it f's me over would be cool. Oh and you are very lucky to have a wife that will entertain trying to help with code!
I have to admit the same MC, and the process is similar. To my wifes' credit she does have a bit of a grasp though but it does help during those times you hit a wall in frustration.
J - while it is fortunate to have a wife who entertains with code help I do have to time it right or she won't help at all. It doesn't come on tap
Original Code: VarTest01 AC_FL_RunContent = 0; if (AC_FL_RunContent == 0) { alert("This page requires AC_RunActiveContent.js."); } else { AC_FL_RunContent( 'codebase', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0', 'width', '500', 'height', '188', 'src', 'VarTest01', 'quality', 'high', 'pluginspage', 'http://www.macromedia.com/go/getflashplayer', 'align', 'middle', 'play', 'true', 'loop', 'true', 'scale', 'showall', 'wmode', 'window', 'devicefont', 'false', 'id', 'VarTest01', 'bgcolor', '#dacbb4', 'name', 'VarTest01', 'menu', 'true', 'allowFullScreen', 'false', 'allowScriptAccess','sameDomain', 'movie', 'VarTest01', 'salign', '' ); //end AC code }
Now, to pass variables via FlashVars, all the tutorials and the Adobe knowledgebase, tell you you need to add it to the HTML code in two places, in the object and the embed tags:
VarTest01
AC_FL_RunContent = 0;
if (AC_FL_RunContent == 0) {
alert("This page requires AC_RunActiveContent.js.");
} else {
AC_FL_RunContent(
'codebase', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0',
'width', '500',
'height', '188',
'src', 'VarTest01',
'quality', 'high',
'pluginspage', 'http://www.macromedia.com/go/getflashplayer',
'align', 'middle',
'play', 'true',
'loop', 'true',
'scale', 'showall',
'wmode', 'window',
'devicefont', 'false',
'id', 'VarTest01',
'FlashVars','passText=Give me the password!&MCText=We Service the Needs of the Men who Service the Needs of the People. ',
'bgcolor', '#dacbb4',
'name', 'VarTest01',
'menu', 'true',
'allowFullScreen', 'false',
'allowScriptAccess','sameDomain',
'movie', 'VarTest01',
'salign', ''
); //end AC code
}
But they don't mention that the new method of loading Flash content via js means that you need to add FlashVars up there, too:
VarTest01
AC_FL_RunContent = 0;
if (AC_FL_RunContent == 0) {
alert("This page requires AC_RunActiveContent.js.");
} else {
AC_FL_RunContent(
'codebase', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0',
'width', '500',
'height', '188',
'src', 'VarTest01',
'quality', 'high',
'pluginspage', 'http://www.macromedia.com/go/getflashplayer',
'align', 'middle',
'play', 'true',
'loop', 'true',
'scale', 'showall',
'wmode', 'window',
'devicefont', 'false',
'id', 'VarTest01',
'FlashVars','passText=Give me the password!&MCText=We Service the Needs of the Men who Service the Needs of the People. ',
'bgcolor', '#dacbb4',
'name', 'VarTest01',
'menu', 'true',
'allowFullScreen', 'false',
'allowScriptAccess','sameDomain',
'movie', 'VarTest01',
'salign', ''
); //end AC code
}
In this case, I'm using it to send short text strings to dynamic text within Flash
That's brilliant MC I am sure that info will come in useful.
What on Earth is AC_RunActiveContent.js?
Is it adobe's ripoff of swfObject? They ripped off Crafty's JS comm object, so it wouldn't surprise me.
You do realize the noscript chunk only runs if the user has JS disabled and that this active content class is the thing that's actually injecting the swf onto the page? This is why you needed the vars there.
Use swfObject. Mantra. o_0
Also in your no script html block I would suggest running an alternative swf to check for flash since this AC_RunActiveContent won't run, it can't check for you.
sigh. why does adobe make these things so difficult?
Use swfObject.
mantra.
thanks persist for keeping us on the right path, and saving me trying to workout all that html posted.
As for adobe making things difficult are you refering to things like http://www.unitzeroone.com/blog/flash/the_latest_flash_9_breaks_stuf.html
You mentioned Contribute awhile back as good for non-savy clients to get formated text into flash, is this still a good path to investigate?
Originally posted by: persist What on Earth is AC_RunActiveContent.js?
Is it adobe's ripoff of swfObject? They ripped off Crafty's JS comm object, so it wouldn't surprise me.
You do realize the noscript chunk only runs if the user has JS disabled and that this active content class is the thing that's actually injecting the swf onto the page? This is why you needed the vars there.
Use swfObject. Mantra. o_0
Also in your no script html block I would suggest running an alternative swf to check for flash since this AC_RunActiveContent won't run, it can't check for you.
sigh. why does adobe make these things so difficult?
Use swfObject.
mantra.
That code is generated in Dreamweaver when I embed a Flash object in the page. Flash embeds pretty much the same code. :shrug:
I was trying to avoid having to learn yet another tool.
Also, I don't understand how SWFobject is fundamentally different from ac_fl_runcontent.
If you download it there are a couple of examples, I stripped out the html text from one as a rough test today and I never touch Html (so if there is lots more stuff I should have removed sorry!).
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <!-- saved from url=(0014)about:internet --> Main <!-- SWFObject embed by Geoff Stearns geoff@deconcept.comhttp://blog.deconcept.com/swfobject/ -->
body {
background-color: #eeeeee;
font: .8em/1.3em verdana,arial,helvetica,sans-serif;
}
#info {
width: 300px;
overflow: auto;
}
#flashcontent {
border: solid 1px #000;
width: 300px;
height: 300px;
float: left;
margin: 15px 20px;
}
<div id="flashcontent">
<strong>You need to upgrade your Flash Player</strong>
This is replaced by the Flash content.
Place your alternate content here and users without the Flash plugin or with
Javascript turned off will see this. Content here allows you to leave out <code>noscript</code>
tags. Include a link to <a href="expressinstall.html?detectflash=false">bypass the detection</a> if you wish.
</div>
<script type="text/javascript">
// <![CDATA[
var so = new SWFObject("Main.swf", "main", "300", "300", "9", "#FF6600");
//so.addVariable("flashVarText", "this is passed in via FlashVars"); // this line is optional, but this example uses the variable and displays this text inside the flash movie
so.useExpressInstall('expressinstall.swf');
so.write("flashcontent");
// ]]>
</script>
and renamed it index.html to test compiling and running the sdk from textmate. Apparently if your using flash you can set it up as a template that flash can use. From reading peoples blogs swfobject is the way to go, so its fine with me.
I am only writting this to say it seems fairly easy to use, I am sure if you google using it with dreamweaver you will find some good stuff.
The question remains - without disrespect or snottiness - why is is better to use this javascript loader setup than the one Adobe uses by default?
Swf Object's technique is one of tiered experience. Younever force the user to do anything. When you load the page you setup in the flashcontent div any html you want. You can have non flash content, a message and link to flash, an older, less capable swf, you can even setup nested swf objects to serve different content depending upon the capability of the Browser. swfObject at once checks for JavaScript, Flash and does all the work for you since your displaying fallback content by default. It's taking the traditional approach of putting Flash in the page and reversing it.
Think of it this way. You have a kickass html page. The page detects for conditions. If the user has JS, you can give them more. If they have JS and Flash you can make the page even better. But you never serve them a broken page or make them have to navigate away.
Hmmm... The only reason I've got js in here at all is to load my Flash content.
So you're saying it gives me a cleaner way of dealing with Flash detection, somehow?