A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: How do you print dynamic text boxes, and nothing else

  1. #1
    Junior Member
    Join Date
    Apr 2011
    Posts
    25

    How do you print dynamic text boxes, and nothing else

    I am working on a exam program in Flash CS5. There's a page that displays the scores for each test a user has completed; and on that page I'm putting a print button so the users can print the results. So far I've found only one script that will actually work to print anything at all:
    Code:
    printButton.onPress = function() {
    print(drawingArea, "bframe")
    }
    With the instance name of the frame to print labeled #p

    This works, to an extent; however it is the most fickle piece of...script, I have ever seen. It can only be laid out 1 one way, so far as I've found, to even remotely work; it can only print a single frame, I can't change the page orientation and anything else, even ways people in similar forums and threads have said have worked in years past, make the program go nuts. But here's the problem, the only way this does work, is by printing EVERYTHING on that frame, even objects not on the stage. More importantly, it's printing the background of the program, which I don't want it to do, because that could use a lot of ink when the users print their scores.
    I tried setting a copy of just the dynamic text boxes that show the final results, into a frame by themselves, with nothing else, no background, nothing; and setting the instance name for that frame as #p (removing it from the frame that normally prints, since it wont work properly if both have that instance name) but when I run the program and hit print - it will print that frame containing just the dynamic text boxes, but the boxes containing the input scores goes blank immediately after I click the print button. I even tried adding to the print button, the script that populates those text fields with their respective scores in the first place, which has worked elsewhere to make the scores appear automatically, but it still doesn't work for this.

    So I looked again about configuring it to print just the data in those boxes; and I found this script:
    Code:
    on (release) {
    function printProforma(){
    print(this.proforma, "bframe");
    }
    }
    The dynamic text boxes are supposed to be placed inside a movie clip called "proforma" and you're supposed to be able to place it anywhere, even off the stage - but where it apparently worked for the person in the thread I found it in, it doesn't work in my program. I don't know if it prints the dynamic text boxes; I can't get that far, because when I click print using this script, it tries to print every single frame in the program and practically kills my computer in the process, trying to spool so many pages.

    Can anyone PLEASE help me figure this out??

  2. #2
    Junior Member
    Join Date
    Apr 2011
    Posts
    25
    Okay, new tact - I found this thread from about 6 years ago: http://www.actionscript.org/forums/s...d.php3?t=72743
    the user pan69 offered a solution (and sample FLA/SWF) with an alternative printing method that actually works, and better still, prints the contents of a movie clip that doesn't have to be on the stage or anywhere, aside from the library.

    The problem is, the results don't appear in the print out. The dynamic text boxes that show the results are inside the movie clip that gets printed, but it doesn't seem to be getting the command to input the text/score for those fields. I tried incorporating the script that populate those fields for the results page, into the script for the print button, but that didn't work. I tried a script in the movie clip, to load the data on entering the frame, but that didn't work.
    Part of it could be that this printing method is more intricate than I'm familiar with; such that, to make it work, I had to copy the entire button into my program, along with the movie clip from the source and replace the content of the MC with my own.

    How can I get the fields to populate with the corresponding input?

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