For some reason the HTML isn’t being rendered in the text field being created with the following code. The HTML that should be displaying is in the feedback.htmlText = part.
Not sure why, can anyone help me spot the problem?
package exam {
import flash.display.*;
import flash.events.*;
import flash.text.*;
//this class is used to create a "pop-up" window to ask users to confirm they want to exit (after clicking
//exit exam button), and then to report back on how the submission went, and offer to resend if necessary
public class MessageWindow extends Sprite {
//VARIABLES
private var feedback:TextField;
private var confirm:YesBtn;
private var quit:CancelBtn;
private var resend:ResendBtn;
public function MessageWindow (type:String, unanswered:Number=0, score:Number=0) {
var bg:Shape = new Shape();
bg.graphics.beginFill(0xcccccc,1);
bg.graphics.lineStyle(3,0x122837);
bg.graphics.lineTo(400,0);
bg.graphics.lineTo(400,250);
bg.graphics.lineTo(0,250);
bg.graphics.lineTo(0,0);
bg.graphics.endFill();
addChild(bg);
var format:TextFormat = new TextFormat();
format.font = "Arial";
format.size = "22";
format.bold = false;
format.color = 0x122837;
feedback = new TextField();
feedback.width = 300;
feedback.x = 50;
feedback.y = 15;
feedback.wordWrap = true;
feedback.autoSize = TextFieldAutoSize.LEFT;
feedback.mouseEnabled = false;
feedback.multiline=true;
if (type == "confirm") {
feedback.text = "Are you sure you want to exit the exam?";
if (unanswered > 0) {
feedback.appendText(" You still have "+unanswered+" unanswered questions.");
}
feedback.setTextFormat(format);
addChild(feedback);
quit = new CancelBtn();
quit.setType("cancel");
quit.x = 25;
quit.y = this.height - (quit.height + 15);
addChild(quit);
confirm = new YesBtn();
confirm.setType("confirm");
confirm.y = quit.y;
confirm.x = this.width - (confirm.width + 25);
addChild(confirm);
}else if (type == "success") {
feedback.htmlText = "Congrats on finishing the exam!<br>Your score is "+Math.round(score*100)+"%<br>Click to <a href=' http://linktopdf.pdf '>download</a> your certificate<br />You may now close the exam window .";
feedback.setTextFormat(format);
addChild(feedback);
}else {
if (type == "databaseError") {
feedback.text = "Errors occured while saving your data. Please retry.";
}else if (type == "networkError") {
feedback.text = "Could not contact the server. Please make sure you are connected to the internet and try again.";
}
feedback.setTextFormat(format);
addChild(feedback);
resend = new ResendBtn();
resend.setType("resend");
resend.x = 200-(resend.width/2);
resend.y = this.height - (resend.height + 15);
addChild(resend);
}
}
}
}