Mailto适用于Flash Pro但不适用于发布时

时间:2016-09-01 18:20:24

标签: actionscript-3 mailto

在Adobe Flash Pro中按预期进行测试时代码正常工作(电子邮件应用程序打开并包含主题,名称,ID,主管,分数),但无论何时我在FireFox,IE中打开并打开,或者只是打开swf播放器,电子邮件客户端将打开,但缺少所有字段,包括主题...我喜欢它在Flash中的工作方式,以及不必拥有服务器端php的简单性,但它不能按预期工作......

stop();

import flash.net.URLRequest;
import flash.net.URLVariables;
import flash.net.URLRequestMethod;
import flash.net.URLLoader;


// Variables
nameout_txt.text = names;
idout_txt.text = id;
supervisorout_txt.text = supervisor;
score.text = myscore+"";

//Email
var Email:URLRequest = new URLRequest
("mailto:ra@email.org" + "?subject=WOE Certificate" + "   " + names +    "&body=" + "Name: " + names + "\nEID: " 
 +id + "\nSupervisor Name: "+ supervisor + "\nScore: " + myscore);
emailbtn.addEventListener(MouseEvent.CLICK,emailCert);

function emailCert(event:MouseEvent):void {
navigateToURL(Email," _blank" ) ;
}


//Array to hold a list of the weekdays.
var weekdays:Array = new Array ("Sunday","Monday","Tuesday","Wednesday",
"Thursday","Friday","Saturday");

//Array to hold a list of the months.
var months:Array = new Array ("Jan","Feb","Mar","Apr","May","Jun","Jul",
"Aug", "Sep", "Oct","Nov","Dec");

//Adds an event listener to the dymanic text field.
the_date_txt.addEventListener(Event.ENTER_FRAME,showDate);

function showDate(event:Event):void {
//Create a new instance of the date class.
var myDate:Date = new Date();

//Retrieve the day, month and year from the date class.
var theDay=weekdays[myDate.getDay()];
var theMonth=months[myDate.getMonth()];
var theDate=myDate.getDate();
var theYear=myDate.getFullYear();

//Display the date in the dynamic text field.
the_date_txt.text=theDay+", "+theMonth+" "+theDate+", "+theYear;
}

/* Printing... */
/* Button */


print_btn.addEventListener(MouseEvent.CLICK,    fl_ClickToGoToAndPlayFromFrame_3);

function fl_ClickToGoToAndPlayFromFrame_3(event:MouseEvent):void
{
gotoAndPlay(14);
}
trace(myscore)

Working Correctly Not working

1 个答案:

答案 0 :(得分:1)

这是Flash Player的安全约束,您有多个选项:

  1. 如果要在本地运行swf文件,可以在Global Security Settings Panel
  2. 中添加例外
  3. 在Windows上,使用Flash Player.exe导出.exe投影机文件
  4. 使用本地网络服务器(例如XAMP)并从http://localhost加载文件,而不是使用file:///路径(或者只是将.swf文件上传到网站,如果来自有)
  5. 发布AIR而不是Flash Player
  6. 的文件

    对于选项1,您需要为计划在本地运行此.swf的每台计算机添加此例外,因此选项2更有意义。

    选项3也应该足够简单。

    选项4可能过度,除非您需要访问更好的原生功能(例如文件系统访问,保存设置,自定义图标,最小化应用程序到系统托管以及可能发布到IOS / Android /等。)