AS3 Printing help
A Flash Developer Resource Site

Results 1 to 8 of 8

Thread: AS3 Printing help

  1. #1
    Senior Member
    Join Date
    Aug 2008
    Posts
    137

    AS3 Printing help

    Hey all!

    ok back at another issues in as3 printing

    Code:
    //Function to print entire screen
    function printFunction(event:MouseEvent):void
    {
        var myPrintJob:PrintJob = new PrintJob();
        var oldScaleX:Number = root.scaleX;
        var oldScaleY:Number = root.scaleY;
       
        //Start the print job
        myPrintJob.start();
       
        //Figure out the new scale
        var newScaleX:Number = myPrintJob.paperWidth/root.width;
        var newScaleY:Number = myPrintJob.paperHeight/root.height;
    
        //Shrink in both the X and Y directions by the same amount (keep the same ratio)
        if(newScaleX < newScaleY)
            newScaleY = newScaleX;
        else
            newScaleX = newScaleY;
       
        root.scaleX = newScaleX;
        root.scaleY = newScaleY;
               
        //Print the page
        myPrintJob.addPage(Sprite(root));
        myPrintJob.send();
        
        //Reset the scale to the old values
        root.scaleX = oldScaleX;
        root.scaleY = oldScaleY;
    }
    I cant seem to find anything thats really helpful with this. When i click cancel on the print dialog box, i get error below and it blanks out my swf.
    any help is greatly appreciated. ALL I am trying to do is print the entire screen. i dont care at this moment about orientation.
    Code:
    Error #2057: The page could not be added to the print job.
    	at Error$/throwError()
    	at flash.printing::PrintJob/addPage()
    	at designStudiov3_fla::MainTimeline/printFunction()
    NO *****ASSNESS AROUND ME!!!!

  2. #2
    Senior Member
    Join Date
    Aug 2008
    Posts
    137
    bump anyone??
    NO *****ASSNESS AROUND ME!!!!

  3. #3
    Mod cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,435
    Is your page a Sprite?
    - The right of the People to create Flash movies shall not be infringed. -
    | www.Flashscript.biz | Flashscript Biz Classes/Components |

  4. #4
    Senior Member
    Join Date
    Aug 2008
    Posts
    137
    no... my page isnt a Sprite. How would i make it so? is that the reason why i am having trouble with the cancel button?
    NO *****ASSNESS AROUND ME!!!!

  5. #5
    Junior Member
    Join Date
    Jun 2010
    Posts
    9
    I need help badly, i am having this exact same issue, does anyone knows whats happening?

  6. #6
    Junior Member
    Join Date
    Jun 2010
    Posts
    9
    please has anybody accomplished this?

  7. #7
    Mod cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,435
    Change myPrintJob.addPage(Sprite(root)); to myPrintJob.addPage(MovieClip(root));
    - The right of the People to create Flash movies shall not be infringed. -
    | www.Flashscript.biz | Flashscript Biz Classes/Components |

  8. #8
    Junior Member
    Join Date
    Jun 2010
    Posts
    9

    Unhappy

    Quote Originally Posted by cancerinform View Post
    Change myPrintJob.addPage(Sprite(root)); to myPrintJob.addPage(MovieClip(root));
    Hi thanks for your reply, being really desperate about this.

    Well i try that, and it drew another movie clip, and blanked out my main video.

    i'm having a problem, where i developed an app that uses the webcam, adds an image and then takes a picture, well, i implemented textbook style the printjob, and well everytime after printing my swf goes blank.

    http://stackoverflow.com/questions/3...rint-or-cancel

    But now i have been continuing testing, and i found out, that if i print from another application and then comeback, my video stream from the webcam is blank, this has no sense at all, since i am printing from another app.

    What is going on here i mean, this must be a flash player issue right.

    I need help badly with this.

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

Poll by Flashkit.com