views:

346

answers:

3

We've got a flash file that takes a URL parameter for redirecting on click. When it's hosted from the primary domain, and the SWF is included in HTML from the primary domain, the redirect works properly.

However, when it's hosted on the secondary domain, and the SWF is included in HTML from the primary domain, the redirect doesn't work. I've added a crossdomain.xml file to both the primary and secondary domain, thinking that might help. The contents of both crossdomain.xml files are included below.

What is it that I'm missing?

crossdomain.xml

<cross-domain-policy>
    <allow-access-from domain="*"/>
</cross-domain-policy>

EDIT: Here's the actionscript used for the "redirect".

actionscript

on (release) {
    getURL(clickTag);
}

clickTag is a parameter we're passing in through the querystring.

EDIT: After adding allowScriptAccess="always" to the embed code, and <param name="allowScriptAccess" value="always" /> to the object tag, the window opens, and the location goes to /undefined. Thoughts?

EDIT: As requested, here's the actual object/embed code we're using:

<object type="application/x-shockwave-flash" data="/files/2348.swc" width="300" height="250" class="ad" onclick="ad_click(169);">
<param name="movie" value="/files/2348.swc?clickTAG=http://www.google.com"/&gt; 
<param value="high" name="quality"> 
<param value="#FFFFFF" name="bgcolor"> 
<param value="always" name="allowScriptAccess"> 
<param value="transparent" name="wmode">
</object> 
+1  A: 

Try setting allowScriptAccess to always in the object and embed tags of the including HTML.

The default value is "sameDomain" for recent versions of Flash Player, which explains your current behavior.


For your edit, it may help to have more information, but you likely need to access your parameters using _root or _level0, rather than directly as above. See Adobe's docs on this problem and description of _root.


Based on your embed code, I still think it may be worth your while to look into _root.

Your object tag is a bit nonstandard, so there may be some issues:

  1. You seem to have the case issues suggested by Josh here: clickTag vs clickTAG
  2. Does it help to add the parameter to the data attribute URL?
  3. Perhaps trying the Adobe suggested tags would help?
  4. Also, what's the significance of packaging your file as a SWC rather than a SWF?

If you have control over the SWF, you might consider going directly to FlashVars.

Michael Brewer-Davis
A: 

to answer the second part of the question regarding the undefined - the click tag is case sensitive make sure the parameter and variable match case or you could add the following snippet just to be sure:

on (release) {
   var myCT:String = clickTAG;
   if(myCT == ""){
      myCT = clickTag;
   } 
   if(myCT == ""){
      myCT = clicktag;
   } 
   getURL(myCT, "_blank"); 
}
Josh
A: 

Perhaps you could use Javascript to do the actual redirection.

For example, from the AS3 code, use ExternalInterface to call a JS function that does the redirect.

import flash.external.ExternalInterface; var retval:int = ExternalInterface.call("redirect()", "http://the_redirect_url/");

Then in the JS:

function redirect(url) { window.location = url; }

Disclaimer: haven't tested it. ;-)

Tom