In a previous post I was writing about a fix to remove the Press Spacebar or Enter to activate or use this control message. But it also made a mess out of a flash file I was trying to use. After a lot of looking into the source code (Flex) and trying to understand what happened, I found a solution.

First of all, you will find a lot of web pages advocating using a parameter called flashVars for sending parameters to Flash applications. Then you would use Application.application.parameters to get the variables URLEncoded in flashVars. That works in most cases, but not when:
a. you used an IE fix for the annoying message
b. you have in the movie and/or src parameters an url that has parameters. (like when you would get the SWF file out from an HttpHandler, for example)

The solution is to put all the variables you would put in the flashVars in the url of the movie or src parameters.

So, instead of :
<param name='movie' value='test.swf' />
<param name='flashVars' value='a=%27test%27&b=12' />

<param name='movie' value='test.swf?a=%27test%27&b=12' />

Don't forget to UrlEncode the values.

But why does this happen? Apparently, the problem is that after setting the innerHTML property the FlashVars param element has an empty value. I tried to fix the javascript to 1. get the value of FlashVars 2. do the fix 3. replace the empty FlashVars value with the saved value. It did not work! Even by javascript, after finding the param element with the name of FlashVars and an empty value, I could not set the value of the element. It probably has to do with the IE "fix". Something must clear the FlashVars when being set from anything else but from source.

Ok, the why is something I could never truly understand. It's some lawyer thing. But the fact remains that Microsoft was legally bound to show that message on each ActiveX control in Internet Explorer, thus screwing everybody and all their Flash pages.

When you Google this you find a miriad solutions. Some of them rewrite the entire HTML, others just take all the objects and embeds and rewrite their innerHTML or their outerHtml. But sometimes, it just seems that none of them work. And here is the catch for all of them: in order to work, the function that does the replacing of the HTML must be in an external Javascript file. Yes, you read right, if the function is inside the page, it doesn't work. Weird, huh?

Anyway, here is the script I use. It works, apparently.

function fixFlash() {
//ediy v2

For more information about other solutions and the legal issue between Microsoft and Eolas read this specialised blog: IE ActiveX Change "Click to activate and use this control"

Well, I noticed that the Flash file I wanted to use stopped working after using this fix. Luckily I had the source and so I found a fix. The next post details it.