-
-
Client Software Programmer
Hi I fixed some alignment glitches, this version should be ready.
Is the certificate fine in portrait, or would you like it in landscape mode?
download v44
-
-
can you add the name and student photo in print report and certificate
-
Client Software Programmer
Hello, this version displays the certificate in landscape mode with a profile picture.
In the onFrame(2) scripting section the function addText works to add rotated bitmap text:
PHP Code:
var charset:Array=new Array('A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z',
'0','1','2','3','4','5','6','7','8','9','SPACE','AT','PERCENT','UNDERSCORE');//Charset.
function addText(a,b,c){//addText to certificate accessors.
var container_1:MovieClip = a.createEmptyMovieClip("container_1", this.getNextHighestDepth());
var container_2:MovieClip;
for(var i:Number = 0; i < b.length; i++) {
container_2 = container_1.duplicateMovieClip(0, i+1);
var temp=b.charAt(i)
if(temp==" "){//convert space to linkage name of space bitmap.
temp="SPACE"
}
if(temp=="%"){
temp="PERCENT"
}
if(temp=="@"){
temp="AT"
}
if(temp=="_"){
temp="UNDERSCORE"
}
container_2.attachMovie(temp,"A",1);
container_2._x=i*24
}
a._rotation=-90//Rotate bitmap text to -90.
a._x=c._x-a._width//Align bitmap text with the vertical line movieclip inside of certificate.
a._y=c._y+c._height/2+a._height/2
}
At the decreaseTime function thats inside of the onFrame(2) scripting section I call addText to set the certificate score, username & profile picture:
PHP Code:
_root.addText(_root.certificate_print_out.text_contain_1,String((_root.main.questions.open.data.POINT/_root.main.questions.open.data.array.length)*100) +"%",_root.certificate_print_out.line_1)//Set the score for _root.certificate_print_out.line_1
_root.addText(_root.certificate_print_out.text_contain_2,_root.user_name,_root.certificate_print_out.line_2)//Set the username for _root.certificate_print_out.line_2
img_loader.loadClip(str, _root.certificate_print_out.welcome_notice.profile_picture);//Set the profile picture for the certiifcate.
Inside of the onLoadInit function for the certificates profile picture at theonFrame(2) scripting section:
PHP Code:
loader_listener.onLoadInit = function(e:MovieClip) {
//truncated data...
_root.certificate_print_out.welcome_notice.profile_picture._width=60//Set certificate profile picture to 60 width & height.
_root.certificate_print_out.welcome_notice.profile_picture._height=60
}
The accessors for the certificate content is:
PHP Code:
_root.certificate_print_out.welcome_notice.profile_picture//Profile picture inside of certificate.
_root.certificate_print_out.line_2//Username line inside of certificate.
_root.certificate_print_out.line_1//Score line inside of certificate.
_root.certificate_print_out.text_contain_1//Container for score text inside of certificate.
_root.certificate_print_out.text_contain_2//Container for user name inside of certificate.
download v45
Last edited by AS3.0; 12-17-2022 at 02:43 PM.
-
Client Software Programmer
Hi, I worked on the print out for the reports picture id & username textfield.
For page 1 I added a place to load the picture id as well as set the username, the accessors for the _root.section_1 movieclip are:
PHP Code:
_root.section_1.container.data_field//Stores the user name for the first page.
_root.section_1.container.welcome_notice//Stores the picture id for the first page.
At the decreaseTime function in the onFrame(2) scripting section when the test is complete it will set the username & picture id for the first page:
PHP Code:
img_loader.loadClip(str, _root.certificate_print_out.welcome_notice.profile_picture);//Load picture id.
_root.section_1.container.data_field.text=_root.user_name//Set username textfield data.
At the function called _root.main.report_container.report.updateReport I adjusted some of the margins depending on the page:
PHP Code:
function updateReport(a:Number,b,c:Number,d:Number){
//truncated data...
if(b!=_root.main.report_container.report.content&&b!=_root.report_container.report_preview.content){
b["num"+0]._y=offset_2//Offset 2 sets the margin for all of the pages.
b["Question"+0]._y=offset_2
b["answerA"+0]._y=offset_2
b["answerB"+0]._y=offset_2
b["answerC"+0]._y=offset_2
b["answerD"+0]._y=offset_2
b["Result"+0]._y=offset_2
b["num"+i]._y+=offset_2
b["Question"+i]._y+=offset_2
b["answerA"+i]._y+=offset_2
b["answerB"+i]._y+=offset_2
b["answerC"+i]._y+=offset_2
b["answerD"+i]._y+=offset_2
b["Result"+i]._y+=offset_2
if(b!=_root.main.report_container.report.print_content[0]){
b["num"+0]._y-=21//The margin for the second page and on has a slight less offset because it wont have a picture id or username.
b["Question"+0]._y-=21
b["answerA"+0]._y-=21
b["answerB"+0]._y-=21
b["answerC"+0]._y-=21
b["answerD"+0]._y-=21
b["Result"+0]._y-=21
b["num"+i]._y-=21
b["Question"+i]._y-=21
b["answerA"+i]._y-=21
b["answerB"+i]._y-=21
b["answerC"+i]._y-=21
b["answerD"+i]._y-=21
b["Result"+i]._y-=21
}
}
}
At the onFrame(1) scripting section called main I set the positioning for the textfield that will say "Page 1 of 2" for each page etc...:
PHP Code:
_root.section_1.data_field._x=_root.section_1._width/2-_root.section_1.data_field._width/2//Center the textfield to half the size of section 1 minus half the size of the textfield.
_root.section_1.data_field._y=(_root.main.report_container.report.content["Result"+question_number_size]._height*(_root.main.report_container.report.per_page+5)+2)//Set the y coordinate of the textfield to be at position per_page * the height of a cell.
_root.section_2.data_field._x=_root.section_2._width/2-_root.section_2.data_field._width/2
_root.section_2.data_field._y=(_root.main.report_container.report.content["Result"+question_number_size]._height*(_root.main.report_container.report.per_page+5)+2)
_root.section_3.data_field._x=_root.section_3._width/2-_root.section_3.data_field._width/2
_root.section_3.data_field._y=(_root.main.report_container.report.content["Result"+question_number_size]._height*(_root.main.report_container.report.per_page+5)+2)
_root.section_4.data_field._x=_root.section_4._width/2-_root.section_4.data_field._width/2
_root.section_4.data_field._y=(_root.main.report_container.report.content["Result"+question_number_size]._height*(_root.main.report_container.report.per_page+5)+2)
_root.section_5.data_field._x=_root.section_5._width/2-_root.section_5.data_field._width/2
_root.section_5.data_field._y=(_root.main.report_container.report.content["Result"+question_number_size]._height*(_root.main.report_container.report.per_page+5)+2)
At the onFrame(1) scripting section called main I also set the text for the bottom of each page to show "Page 1 of 2" etc...:
PHP Code:
var count=0;
if(_root.main.report_container.report.print_content_available[0]){//If print content available is true, increase the variable called count.
count++//Increase the count for every page that was marked as a page with data.
}
if(_root.main.report_container.report.print_content_available[1]){
count++
}
if(_root.main.report_container.report.print_content_available[2]){
count++
}
if(_root.main.report_container.report.print_content_available[3]){
count++
}
if(_root.main.report_container.report.print_content_available[4]){
count++
}
_root.section_1.data_field.text="page 1 of " + String(count)//Set the textfield for each page to say page 1 of count etc...
_root.section_2.data_field.text="page 2 of " + String(count)
_root.section_3.data_field.text="page 3 of " + String(count)
_root.section_4.data_field.text="page 4 of " + String(count)
_root.section_5.data_field.text="page 5 of " + String(count)
_root.section_1.data_field2.text="page 1 of " + String(count)
_root.section_2.data_field2.text="page 2 of " + String(count)
_root.section_3.data_field2.text="page 3 of " + String(count)
_root.section_4.data_field2.text="page 4 of " + String(count)
_root.section_5.data_field2.text="page 5 of " + String(count)
At the resize() function inside of the onFrame(2) scripting section, I fixed a glitch for the first login where it would show the main menu really fast:
PHP Code:
function resize(){
//truncated data...
if(_root.first_log_in){
_root.bg_options._visible=false//Hide the main menu before showing the first login.
_root.view_report._visible=false
_root.continue_test._visible=false
}
}
download v46
Last edited by AS3.0; 12-19-2022 at 02:38 PM.
-
Client Software Programmer
Hello, the text for the certificate looks better and has a larger charset available for it since I am using bitmap.draw().
At the onFrame(2) scripting section there is a function called decreaseTime()
PHP Code:
decreaseTime(){
//truncate data...
import flash.display.BitmapData;//It is required to import the bitmap data library when using BitmapData functions.
_root.certificate_print_out.data_field3_container.data_field3.text=String(int((_root.main.questions.open.data.POINT/_root.main.questions.open.data.array.length)*100) )+"%"//Set data_field3.text to be the score at the end of the test.
var bmd:BitmapData = new BitmapData( _root.certificate_print_out.data_field3_container.data_field3.textWidth+2, _root.certificate_print_out.data_field3_container._height, false, 0xFFFFFF);//Create a bitmapdata image array with the dimensions of the score textfield.
var container_1:MovieClip = _root.certificate_print_out.createEmptyMovieClip("container_1", _root.certificate_print_out.getNextHighestDepth());//Create an empty movieclip container for the score bitmap.
container_1.attachBitmap(bmd, _root.certificate_print_out.getNextHighestDepth());//attach the bitmap graphic to the empty movieclip.
container_1._y=200
bmd.draw(_root.certificate_print_out.data_field3_container.data_field3)//Draw the bounds of the score textfield to the bitmap that had a 0xFFFFFF background.
container_1._rotation=-90//Rotate the score bitmap texts container -90 to align it in landscape mode.
container_1._x=_root.certificate_print_out.line_1._x-container_1._width//Align the score bitmap to line_1 movieclip in the certificate.
container_1._y=((_root.certificate_print_out.line_1._y+_root.certificate_print_out.line_1._height/2)+container_1._height/2)-4
_root.certificate_print_out.data_field3_container.data_field3.text=""//Hide the score textfield that was just being used to get a bitmap.draw() image of.
_root.certificate_print_out.data_field4_container.data_field4.text=_root.user_name//Use the same process as above for the username text field.
var bmd2:BitmapData = new BitmapData( _root.certificate_print_out.data_field4_container.data_field4.textWidth+2, _root.certificate_print_out.data_field4_container._height, false, 0xFFFFFF);
var container_2:MovieClip = _root.certificate_print_out.createEmptyMovieClip("container_2", _root.certificate_print_out.getNextHighestDepth());
container_2.attachBitmap(bmd2, _root.certificate_print_out.getNextHighestDepth());
container_2._y=300
bmd2.draw(_root.certificate_print_out.data_field4_container.data_field4)
container_2._rotation=-90
container_2._x=_root.certificate_print_out.line_2._x-container_2._width
container_2._y=((_root.certificate_print_out.line_2._y+_root.certificate_print_out.line_2._height/2)+container_2._height/2)-4
_root.certificate_print_out.data_field4_container.data_field4.text=""
}
This function will no longer be used for setting certificate text:
PHP Code:
//_root.addText(_root.certificate_print_out.text_contain_1,String(int((_root.main.questions.open.data.POINT/_root.main.questions.open.data.array.length)*100) )+"%",_root.certificate_print_out.line_1)//Limited char set.
//_root.addText(_root.certificate_print_out.text_contain_2,_root.user_name,_root.certificate_print_out.line_2)
download v47
Last edited by AS3.0; 12-20-2022 at 03:23 AM.
-
Client Software Programmer
Hi, this version fixes some graphical glitches in the certificate & centers the report if the question doesn't have an image.
At _root.main.questions above function trueAnswe()
PHP Code:
var img_loaded:Boolean=false;//Boolean to align the report differently if false.
At onRelease function of continue_btn for the next question:
PHP Code:
_root.main.questions.img_loaded=false;//Image is not loaded boolean.
_root.img_loader.loadClip("C:\\Users\\Desktop\\Desktop\\photos\\photo_"+String(_root.main.questions.open.data.QuestionNum+1)+".png",_root.question_photo);//Try to load the image and set img_loaded to true
setTimeout(_root.resize,5);//Refresh resize and check if report should be centered differently.
At the onFrame(2) scripting section at function resize():
PHP Code:
if(_root.main.questions.img_loaded==false){//If the image for current question has not been loaded.
_root.main.report_container._y=(Stage.height/2-scroll_pane_height/2)//Align the report differently to compensate for the space not being used by the image.
}
download v48
Last edited by AS3.0; 12-20-2022 at 06:33 PM.
-
Client Software Programmer
Hello,
In the onFrame(2) scripting section I set the blendMode to layer for the window to fade in properly because the "x" button had a different alpha:
PHP Code:
_root.window_container.blendMode="layer"
At the _root.main scripting section _root.main.print_btn.onRelease() I added _root.resize() to fix a bug when resizing with print settings open:
PHP Code:
setTimeout(_root.resize,1)
download v49
Last edited by AS3.0; 12-20-2022 at 11:02 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|