Skip to main content
Known Participant
May 28, 2014
Question

Mailto Question

  • May 28, 2014
  • 1 reply
  • 258 views

Hi everyone!

I would like to know how to pass the percGlobal variable that I created in the for loop into the body of the email that is created in the function below. Right now all it prints in the body of the email is: 

percGlobal + percent

Thanks!

var nScore:Number = 0;
var nTotal:Number = 0;
var nPercentage:Number = 0;

for(var i:Number = 0; i < aQuestions.length; i++)

{
var percGlobal;
     this["userAnswer" + i + "_txt"].text = aUserAnswers;
     this["correctAnswer" + i + "_txt"].text = aCorrectAnswers;
     if(aUserAnswers.toUpperCase() == aCorrectAnswers.toUpperCase())
     {
          nScore++;
   
     }
     if(i == aQuestions.length - 1)
     {
          score_txt.text = nScore.toString();
     }
  nTotal++;
  correct_txt.text = nScore.toString();
  total_txt.text = nTotal.toString();
  percGlobal = Math.round((nScore/nTotal)*100).toString();
  percentage_txt.text = percGlobal + "&" ;
}

shareBtn.addEventListener(MouseEvent.CLICK, onShare);
function onShare(event: MouseEvent) {
var request:URLRequest = new URLRequest("mailto:robert.hannan@bcbsfl.com"+"?subject=Quiz Score"+"&body= percGlobal + percent");
navigateToURL(request, "_self");
}

This topic has been closed for replies.

1 reply

kglad
Community Expert
Community Expert
May 28, 2014

use:

var request:URLRequest = new URLRequest("mailto:robert.hannan@bcbsfl.com?subject=Quiz Score&body= "+percGlobal +"%");

Known Participant
May 28, 2014

I made the change but nothing's displaying in the email body.

var request:URLRequest = new URLRequest("mailto:robert.hannan@bcbsfl.com?subject=Quiz Score&body= "+percGlobal +"%");

thanks,

Robert.

Known Participant
May 28, 2014

sorry, I got the following 3 error messages:

1084: Syntax error: expecting identifier before modulus

1095: a string literal must be terminated before the line break

1084: Syntax error: expecting right break before modulus

shareBtn.addEventListener(MouseEvent.CLICK, onShare);

function onShare(event: MouseEvent) {

var request:URLRequest = new URLRequest("mailto:robert.hannan@bcbsfl.com"+"?subject=Quiz Score"+"&body= "+percGlobal +%");

navigateToURL(request, "_self");

}