Reputation: 31
Code is working when testing in Adobe Flash Pro as expected (email application opens and includes subject, name, id, supervisor, score), however whenever I publish and open in either FireFox, IE, or just open the swf player, the email client will open but with all the fields missing including the subject... I love how it works in Flash, and the simplicity of not having to have a server side php, but its not working as expected...
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:[email protected]" + "?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)
Upvotes: 1
Views: 44
Reputation: 51847
That is a security constraint on Flash Player and you have multiple options:
http://localhost
instead of using the file:///
path (or simply upload the .swf file to a website and access if from there)For option 1, you would need to add this exception for every computer you plan to run this .swf locally, therefore option 2 would make more sense.
Option 3 should also be simple enough.
Option 4 may be overkill, unless you need access to nicer native functionalities (like file system access, saving settings, custom icon, minimizing app to systray and potentially publishing to IOS/Android/etc.)
Upvotes: 1