4mb png/30kb jpg works another jpg that was 2mb might need a different procedure if it is auto-closing. Is this causing your swf to close? please provide detailed information, file format, size, name.
Printable View
4mb png/30kb jpg works another jpg that was 2mb might need a different procedure if it is auto-closing. Is this causing your swf to close? please provide detailed information, file format, size, name.
Crash fix for next startup when setting image:
download v24
working fine
can you delete register in second open ( only image appear )
we forgot adding timer every question
timer load number from txt external file
Greetings to you
You helped me a lot and I learned a lot from you
I saw some templates found in it
1- at the first time :
After logging in, a welcome message appears with the name of the student with his picture.
When the message is closed, questions appear with the timing.
When clicking on the answers, a confirmation message appears.
After choosing the answer, another message appears indicating whether the answer is correct or incorrect.
2- The second time :
A welcome message appears with the student's name, but there are two buttons, the first for questions and the second for the report
I don't know if Actioncript2 is able creating this template
But I am sure that you are the king of Actioncript2 and you can do it
good luck
Hello, you can clear sharedObject memory by pressing the Report Questions title.
I removed some spacing issues at the questions scripting section:
At the main(2) scripting section the tryAutoLogin() function attempts to retrieve a username from shared memory to auto login, _root.main.questions.open.data.Questions[_root.main.questions.open.data.array[0]][20]:PHP Code:function adjustOffset(){
if(_root.main.questions.open.data.QuestionNum<_root.main.question_number_size&&_root.main.report_container.report.content._y==0){
_root.main.questions.offset_for_print_btn=12
_root.main.questions.offset_for_print_btn_2=0
}else if(_root.main.questions.open.data.QuestionNum>=_root.main.question_number_size){
_root.main.questions.offset_for_print_btn_2=0
_root.main.questions.offset_for_print_btn=0
}else{
_root.main.questions.offset_for_print_btn=0
_root.main.questions.offset_for_print_btn_2=12
}
}
PHP Code:function tryAutoLogin(){
if(_root.main.questions.open.data.Questions[_root.main.questions.open.data.array[0]][20]!=undefined){
_root.login_container.name_txt.text=_root.main.questions.open.data.Questions[_root.main.questions.open.data.array[0]][20]
_root.user_name=_root.login_container.name_txt.text
_root.logged_in=true
log_in_pressed=true;
_root.resize()
}
}
setTimeout(tryAutoLogin,1)
At the main(2) scripting section if login_btn gets called by pressing login it stores the username in [20] & next startup will attempt tryAutoLogin:
download v25PHP Code:_root.login_container.login_btn.onRelease=function(){
if(_root.login_container.name_txt.text.length>0){
_root.user_name=_root.login_container.name_txt.text
_root.main.questions.open.data.Questions[_root.main.questions.open.data.array[0]][20]=_root.login_container.name_txt.text //Save username to sharedobject if textfield size is > 0.
_root.logged_in=true
log_in_pressed=true;
_root.resize()
}else{
_root.login_container.data_field.text="Please enter your name to sign in."
}
}
that's awesome
Hi, This is for the first sign in.
Once the user clicks login, it will call the function build_first_login() at the scripting section called onFrame(2):
At the scripting section called _root.main.questions for the enterFrame function I added an alpha increase animation for the first sign in:PHP Code:function build_first_login(){
_root.bg_first_sign_in._width=Stage.width
_root.bg_first_sign_in._height=Stage.height
_root.bg_first_sign_in._x=0
_root.bg_first_sign_in._y=0
_root.first_sign_in_container._alpha=1;
_root.first_sign_in_container.data_field.text="Welcome, "+_root.main.questions.open.data.Questions[_root.main.questions.open.data.array[0]][20]
_root.first_sign_in_container.data_field2.text="Your assignment will begin shortly."
img_loader.loadClip(str, _root.first_sign_in_container.profile_picture);
setTimeout(firstStartOfTest,8000); //Wait 8 seconds for the assignment to start if that is a good wait.
}
For the first start of the test to appear properly in 8 seconds you will need to set _root.first_log_in back to false & _root.logged_in to true as well as _root.bg_first_sign_in._visible to false:PHP Code:var modular:Number=0
var position:Number=0
var arr:Array=new Array("",".","..","...");
onSelfEvent (enterFrame) {
modular++;
if(_root.first_sign_in_container._visible){
if(_root.first_sign_in_container._alpha<100){
_root.first_sign_in_container._alpha+=3
}
if(modular%5==0){
if(position<3){
position++;
}else{
position=0;
}
_root.first_sign_in_container.data_field2.text="Your assignment will begin shortly"+arr[position]//Waiting animation for the text.
}
}
}
download v26PHP Code:function firstStartOfTest(){
_root.first_log_in=false
_root.logged_in=true
_root.bg_first_sign_in._visible=false
_root.resize()//Call resize() to update certain sizes & content.
}
Hello,
In the settings.txt file you will see each question has a start time for array position [8] of the sharedObject memory:
Call setTime("0:0:0"); function to set & start the timer in the onFrame(2) scripting section:PHP Code:1-&q1=@1+1@9@6@3@2@null@null@0:0:0
The accessor for the timer movieclip & textfield is:PHP Code:var time:String="0:0:00"
var timer_timeout=null
function increaseTime(){
if(parseInt(time.split(":")[2])<10){
time=time.split(":")[0]+":"+time.split(":")[1]+":"+"0"+time.split(":")[2]
}
_root.main.timer_mc.timer_text.text=time
time=time.split(":")[0]+":"+time.split(":")[1]+":"+String(parseInt(time.split(":")[2])+1)
if(time.split(":")[2]=="60"){
time=time.split(":")[0]+":"+time.split(":")[1]+":"+"0"
time=time.split(":")[0]+":"+String(parseInt(time.split(":")[1])+1)+":"+time.split(":")[2]
if(time.split(":")[1]=="60"){
time=String(parseInt(time.split(":")[0])+1)+":"+"0"+":"+time.split(":")[2]
}
}
_root.main.questions.open.data.Questions[_root.main.questions.open.data.array[_root.main.questions.open.data.QuestionNum]][8]=String(time)
timer_timeout=setTimeout(increaseTime,1000);
}
function setTime(a){
time=a;
increaseTime();
}
For buttons wrong1, wrong2, wrong3 & true_answer I added a clearTimeout call & set a new time with _root.setTime():PHP Code:_root.main.timer_mc//Movieclip.
_root.main.timer_mc.timer_text.text//Textfield.
download v27PHP Code:clearTimeout(_root.timer_timeout);//stop the timer.
_root.setTime(String(_root.main.questions.open.data.Questions[_root.main.questions.open.data.array[_root.main.questions.open.data.QuestionNum]][8]));//start a new timer for the next question.
hello
for example
timer = 20 sec
when i press
timer --
If the timing ends without an answer, the status in the report is unanswered and go to the next question
Hi,
The quickest method to save questions as unanswered was to copy the script from wrong1 & put it inside a function called notAnswered() in the scripting section onFrame(2):
To clear the previous questions timer & start a new timer for the next question, you would call clearTimeout & also _root.setTime("0:0:20"):PHP Code:var time:String="0:0:00"
var timer_timeout=null
function decreaseTime(){
timer_timeout=setTimeout(decreaseTime,1000);
var hours:Number=parseInt(time.split(":")[0])
var minutes:Number=parseInt(time.split(":")[1])
var seconds:Number=parseInt(time.split(":")[2])
if(seconds>-1){
seconds--
time=hours+":"+minutes+":"+seconds
if(seconds==-1&&minutes>0){
minutes--
seconds=59
time=hours+":"+minutes+":"+seconds
}else if(seconds==-1&&minutes==0&&hours>0){
hours--
minutes=59
seconds=59
time=hours+":"+minutes+":"+seconds
}
}
if(seconds<10){
time=String(hours+":"+minutes+":"+"0"+seconds)
}
if(hours==0&&minutes==0&&seconds==0){
time=String(hours+":"+minutes+":"+"00")
clearTimeout(timer_timeout)
trace("complete")
_root.main.scrollToMin()
notAnswered() //Call notAnsweredFunction
//clearTimeout(_root.timer_timeout);
//_root.setTime(String(_root.main.questions.open.data.Questions[_root.main.questions.open.data.QuestionNum+1][8]));
_root.main.scrollToMax()
}
_root.main.questions.open.data.Questions[_root.main.questions.open.data.QuestionNum+1][8]=String(time)
_root.main.timer_mc.timer_text.text=time
}
download v28PHP Code:clearTimeout(_root.timer_timeout);
_root.setTime(String(_root.main.questions.open.data.Questions[_root.main.questions.open.data.QuestionNum+1][8]));
I disabled the printing button during the middle of the exam so it doesn't pause the timer with the dialog, but there might be work arounds if you are interested.
Once you reach the final question the print button goes to 100 alpha & gets enabled.
download v29
Hello,
You can call set_up_options(true) on the onFrame(2) scripting section at lines 111 to display the 2 button options:
In the same onFrame(2) scripting section I setup an on release event for the continue test button:PHP Code:var active_options:Boolean=false;
function set_up_options(a){
active_options=a;
_root.bg_options._x=0//setup grey bg to be at 0 x & 0 y.
_root.bg_options._y=0
_root.bg_options._width=Stage.width//Set the background to be the stage width and height.
_root.bg_options._height=Stage.height
_root.view_report._width=Stage.height/3
_root.view_report._yscale=_root.view_report._xscale
_root.view_report._x=Stage.width/4-_root.view_report._width/2
_root.view_report._y=Stage.height/2-_root.view_report._height/2
_root.continue_test._width=Stage.height/3
_root.continue_test._yscale=_root.continue_test._xscale
_root.continue_test._x=Stage.width-_root.continue_test._width-_root.view_report._x
_root.continue_test._y=Stage.height/2-_root.continue_test._height/2
resize()//Call resize to refresh, the resize event will see _root.active_options is set to true.
}
PHP Code:_root.continue_test.onRelease=function(){
set_up_options(false);
_root.login_container.name_txt.text=_root.main.questions.open.data.Questions[_root.main.questions.open.data.array[0]][20]
_root.user_name=_root.login_container.name_txt.text
_root.logged_in=true
log_in_pressed=true;
img_loader.loadClip(str, _root.welcome_notice.profile_picture);
_root.welcome_notice.data_field.text="Welcome, "+ _root.user_name
_root.welcome_notice._visible=true
clearTimeout(_root.timer_timeout);
_root.setTime(String(_root.main.questions.open.data.Questions[_root.main.questions.open.data.QuestionNum+1][8]));
_root.resize()
}
download v30
It's great that you explain to us what you're doing
thank you so much
can you add image to every question ( load from external images folder )
there is a big problem
When i change the file name, all data stored in SharedObject is erased
can you solve it please (very important)
Hello,
In the trueAnswe function at the questions scripting section you can see I added this line to load an image each question, you just have to modify the file path to yours.
Inside of the resize function at the onFrame(2) scripting section the question_photo will not be visible if active_options is enabled.PHP Code:_root.img_loader.loadClip("C:\\Users\\Desktop\\Desktop\\photos\\photo_"+String(_root.main.questions.open.data.QuestionNum+1)+".png",_root.question_photo); //The photo will load into _root.question_photo which is the red square at the bottom of the stage.
On lines 140 of the scripting section called onFrame(2), once the user selects button called continue_test, the question photo can be visible.PHP Code:if(_root.active_options){
_root.question_photo._visible=false//Photo for test is not visible when the 2 buttons are present.
}else{
}
Also inside of the resize function at the onFrame(2) scripting section, when stage width is wider than stage height we can put:PHP Code:_root.continue_test.onRelease=function(){
_root.question_photo._visible=true
}
When stage height is greater than stage width we can modify the placement to be a bit different for the question photo to look right.:PHP Code:_root.question_photo._width=_root.main.questions.text_container._width/1.2
_root.question_photo._yscale=_root.question_photo._xscale
_root.question_photo._x=int(_root.main.questions.text_container._x/2)-_root.question_photo._width/2//-(_root.main.report_container.report._width/14.4)
_root.question_photo._y=(Stage.height-_root.main.report_container._y)/2
I don't understand your settings.txt issue, but you have to use the new settings.txt in order for the test to work properly.PHP Code:_root.question_photo._width=_root.main.questions.text_container._width/1.2
_root.question_photo._yscale=_root.question_photo._xscale
_root.question_photo._x=int(Stage.width-_root.main.questions.text_container._x-_root.main.questions.text_container._width)/2-_root.question_photo._width/2
_root.question_photo._y=(_root.main.questions.text_container._y+_root.main.questions.text_container._height/2)-_root.question_photo._height/2
Also you can fix any loading issue by clicking the red title during the test & reloading.
download v31
have you any solution to fix if you rename file , all data stored in SharedObject is erased
1.)You are on question 5.
2.)You close the application.
3.)You rename settings.txt on the desktop to a.txt
4.)You re-opening the application.
5.)You are not on question 5 anymore?
At the questions scripting section you have to set settings.txt to the name of your text file.
If you are having undefined issues, you can click the red title during the test and restart the application.PHP Code:var open:SharedObject = SharedObject.getLocal("storedFile1");
loadV.load("settings.txt");
Can you show a screenshot? I don't see your issue.
Hi, I worked on some of the report preview section at the main menu:
On the scripting section called onFrame(2) I added an onRelease event for the button that says view report:
On line 161 of the scripting section called onFrame(2) this is the button listener for the x_preview button.PHP Code:_root.view_report.onRelease=function(){//View report button on release.
_root.view_report._visible=false//Hide the first button if previewing the report.
_root.continue_test._visible=false//Hide the second button if previewing the report.
_root.report_preview._visible=true//Make the container for the report visible.
_root.main.report_container.report.updateReport(0xFF0000,_root.report_preview,1 , _root.main.questions.open.data.QuestionNum+1) //Fill the container of the report with data.
_root.main.report_container.report.updateColors(_root.report_preview,1 , _root.main.questions.open.data.QuestionNum+1); //Fill the container of the report with highlighted selected answers.
_root.report_preview._xscale=100//Reset x scale & y scale before readjusting size to fit the stage.
_root.report_preview._yscale=100
if( _root.report_preview._width*2<Stage.width){
_root.report_preview._width*=2//Multiply the size by 2's to maintain quality.
_root.report_preview._yscale= _root.report_preview._xscale//maintain y scale by checking xscale.
}
I still need to add a scroll pane for the main menu report preview, would you like a horizontal scroll pane for the test when the stage width is made small?PHP Code:_root.x_preview.onRelease=function(){//X button for the report viewing section on release.
_root.main.report_container.report.reset_container(_root.report_preview,1, _root.main.questions.open.data.QuestionNum+1);//Reset container to be empty once you click X.
_root.x_preview._visible=false//Make the x button invisible.
_root.view_report._visible=true//Make the 2 menu buttons visible again.
_root.continue_test._visible=true
_root.report_preview._visible=false//Hide the report preview once at the main menu.
}
download v32
If you rename swf file or exe file
I typed "run" in the start menu, & I entered %appdata% the directory took me to a folder where I searched the index for .sol "shared object files". So I found:
C:\Users\Desktop\AppData\Roaming\Macromedia\Flash Player\#SharedObjects\localhost\Users\Desktop\File ****\Random SharedObject 32.swf\storedFile1.sol
The folder belongs to the swf file by name, & inside of that folder is the storedFile1.sol.
Only .swf's with the name that created the storedFile1.sol can access it.
You can however access sharedObjects through a server which makes it possible to trick the system & give you the file from whatever name. Would you like me to prepare a server?
If you want to go with a network solution we might as well use a socket server instead of sharedobjects...
Sorry, I don't understand server and network
Is it possible to change swf file name without losing data
The answer is no.
The partition is based on the applications name.
I added a scrollpane for the report preview at the startup.
In the onFrame(2) scripting section for the resize() function when you are upscaling _root.report_container the mask inside stays the same height when using it for calculation to center it, so you can just multiply the mask._height * the upscale.
Would you like to continue this project in AS3 or it is ok that the cookie changes when the file name is different.PHP Code:_root.report_container._y=Stage.height/2-(_root.report_container.report_preview.mask._height*(_root.report_container._xscale/100))/2 //The upscale is divided by 100 before multiplying it by (_root.report_container._xscale/100).
download v33
Hi, scrollwheel support for report preview was added.
At the main scripting section on lines 214:
download v34PHP Code:if (scr > 0){//If scrollwheel is rolling up.
if(scroll_bar_btn_2._y>scroll_bar_bg_2._y){
scroll_bar_btn_2._y-=15//scroll 15 pixels at a time
if(scroll_bar_btn_2._y<scroll_bar_bg_2._y){
scroll_bar_btn_2._y= scroll_bar_bg_2._y
}
}
}else{//If scrollwheel is rolling down.
if(scroll_bar_btn_2._y<scroll_bar_bg_2._y+scroll_bar_bg_2._height-scroll_bar_btn_2._height){
scroll_bar_btn_2._y+=15
if(scroll_bar_btn_2._y>scroll_bar_bg_2._y+scroll_bar_bg_2._height-scroll_bar_btn_2._height){
scroll_bar_btn_2._y= scroll_bar_bg_2._y+scroll_bar_bg_2._height-scroll_bar_btn_2._height
}
}
}
On lines 169 of onFrame(2) check to see if QuestionNum is greater than the selected question_num_size for the scrollpane mask to determine if it will be visible:
download v35PHP Code:if(_root.main.questions.open.data.QuestionNum>_root.main.question_number_size){//If QuestionNum > the masked amount of questions.
_root.report_container.scroll_bg._alpha=100//Show scrollpane.
_root.report_container.scroll_btn._alpha=100
}else{
_root.report_container.scroll_bg._alpha=0//Hide scrollpane.
_root.report_container.scroll_btn._alpha=0
}
awesome
Hi,
After an answer is selected, a dialog box will appear.
At the questions scripting section I added the function build_selected_dialog which will bring up the dialog box, this function gets called at the end of the wrong1, wrong2, wrong3 & true_answer buttons.
For the dialog box the button called _root.dialog_box.continue_btn the button will store the script that re-enables time for the next question & sets the new text for the next question:PHP Code:var dialog_open:Boolean=false;
var temp_1=""
var temp_2=""
var temp_3=""
var temp_4=""
var temp_5=""
function build_selected_dialog(a,b){//a is true false or 3, & b is the answer to the question that was just selected.
dialog_open=true;
_root.dialog_box._visible=true
_root.shade._x=0
_root.shade._y=0
_root.shade._width=Stage.width
_root.shade._height=Stage.height
_root.shade._alpha=50//Set background shade to 50%.
_root.shade._width=Stage.width
_root.shade._height=Stage.height
_root.dialog_box._width=Stage.height/2.4
_root.dialog_box._yscale=_root.dialog_box._xscale
_root.dialog_box._x=Stage.width/2-_root.dialog_box._width/2
_root.dialog_box._y=Stage.height/2-_root.dialog_box._height/2
temp_1=_root.main.questions.text_container.question.text
temp_2=_root.main.questions.text_container.wrong1.text
temp_3=_root.main.questions.text_container.wrong2.text
temp_4=_root.main.questions.text_container.wrong3.text
temp_5=_root.main.questions.text_container.true_answer.text
if(a==false){
clearTimeout(_root.timer_timeout);
_root.dialog_box.data_field.text="Sorry, \n You selected the wrong answer."
_root.main.questions.text_container.question.text="---"
_root.main.questions.text_container.wrong1.text="---"
_root.main.questions.text_container.wrong2.text="---"
_root.main.questions.text_container.wrong3.text="---"
_root.main.questions.text_container.true_answer.text="---"
}else if(a==true){
clearTimeout(_root.timer_timeout);
_root.dialog_box.data_field.text="Congratulations, \n You selected the correct answer."
_root.main.questions.text_container.question.text="---"
_root.main.questions.text_container.wrong1.text="---"
_root.main.questions.text_container.wrong2.text="---"
_root.main.questions.text_container.wrong3.text="---"
_root.main.questions.text_container.true_answer.text="---"
}else{
clearTimeout(_root.timer_timeout);
_root.dialog_box.data_field.text="Sorry, \n You ran out of time to answer this question."
_root.main.questions.text_container.question.text="---"
_root.main.questions.text_container.wrong1.text="---"
_root.main.questions.text_container.wrong2.text="---"
_root.main.questions.text_container.wrong3.text="---"
_root.main.questions.text_container.true_answer.text="---"
}
_root.main.questions.text_container.wrong1.enabled=false
_root.main.questions.text_container.wrong2.enabled=false
_root.main.questions.text_container.wrong3.enabled=false
_root.main.questions.text_container.true_answer.enabled=false
_root.report_container.scroll_btn.enabled=false
}
At the scripting section called main you can see at the inside of the mousewheel function if dialog_open is set to true we can not use the scrollwheel feature:PHP Code:on(release){
_root.shade._alpha=0//Hide the shaded area when clicking continue.
_root.shade._width=50
_root.shade._height=50
_root.dialog_box._visible=false
_root.main.questions.dialog_open=false;//Set dialog_open to false for all of the buttons behind the alpha'd area to work again.
clearTimeout(_root.timer_timeout);
_root.setTime(String(_root.main.questions.open.data.Questions[_root.main.questions.open.data.QuestionNum+1][8]));//Start the timer for the next question.
_root.main.questions.text_container._alpha=100
_root.main.questions.text_container.question.text=_root.main.questions.temp_1//Change the "---" to the question & answer data.
_root.main.questions.text_container.wrong1.text=_root.main.questions.temp_2
_root.main.questions.text_container.wrong2.text=_root.main.questions.temp_3
_root.main.questions.text_container.wrong3.text=_root.main.questions.temp_4
_root.main.questions.text_container.true_answer.text=_root.main.questions.temp_5
_root.img_loader.loadClip("C:\\Users\\Desktop\\Desktop\\photos\\photo_"+String(_root.main.questions.open.data.QuestionNum+1)+".png",_root.question_photo);//Load the picture for the next question.
}
download v36PHP Code:mouseListener.onMouseWheel = function(scr) {
if(_root.main.questions.dialog_open==false){
//truncated data...
}
};
yes, this is
**************
( while timer -- )
if you closed the file
can you restart timer to 20 sec again
Hi,
Inside of the function for continue_test which is found in onFrame(2) you just need to add the line to start it at 20 seconds:
download v37PHP Code:_root.continue_test.onRelease=function(){
//truncated data...
_root.main.questions.open.data.Questions[_root.main.questions.open.data.QuestionNum+1][8]="0:0:20"//Set to 0 days 0 hours and 20 seconds.
}
Bug fix at the 2 button menu:
download v38
Hello, how do you want to handle the undefined for the last question, and maybe it needs a key code for the admin to reset, right?
after the last question directly
1- disable buttons
2- invisible questions
3- show certificate ( can print )
Hi,
At the decreaseTime function in scripting section onFrame(2) if the timer is on the last question it will say undefined so we should just put "---" for the timer & set the textfield to say completed:
At _root.main.questions.TrueAnswe we can set all of the textfields to say --- during the last question, or instead you can just do _root.main.questions.text_container._visible=false: <-------------------------------------------PHP Code:if(_root.main.timer_mc.timer_text.text=="undefined"){//If timer text reached the end it will say undefined.
_root.main.timer_mc.timer_text.text="---"//Set timer text to ---
_root.main.questions.text_container.total.text="Completed" //Set total.text to say "Completed"
}
I also fixed a glitch when answering questions before the scrollpane appears by setting the scrollpane components to invisible at the function called updateScrollSettings(a,b) in scripting section _root.main:PHP Code:if(_root.main.questions.open.data.QuestionNum> _root.main.questions.open.data.array.length-1){
_root.main.questions.text_container.question.text="---"//Set question text to --- when the final question is complete.
_root.main.questions.text_container.wrong1.text="---"
_root.main.questions.text_container.wrong2.text="---"
_root.main.questions.text_container.wrong3.text="---"
_root.main.questions.text_container.true_answer.text="---"
clearTimeout(_root.timer_timeout)
_root.main.timer_mc.timer_text.text="---"
end_reached=true//If end_reached is set to true that means the wrong1,wrong2,wrong3 & true_answer will be disabled.
}
For buttons wrong1, wrong2 wrong3 & true_answer they can be unselectable when reaching the last question by checking if the end_reached variable is true or false:PHP Code:if(_root.main.questions.open.data.QuestionNum>question_number_size){
scroll_bar_bg._visible=true//Reshow scrollpane when it is needed.
scroll_bar_btn._visible=true
}else{
scroll_bar_bg._visible=false//Hide scrollpane glitch when answering questions.
scroll_bar_btn._visible=false
}
So lets do this, we show the certificate instead of the question image, & print everything with the red print button, but can you show me how you want the certificate to look?PHP Code:on (press) {
if(_root.main.questions.dialog_open==false&&_root.main.questions.end_reached==false){//If end reach is true the question button will get disabled.
//truncated data...
}
If anything send me a design of the certificate section.
download v39
I will send you a bug fix for the autologin.
This solves an undefined issue:
download v41
Hello,
Inside of the onFrame(2) scripting section at the end I put a drag and drop script for the certificate windows drag bar:
For the _root.main.view_certificate button thats next to the print button for the report you will see its release event at the scripting section called main:PHP Code:_root.window_container.top_bar.onPress=function(){
this._parent.startDrag(false);//Drag certificate window.
}
_root.window_container.top_bar.onRelease=_root.window_container.top_bar.onReleaseOutside=function(){
this.stopDrag()//Release certificate window.
}
Inside of the onFrame(2) scripting section at function decreaseTime it has the script for the certificate window to output the users score & username:PHP Code:_root.main.view_certificate.onRelease=function(){
_root.window_container._x=Stage.width/2-_root.window_container._width/2//Center the certificate window.
_root.window_container._y=Stage.height/2-_root.window_container._height/2
if(_root.test_complete&& _root.window_container._visible==false){
_root.window_container._visible=true//Make Certificate window visible.
_root.window_container._alpha=75//When alpha is less than 100 it will fade in from the enterFrame function at the questions scripting section.
_root.window_container._x=Stage.width/2-_root.window_container._width/2
_root.window_container._y=Stage.height/2-_root.window_container._height/2
}
}
I will work on the printing part tomorrow.PHP Code:_root.window_container._visible=true//Make window visible.
_root.window_container._alpha=0
_root.window_container._width=Stage.width/1.1
_root.window_container._yscale=_root.window_container._xscale
_root.window_container._x=Stage.width/2-_root.window_container._width/2
_root.window_container._y=Stage.height/2-_root.window_container._height/2
_root.window_container.data_field.text="Certificate - " + _root.user_name
_root.window_container.data_field2.text="Score: " +((_root.main.questions.open.data.POINT/_root.main.questions.open.data.array.length)*100) +"%"//Score is (points/length of questions)*100
_root.window_container.data_field3.text="Certificate of "+_root.user_name//Show username that completed certificate.
clearTimeout(timer_timeout)//End timeout
test_complete=true//When test is complete the view certificate button can be pressed.
download v42
Hi, you can print the certificate now.
The accessor for the certificate movieclip is:
At the function called decreaseTime inside of the onFrame(2) scripting section I set the data for the certificate, this is when the test is over:PHP Code:_root.certificate_print_out//Movieclip container.
_root.certificate_print_out["data_field"].text//Score result.
_root.certificate_print_out["data_field2"].text//User name.
PHP Code:_root.certificate_print_out["data_field"].text=_root.user_name//Set certificate user name.
_root.certificate_print_out["data_field2"].text=String((_root.main.questions.open.data.POINT/_root.main.questions.open.data.array.length)*100) +"%"//Set certificate score.
var myformat2:TextFormat = new TextFormat();//Text format properties for the certificate textfield.
myformat2.size=17;//Set textfield size of the certificates data to be 17.
myformat2.color = 0x000000//Set the textfields color to black.
myformat2.bold=true;//Use bold for the text style.
myformat2.align="center";//Center align the text style.
_root.certificate_print_out["data_field"].setTextFormat(myformat2);//Format the certificate textfield using the myformat2 style.
_root.certificate_print_out["data_field2"].setTextFormat(myformat2);
_root.window_container.print_btn has an on release function to print the certificate:
PHP Code:on(release){
_root.print_certificate();//Call function to print the certificate out.
}
The print_certificate() function is at the onFrame(2) scripting section:
PHP Code:function print_certificate(){
var print_var2:PrintJob = new PrintJob();//Start a print job.
if(print_var2.start()){//Communicate with the printer.
}
var page;
page = print_var2.addPage(_root.certificate_print_out,{xMin:0,xMax:(_root.certificate_print_out._width),yMin:0,yMax:_root.certificate_print_out._height});//Add page for the print job with accessor: _root.certificate_print_out
print_var.send();//Send to printer queue.
}
download v43