Link to home
Create AccountLog in
Avatar of tomdenton
tomdenton

asked on

An https: link does not work in flash when uploaded but ok on my desktop

Hi, thanks to help already from some of you guys I have a nice Google translate option built into a flash file. But I have one major issue - it works fine when run the swf on my desktop but not when uploaded to my website (1and1 host). This full version has many other features and links built in that work ok but the Google V2 translate part does not.

I have pasted the code for a simple version without any other clutter. This has the same issue as the full version ie it works ok locally but not online at:
http://www.atttraining.com/test.html
it has one button for the code and one textbox for text purpose. I have left my Google key in for test purpose and will change this later.

The google link is https and all my others are http - not sure if that is an issue?

Suggestions appreciated (oh I have wrapped the swf in html and uploaded /Scripts as created by Dreamweaver)
Tom
on (release) {
	var result_lv:LoadVars = new LoadVars();
	result_lv.onData = function(str:String) {
		var lines:Array = str.split('\n');
		for(var l:Number = 0; l < lines.length; l++){
			var line:Array = lines[l].split('"translatedText": "');
			if(line.length == 2){
				var translatedText:String = line[1].substring(0, line[1].length - 1); // remove last "
				txtContent.text = translatedText.split('\\r').join('\n').split('\\"').join("'"); 
				break;
			}
		}
	};
	var lorem_lv:LoadVars = new LoadVars();
	lorem_lv.key = "AIzaSyAwg6uekHRiwxjj62NNUtmBkRzTkfgKDB8";
	lorem_lv.prettyprint = true;
	lorem_lv.source = "en";
	lorem_lv.target = "es";
	lorem_lv.q = txtContent.text;
	lorem_lv.format = "text";
	lorem_lv.sendAndLoad("https://www.googleapis.com/language/translate/v2", result_lv, "GET");
}

Open in new window

Avatar of Jen0910
Jen0910
Flag of United States of America image

interesting, you may need to tell your host that it's ok to communicate with another host, so try adding some prams's to your embed code, see if that works. They should be default but we can try it:

<body>
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="640" height="470" id="FlashID" title="translate">
  <param name="movie" value="test.swf" />
  <param name="quality" value="high" />
  <param name="wmode" value="opaque" />
  <param name="swfversion" value="11.0.0.0" />
<param name="allowscriptaccess" value="always">
<param name="allownetworking" value="all">

  <!-- This param tag prompts users with Flash Player 6.0 r65 and higher to download the latest version of Flash Player. Delete it if you don’t want users to see the prompt. -->
  <param name="expressinstall" value="Scripts/expressInstall.swf" />
  <!-- Next object tag is for non-IE browsers. So hide it from IE using IECC. -->
  <!--[if !IE]>-->
  <object type="application/x-shockwave-flash" data="test.swf" width="640" height="470">
    <!--<![endif]-->
    <param name="quality" value="high" />
    <param name="wmode" value="opaque" />
    <param name="swfversion" value="11.0.0.0" />
    <param name="expressinstall" value="Scripts/expressInstall.swf" />
<param name="allowscriptaccess" value="always">
<param name="allownetworking" value="all">

    <!-- The browser displays the following alternative content for users with Flash Player 6.0 and older. -->
    <div>
      <h4>Content on this page requires a newer version of Adobe Flash Player.</h4>
      <p><a href="http://www.adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" width="112" height="33" /></a></p>
    </div>
    <!--[if !IE]>-->
  </object>
  <!--<![endif]-->
</object>
<script type="text/javascript">
swfobject.registerObject("FlashID");
</script>
</body>

Open in new window

Avatar of tomdenton
tomdenton

ASKER

Thanks jen0910,

tried adding these but still the same result (tried IE, FF and Chrome)
Why are you forcing users downloading Flash Player 11?
You are using AS2 you can refer to Flash Player starts from version 8 or 7

Please attach your FLA file in CS4 format. Plus create some text field or add couple traces in your code for validating actions

