that's awesome
can you add scroll and print function to report
thanks so mutch
Printable View
that's awesome
can you add scroll and print function to report
thanks so mutch
Hello, I added the scroll bar:
For the var called question_number_size in script section main you can adjust the scrollbar to be the size of 4 questions max:
For lines 9-12, _root.main.report.content is the container for the cells, _root.main.report.mc is the movieclip to mask size 4 ^ in amount of questions etc..., _root.main.questions.scroll_bg is the scrollbar background & _root.main.questions.scroll_btn is the scrollbar.PHP Code:
var question_number_size=4
When the table gets updated you can call:PHP Code:
var scroll_content=_root.main.report.content
var scroll_mask=_root.main.report.mc
var scroll_bar_bg=_root.main.questions.scroll_bg
var scroll_bar_btn=_root.main.questions.scroll_btn
Set the scrollbar to be in the max position:PHP Code:
_root.main.updateScrollSettings(_root.main.report.content,_root.main.report.mc);//Give content & mask an update on size change.
Set the scrollbar to be in the min position:PHP Code:
_root.main.scrollToMax();
So the last thing to notice is that the table content was moved from _root.main.report to _root.main.report.content:PHP Code:
_root.main.scrollToMin();
download v14PHP Code:
_root.main.report.content["Question"+i].setTextFormat(myformat);//snippet
https://board.flashkit.com/board/ima...2021/01/3.jpeg
can you add print report as full A4
Hello, I added scroll wheel for the scroll bar, I will work on the printing task.
download v15
professional
there is a problem
if i enable the script in ( Scene_1 ) to Resize my form and this is first open ==> all objects no visible
but if it is second open it works fine
Scene_1 script :
PHP Code:
onFrame (2) {
stop();
Stage.scaleMode = "noScale";//don't stretch movieclips when resizing stage.
Stage.align = "TL";//align the start point of the stage to the top left of the window.
var scaleObject = new Object();//create empty object
Stage.addListener(scaleObject);//make empty object a stage listener for resize things
//since it is a stage listener, give it onResize function to get values when stage resizes, starting this after the function is better on startup
scaleObject.onResize = function() {//on resize will update when window is stretched so you can access Stage.width & Stage.height
//mc._x=0;//start mc at 0 x
main._width = Stage.width;
main._height=Stage.height
if(Stage.width>Stage.height){//do this for all stage resizes, a condition on how it will stretch if stage width is larger and the same for if height is larger to base it on height.
main._width=Stage.width;
main._height=Stage.height
}else if(Stage.height>Stage.width){//if height of stage is greater you have to do the same stretching but based on width instead
main._width=Stage.width;
main._height=Stage.height
}
};
}
can you solve this problem
This version can print up to 30 questions on A4 paper, but can handle hundreds if you aren't going to print. How many questions do you need to support?
download v16
it prints 2 pages the same data repeated
max questions = 200
Hello,
In the scripting section called report you can set the amount of questions you want per page.
So if you answer 50/200 the printout will appear as 1 page with 40 the other with 10, & if you set per_page to a different number you can end up with more pages, but I set it up to have 5 pages max so you should keep it as 40 per page.
If you want per_page to be 15 but still have 200 questions that would mean you would need 14 pages.PHP Code:
var question_num=200;
var per_page=40
To set it up for 14 pages you would go to the report scripting section & add more sections to this array:
On lines 161 of the scripting section called main you would need to follow the sequence if you want to add a 6th page etc...:PHP Code:
var print_content=[_root.section_1,_root.section_2,_root.section_3,_root.section_4,_root.section_5] //add more movieclip names here & duplicate the red dots you see on the stage, call them section_6 etc...
var print_content_available=[false,false,false,false,false] //add more falses per page you want added
On lines 241 of the scripting section called main you would need to follow the sequence if you want to add a 6th page etc...:PHP Code:
_root.main.report.print_content_available=[false,false,false,false,false]
_root.main.report.reset_container(_root.section_1,1,_root.main.report.per_page+1);
_root.main.report.reset_container(_root.section_2,_root.main.report.per_page+1,(_root.main.report.per_page*2)+1);
_root.main.report.reset_container(_root.section_3,(_root.main.report.per_page*2)+1,(_root.main.report.per_page*3)+1);
_root.main.report.reset_container(_root.section_4,(_root.main.report.per_page*3)+1,(_root.main.report.per_page*4)+1);
_root.main.report.reset_container(_root.section_5,(_root.main.report.per_page*4)+1,(_root.main.report.per_page*5)+1);
On lines 249 of the scripting section called main you would also have to follow the pattern to make a 6th page etc... possible:PHP Code:
_root.main.report.reset_container(_root.section_1,1,_root.main.report.per_page);
_root.main.report.reset_container(_root.section_2,_root.main.report.per_page+1,_root.main.report.per_page*2);
_root.main.report.reset_container(_root.section_3,(_root.main.report.per_page*2)+1,_root.main.report.per_page*3);
_root.main.report.reset_container(_root.section_4,(_root.main.report.per_page*3)+1,_root.main.report.per_page*4);
_root.main.report.reset_container(_root.section_5,(_root.main.report.per_page*4)+1,_root.main.report.per_page*5);
On line 267 of the scripting section called main you would need to follow the pattern to make a 6th page printable etc...:PHP Code:
_root.section_1._x=0-(_root.section_1._width*2)
_root.section_1._y=0
_root.section_2._x=0
_root.section_2._y=0-(_root.section_1._width*2)
_root.section_3._x=0
_root.section_3._y=0-(_root.section_1._width*2)
_root.section_4._x=0
_root.section_4._y=0-(_root.section_1._width*2)
_root.section_5._x=0
_root.section_5._y=0-(_root.section_1._width*2)
download v17PHP Code:
var page1;
var page2;
var page3;
var page4;
var page5;
if(_root.main.report.print_content_available[0]){
page = print_var.addPage(_root.section_1,{xMin:0,xMax:(_root.section_1._width*3),yMin:0,yMax:_root.section_1._height*4});
}
if(_root.main.report.print_content_available[1]){
page2 = print_var.addPage(_root.section_2,{xMin:0,xMax:(_root.section_2._width*3),yMin:0,yMax:_root.section_2._height*4});
}
if(_root.main.report.print_content_available[2]){
page3 = print_var.addPage(_root.section_3,{xMin:0,xMax:(_root.section_3._width*3),yMin:0,yMax:_root.section_3._height*4});
}
if(_root.main.report.print_content_available[3]){
page4 = print_var.addPage(_root.section_4,{xMin:0,xMax:(_root.section_4._width*3),yMin:0,yMax:_root.section_4._height*4});
}
if(_root.main.report.print_content_available[4]){
page5 = print_var.addPage(_root.section_5,{xMin:0,xMax:(_root.section_5._width*3),yMin:0,yMax:_root.section_5._height*4});
}
print_var.send();
https://board.flashkit.com/board/ima...2021/01/3.jpeg
but resize form still problem ( if it first open before answer any question ===> when you maximize form ===>problem )
I fixed a scrolling bug when the list gets to 200.
download v18
I worked on some scaling, it is still missing some performance tweaks & adjustments for the print button.
The scaling program is inside of the enterframe function at the questions section for now:
Some of the movie clips can scale fine with the basic:PHP Code:
modular++;
if(modular%5==0){
if(Stage.width>Stage.height){//do this for all stage resizes, a condition on how it will stretch if stage width is larger and the same for if height is larger to base it on height.
_root.main.questions.title._width=Stage.height/1.2
_root.main.questions.title._yscale=_root.main.questions.title._xscale
}else if(Stage.height>Stage.width){//if height of stage is greater you have to do the same stretching but based on width instead
_root.main.questions.title._width=Stage.width/1.2
_root.main.questions.title._yscale=_root.main.questions.title._xscale
}
_root.main.questions.bg._width=Stage.width
_root.main.questions.bg._height=Stage.height
_root.main.questions.bg._x=0
_root.main.questions.bg._y=0
_root.main.questions.title._x=Stage.width/2-_root.main.questions.title._width/2
_root.main.questions.title._y=_root.main.questions.title._height/2
if(Stage.width/1.7>Stage.height){
_root.main.questions.text_container._width=Stage.height/3
_root.main.questions.text_container._yscale=_root.main.questions.text_container._xscale
_root.main.questions.text_container._x=Stage.width-_root.main.questions.text_container._width-Stage.width/20
_root.main.questions.text_container._y=Stage.height/2-_root.main.questions.text_container._height/2
var scroll_pane_height=_root.main.report_container.report.mc._height*(_root.main.report_container._yscale/100);
_root.main.report_container._xscale=100//_root.main.default_w
_root.main.report_container._yscale=100//=_root.main.default_h
while(_root.main.report_container._width<Stage.width/3){
_root.main.report_container._width*=2
_root.main.report_container._yscale=_root.main.report_container._xscale
}
_root.main.report_container._x=int(_root.main.questions.text_container._x/2)-_root.main.report_container._width/2-+(_root.main.report_container.report._width/14.4)
_root.main.report_container._y=Stage.height/2-scroll_pane_height/2
_root.main.print_btn._x=_root.main.report_container._x+(_root.main.report_container.report._width/11.6)*(_root.main.report_container._yscale/100);//+(_root.main.report_container.report._width/14.4)
_root.main.print_btn._y=_root.main.report_container._y+scroll_pane_height+_root.main.print_btn._height/3//_root.main.report_container.report._y+scroll_pane_height+_root.main.print_btn._height/3
} else{
_root.main.questions.text_container._width=Stage.width/3.5
_root.main.questions.text_container._yscale=_root.main.questions.text_container._xscale
_root.main.questions.text_container._x=Stage.width/2-_root.main.questions.text_container._width/2
_root.main.report_container._xscale=100//_root.main.default_w
_root.main.report_container._yscale=100//=_root.main.default_h
var scroll_pane_height=_root.main.report_container.report.mc._height*(_root.main.report_container.report._yscale/100);
var scroll_pane_width=((_root.main.report_container._width+(_root.main.report_container.report._width/90)))
_root.main.report_container._x=Stage.width/2-((_root.main.report_container._width+(_root.main.report_container.report._width/7))/2)-Stage.width/140
//_root.main.report_container._x=Stage.width-((_root.main.report_container._width+(_root.main.report_container.report._width/14.4)))-Stage.width/140
if(Stage.width<scroll_pane_width){
_root.main.report_container._x=Stage.width-scroll_pane_width-(_root.main.report_container.report._width/14.4)
}else{
}
_root.main.print_btn._x=_root.main.print_btn._width/3
_root.main.print_btn._y=_root.main.report_container._y-_root.main.print_btn._height-_root.main.print_btn._height/3
_root.main.report_container._y=Stage.height-scroll_pane_height-Stage.height/50
_root.main.questions.text_container._y=Stage.height/2-_root.main.questions.text_container._height/2+((_root.main.questions.title._y+_root.main.questions.title._height)/2)-Stage.height/7
}
}
Movieclips such as report had another conditional section based off of /1.7 stretching:PHP Code:
if(Stage.width>Stage.height){
}else if(Stage.height>Stage.width){
}
download v19PHP Code:
if(Stage.width/1.7>Stage.height){
}else{
}
thanks AS3.0
Thank you soooooooooooooooooooooooooo much
Alright I worked on the scaling.
-Happy holidays
download v20
Resize bug fix after print:
download v21
https://board.flashkit.com/board/ima.../2022/11/3.jpg
I added the login form
and I added code OpenFileDailog
Load_pic script :
PHP Code:
on (press) {
import flash.net.FileReference;
var allTypes:Array = new Array();
var imageTypes:Object = new Object();
imageTypes.description = "Images (*.jpg, *.jpeg, *.png)";
imageTypes.extension = "*.jpg; *.jpeg; *.png";
allTypes.push(imageTypes);
var listener:Object = new Object();
listener.onSelect = function(file:FileReference):Void {
pics.loadMovie(file.name);
}
listener.onCancel = function(file:FileReference):Void {
}
var fileRef:FileReference = new FileReference();
fileRef.addListener(listener);
fileRef.browse(allTypes);
}
How can this shape be filled with the image ( my image inside this shape )
and save this pic in SharedObject for next open
Random SharedObject v22 : https://app.box.com/s/jtgw2av90wo1xn6a42v65pyyy2jufvdm
Hi,
For the login section, I added the movieclips to an mc called login_container & gave the orange movieclips inside an alpha of 0 to show the initial default image:
When the default image is pressed the button called Load_pic calls the function_root.fileRef thats on the first onFrame(2) section of the script:PHP Code:
_root.login_container.profile_img._alpha=0
_root.login_container.image_mask._alpha=0
_root.fileRef thats in the onFrame(2) scripting section has a listener called onSelect that will save the file name to array position 21 of the shared object for next startup to attempt to load it:PHP Code:
_root.fileRef.browse(_root.allTypes);
The startup attempt to load the users image is on line 41 of the onFrame(2) scripting section:PHP Code:
listener.onSelect = function(file:FileReference):Void {
str=file.name
_root.main.questions.open.data.Questions[_root.main.questions.open.data.array[0]][21]=str
img_loader.loadClip(str, _root.login_container.profile_img);
}
line 73 startup attempt to load an image if str turned out to be the last saved item on array section [21]:PHP Code:
var str=_root.main.questions.open.data.Questions[_root.main.questions.open.data.array[0]][21]
The onLoadInit event changes the profile_img & image_mask to have an alpha of 100 again since an image was loaded:PHP Code:
img_loader.loadClip(str, _root.login_container.profile_img);
On lines 86 of the scripting section called onFrame(2) when you click the login_btn to submit your user name it checks if user name length is greater than 0 to proceed.PHP Code:
loader_listener.onLoadInit = function(e:MovieClip) {
_root.login_container.profile_img._alpha=100
_root.login_container.image_mask._alpha=100
e._width=175//Set to size of profile pic.
e._height=195
_root.login_container.profile_img._x=_root.login_container.image_mask._x-1 //Set to position of profile pic.
_root.login_container.profile_img._y=_root.login_container.image_mask._y-1
_root.login_container.profile_img.setMask(null) //Reset mask to be null to have multiple attempts at uploading images.
_root.login_container.profile_img.setMask(_root.login_container.image_mask)// Set profile_img to have a mask named image_mask.
_root.resize() //Call resize event to refresh centering.
};
Once _root.logged_in is set to true you can call _root.resize so that _root.resize() can make the login form invisible & also make the answering section visible:
Inside of the resize function at the onFrame(2) scripting section I set the resize event to update the size & position of the movieclip called login_container that stores the profile image & user name for display:PHP 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
_root.logged_in=true
_root.resize()
}else{
_root.login_container.data_field.text="Please enter your name to sign in." //If failed to submit a user name, give the user a text notice.
}
}
Also at the center of the resize function at the scripting section called onFrame(2) you can see that the centering script is there as well:PHP Code:
if(Stage.width>Stage.height){
_root.login_container._width=Stage.height/2 // If the stage width is greater than the stage height resize based on Stage.height/2.
_root.login_container._yscale=_root.login_container._xscale
}else if(Stage.height>Stage.width){
_root.login_container._width=Stage.width/2 // If the stage width is greater than the stage height resize based on Stage.width/2.
_root.login_container._yscale=_root.login_container._xscale
}
download v23PHP Code:
_root.login_container._x=Stage.width/2-_root.login_container._width/2 // Get Stage.width/2 which is the half size of the stage and subtract by half size of the login_container with the registration point at the top left.
_root.login_container._y=Stage.height/2-_root.login_container._height/2
I tested the file but the image did not work
Ok 1 sec, as2 might be limiting certain directories if they aren't specified/same folder.
We can assign it a specific file path that the image will be in?
in the same folder but the image did not work