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
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");
}
ASKER
Thanks jen0910,
tried adding these but still the same result (tried IE, FF and Chrome)
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('"translate dText": "');
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 = "AIzaSyAwg6uekHRiwxjj62NNU tmBkRzTkfg KDB8";
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");
}
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('"translate
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'
break;
}
}
};
var lorem_lv:LoadVars = new LoadVars();
lorem_lv.key = "AIzaSyAwg6uekHRiwxjj62NNU
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.
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">
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">
ASKER
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
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.
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
----------
----------
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
----------
ASKER
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.loadPolicy File("https://www.googleapis.com/crossdomain.xml");
System.security.allowDomai n("*")
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-pol icies="mas ter-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-header s-from domain="*" headers="Authorization,Con tent-Type, X-HTTP-Met hod-Overri de,OriginT oken,X-Ori gin,X-Refe rer,X-Clie ntDetails" /> </cross-domain-policy>
stop();
System.security.loadPolicy
System.security.allowDomai
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-pol
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER
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
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.
ASKER
Yes agreed, please close and assign points as you suggest - many thanks
Open in new window