Advertisement

11.02.2007 at 08:05AM PDT, ID: 22934988
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

7.6

Problem passing Flashvars variables in URL with AC_FL_RunContent

Asked by grinchikins in Macromedia Flash

Tags: ,

Hello,

I've read the tutorials and posts at Adobe but can't get this to work. My url passes this to the page with my.swf movie:

Code:

http://www.etc/myswf.html?var1=3&var2=A

var1 and var 2 are set depending on the button pressed on the previous page.
This is what I have for the code on the page with my.swf - but it doesn't work. Any suggestions?

script language="javascript">AC_FL_RunContent = 0;</script>
<script src="AC_RunActiveContent.js" language="javascript"></script>

html body etc ...

<script language="javascript">
    if (AC_FL_RunContent == 0) {
        alert("This page requires AC_RunActiveContent.js. In Flash, run \"Apply Active Content Update\" in the Commands menu to copy AC_RunActiveContent.js to the HTML output folder.");
    } else {
        AC_FL_RunContent(
            'codebase', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0',
            'width', '800',
            'height', '600',
            'src', 'myswf',
            'quality', 'high',
            'pluginspage', 'http://www.macromedia.com/go/getflashplayer',
            'align', 'middle',
            'play', 'true',
            'loop', 'true',
            'scale', 'showall',
            'wmode', 'window',
            'devicefont', 'false',
            'id', 'myswf',
            'bgcolor', '#ffcc00',
            'name', 'myswf',
            'menu', 'true',
            'allowScriptAccess','sameDomain',
            'movie', 'myswf',
            'FlashVars', 'var1=var1&var2=var2',
            'salign', ''        
            ); //end AC code
    }
</script>
<noscript>
    <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="800" height="600" id="myswf" align="middle">
    <param name="allowScriptAccess" value="sameDomain" />        
    <param name="movie" value="myswf.swf" />
    <param name="quality" value="high" />
    <param name="bgcolor" value="#ffcc00" />
    <param name="FlashVars" value="var1=var1&var2=var2">
   
    <embed src="my.swf" FlashVars="var1=var1&var2=var2" quality="high" bgcolor="#ffcc00" width="800" height="600" name="myswf" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
    </object>

I have "var1=var1&var2=var2" this way because in myswf.fla movie I pick up var1 = var1 from the URL and var2 = var2.

The old method that I used with JavaScript worked but did not contain the AC_FL_RunContent code which is needed now for IE.  I tried to combine the two methods but haven't had success yet.

<script language="JavaScript">
var1 = "some value";     // Set default values in case not set in URL
var2 = "another variable!";
var p=location.search.substring(1).replace(/\+/g,' ').split("&");
for(var i=0;i<p.length;i++){
  v=p[i].split("=");
     window[unescape(v[0]).toLowerCase()]=unescape(v[1]);
}
window.alert("var1=" + var1);
window.alert("var2=" + var2);

</script>

... and in the body

<script language="JavaScript">
document.write("<object><PARAM NAME=FlashVars VALUE=\"var1="+var1+"&var2="+var2+"\">");

document.write("<EMBED name=\"movie\" src=\"signSearch.swf\" ");
document.write("FlashVars=\"var1="+var1+"&var2="+var2+"\" ");
document.write("width=\"800\" height=\"600\" type=\"application/x-shockwave-flash\" ");
document.write("bgcolor=#ffcc00");  //Add any additional object parameters you may require such as bgColor, etc
document.write(" pluginspage=\"http://www.macromedia.com/go/getflashplayer\"");
document.write("></EMBED></object>");
</script>

Thanks!
CharlesStart Free Trial
[+][-]11.07.2007 at 08:20PM PST, ID: 20239167

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Macromedia Flash
Tags: ac_fl_runcontent, flashvars
Sign Up Now!
Solution Provided By: driscolltm
Participating Experts: 2
Solution Grade: B
 
 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628