A Flash Developer Resource Site

Page 4 of 5 FirstFirst 12345 LastLast
Results 61 to 80 of 89

Thread: Random SharedObject

  1. #61
    Senior Member
    Join Date
    May 2016
    Posts
    451
    If you rename swf file or exe file

  2. #62
    Client Software Programmer AS3.0's Avatar
    Join Date
    Apr 2011
    Posts
    1,404
    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...
    Last edited by AS3.0; 12-01-2022 at 07:31 AM.

  3. #63
    Senior Member
    Join Date
    May 2016
    Posts
    451
    Sorry, I don't understand server and network
    Is it possible to change swf file name without losing data

  4. #64
    Client Software Programmer AS3.0's Avatar
    Join Date
    Apr 2011
    Posts
    1,404
    The answer is no.

    The partition is based on the applications name.
    Last edited by AS3.0; 12-01-2022 at 03:54 PM.

  5. #65
    Client Software Programmer AS3.0's Avatar
    Join Date
    Apr 2011
    Posts
    1,404
    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.

    PHP Code:
    _root.report_container._y=Stage.height/2-(_root.report_container.report_preview.mask._height*(_root.report_container._xscale/100))///The upscale is divided by 100 before multiplying it by (_root.report_container._xscale/100). 
    Would you like to continue this project in AS3 or it is ok that the cookie changes when the file name is different.

    download v33
    Last edited by AS3.0; 12-02-2022 at 09:42 PM.

  6. #66
    Client Software Programmer AS3.0's Avatar
    Join Date
    Apr 2011
    Posts
    1,404
    Hi, scrollwheel support for report preview was added.

    At the main scripting section on lines 214:
    PHP 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
    }
    }

    download v34

  7. #67
    Client Software Programmer AS3.0's Avatar
    Join Date
    Apr 2011
    Posts
    1,404
    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:
    PHP 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

    download v35
    Last edited by AS3.0; 12-04-2022 at 04:28 PM.

  8. #68
    Senior Member
    Join Date
    May 2016
    Posts
    451
    awesome

  9. #69
    Client Software Programmer AS3.0's Avatar
    Join Date
    Apr 2011
    Posts
    1,404
    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.
    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

        

    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:
    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.

    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:
    mouseListener.onMouseWheel = function(scr) { 

    if(
    _root.main.questions.dialog_open==false){
    //truncated data...
    }

    }; 
    download v36
    Last edited by AS3.0; 12-06-2022 at 05:55 AM.

  10. #70
    Senior Member
    Join Date
    May 2016
    Posts
    451
    yes, this is
    **************
    ( while timer -- )

    if you closed the file
    can you restart timer to 20 sec again

  11. #71
    Client Software Programmer AS3.0's Avatar
    Join Date
    Apr 2011
    Posts
    1,404
    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:
    PHP 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.

    download v37

  12. #72
    Client Software Programmer AS3.0's Avatar
    Join Date
    Apr 2011
    Posts
    1,404
    Bug fix at the 2 button menu:

    download v38

  13. #73
    Client Software Programmer AS3.0's Avatar
    Join Date
    Apr 2011
    Posts
    1,404
    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?

  14. #74
    Senior Member
    Join Date
    May 2016
    Posts
    451
    after the last question directly

    1- disable buttons
    2- invisible questions
    3- show certificate ( can print )

  15. #75
    Client Software Programmer AS3.0's Avatar
    Join Date
    Apr 2011
    Posts
    1,404
    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:
    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"

    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.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.
     

    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>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

    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:
    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...

    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?

    If anything send me a design of the certificate section.

    download v39
    Last edited by AS3.0; 12-10-2022 at 07:50 PM.

  16. #76
    Client Software Programmer AS3.0's Avatar
    Join Date
    Apr 2011
    Posts
    1,404
    I will send you a bug fix for the autologin.
    Last edited by AS3.0; 12-11-2022 at 11:52 PM.

  17. #77

  18. #78
    Client Software Programmer AS3.0's Avatar
    Join Date
    Apr 2011
    Posts
    1,404
    This solves an undefined issue:

    download v41
    Last edited by AS3.0; 12-12-2022 at 02:24 AM.

  19. #79
    Client Software Programmer AS3.0's Avatar
    Join Date
    Apr 2011
    Posts
    1,404
    Hello,

    Inside of the onFrame(2) scripting section at the end I put a drag and drop script for the certificate windows drag bar:
    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.

    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.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
    }

    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.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. 
    I will work on the printing part tomorrow.

    download v42
    Last edited by AS3.0; 12-14-2022 at 04:15 AM.

  20. #80
    Client Software Programmer AS3.0's Avatar
    Join Date
    Apr 2011
    Posts
    1,404
    Hi, you can print the certificate now.

    The accessor for the certificate movieclip is:
    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. 
    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["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
    Last edited by AS3.0; 12-15-2022 at 01:54 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center