on (release) {
      trace("ON RELEASE");
      var result_lv:LoadVars = new LoadVars();
      result_lv.onData = function(str:String) {
            trace("ON DATA");
            var lines:Array = str.split('\n');
            trace("LINES: " + lines);
            for(var l:Number = 0; l < lines.length; l++){
                  var line:Array = lines[l].split('"translatedText": "');
                  trace("LINE: " + line);
                  if(line.length == 2){
                        var translatedText:String = line[1].substring(0, line[1].length - 1); // remove last "
                        txtContent.text = translatedText.split('\\r').join('\n').split('\\"').join("'");
                        break;
                  }
            }
      };
      var lorem_lv:LoadVars = new LoadVars();
      lorem_lv.key = "AIzaSyAwg6uekHRiwxjj62NNUtmBkRzTkfgKDB8";
      lorem_lv.prettyprint = true;
      lorem_lv.source = "en";
      lorem_lv.target = "es";
      lorem_lv.q = txtContent.text;
      lorem_lv.format = "text";
      lorem_lv.sendAndLoad("https://www.googleapis.com/language/translate/v2", result_lv, "GET");
}
have you tried removing the "s" from "https://"?

I visited the link with and without the s and it appears the code is the same on both.
Your problem with Security Sandbox Violation

Connection to https://www.googleapis.com/language/translate/v2?format=text&q=Hello%20World%0D&target=es&source=en&prettyprint=true&key=AIzaSyAwg6uekHRiwxjj62NNUtmBkRzTkfgKDB8 halted - not permitted from http://www.atttraining.com/test.swf

Why did you add networking as parameter that may cause this issue, please remove this param and modify these two

<param name="swfversion" value="8.0.0.0">
<param name="allowScriptAccess" value="always">
I removed the network param and reset version to 8 (no reason for 11!) and script access but still no go. also added the traces as suggested

EE would not let me upload the files (not allowed extensions dunno why) so the fla and html are uploaded here: www.atttraining.com/test.zip 
Networking pram will not block anything, actually stops the browser from blocking and tells it that it's ok to communicate with other domains. some hosts will block interactions from 3rd party plugins (flash player) by default depending on their own security settings.

If you are changing your swf version pram you will need to make sure you are not exporting your SWF for version 11. if you change the pram but not the export value within flash, you will cause issues for users with lower versions trying to run your SWF exported for 11, and they will see a blank screen. You can see what swf version you are exporting in the publish settings dialog.
I can see only these outputs

----------
TIMES UP!: 1474
----------
Error: Request for resource at https://www.googleapis.com/language/translate/v2?format=text&q=Hello%20World%0D&target=es&source=en&prettyprint=true&key=AIzaSyAwg6uekHRiwxjj62NNUtmBkRzTkfgKDB8 by requestor from http://www.atttraining.com/test.swf is denied due to lack of policy file permissions.
*** Security Sandbox Violation ***
Connection to https://www.googleapis.com/language/translate/v2?format=text&q=Hello%20World%0D&target=es&source=en&prettyprint=true&key=AIzaSyAwg6uekHRiwxjj62NNUtmBkRzTkfgKDB8 halted - not permitted from http://www.atttraining.com/test.swf
----------
TIMES UP!: 1475
----------
policy file permissions...hmm, maybe there is a server key setting or something i need to make, will check on the Google translate site later and report back
I tried adding security policy but still not working. I think Google allowing by domain

stop();

System.security.loadPolicyFile("https://www.googleapis.com/crossdomain.xml");
System.security.allowDomain("*")

Here is crossdomain.xml



<?xml version="1.0"?>

<!DOCTYPE cross-domain-policy SYSTEM "http://www.macromedia.com/xml/dtds/crossdomain-policy.dtd">
-<cross-domain-policy> <site-control permitted-cross-domain-policies="master-only"/> <allow-access-from secure="false" domain="*.google.com"/> <allow-access-from secure="false" domain="*.doubleclick.com"/> <allow-access-from secure="false" domain="*.doubleclick.net"/> <allow-access-from secure="false" domain="*.gstatic.com"/> <allow-access-from secure="false" domain="*.teracent.net"/> <allow-access-from secure="false" domain="*.2mdn.net"/> <allow-http-request-headers-from domain="*" headers="Authorization,Content-Type,X-HTTP-Method-Override,OriginToken,X-Origin,X-Referer,X-ClientDetails"/> </cross-domain-policy>
ASKER CERTIFIED SOLUTION
Avatar of dgofman
dgofman
Flag of United States of America image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
Thanks, i dont embed the key in the final version i just put it back here for easier testing, but thanks for the tip

I will try the server script as you suggest
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
Yes agreed, please close and assign points as you suggest - many thanks