3 Replies Latest reply on May 16, 2009 10:34 AM by kglad

    Printing with Button and Submiting Input Text in CS4

    cterry06

      I've got a few questions if anyone can help me.

       

      First, I am trying to make a box where a student enters their name and then clicks a button so their name is rememered and shows up.  I have created an input text instance called "nameText" and a button to submit it called "submitMe".

       

      Second, in this game I would like to keep track of when a specific button is clicked.  In this game I'm having incoming freshman into college decide if the statement applies to college or high school by clicking on a button (saying high school or college).  I want to keep track of their choices and display them on a result page, then clear when I click the replay button on the results page.  Each button has its own name for each of the 12 questions (hs1 for high school c1 for college, and so forth until hs12 and c12).

       

      Third, I'm looking for any advice on how to print in flash.  The person I am developing this program for wants students to print their results (with their name on it from the "nameText" input field) and be able to hand it in to her in class.  I am not sure how to do this and I can't seem to find a clear way that works.  I have made a button called "printMe"

       

      Any help would be greatly appreciated.  If you need me to send the flash file to you to look at, please reply.

       

      Otherwise I've attached the swf file so you can see what I'm thinking.

       

      Thanks!

        • 1. Re: Printing with Button and Submiting Input Text in CS4
          kglad Adobe Community Professional & MVP

          all textfields in flash have a text property that you can use to retrieve or change the textfield's text content.  and you will use variables to store the text properties of interest to you and the button choices.  you can then retrieve those variable's values when needed.

           

          to print in flash, check the printjob class in the flash help files. sample code is included there.

          • 2. Re: Printing with Button and Submiting Input Text in CS4
            cterry06 Level 1

            Can you give me some clearer directions on the textfield?

             

            Also, for printing do I need to add a movie clip or not?

             

            I used this code:

            var pj:PrintJob = new PrintJob();
            pj.start();
            pj.addPage( this );   // this refers to the Document object of the executing MovieClip
            pj.send();

             

            and I got a dialog box, but I got this message:

                Error: Error #2057: The page could not be added to the print job.
                at Error$/throwError()
                at flash.printing::PrintJob/addPage()
                at Freshmanseminar_fla::MainTimeline/printHandler()

             

            what does that mean?

            • 3. Re: Printing with Button and Submiting Input Text in CS4
              kglad Adobe Community Professional & MVP

              if you have a textfield with instance name tf, you can use:

               

              tf.text

               

              to reference the text in the textfield.

               

              in as2, you need a movieclip for the addPage parameter.  in as3, you can use a sprite.