A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: [RESOLVED] Printing a specific movieclip

  1. #1
    Member
    Join Date
    Apr 2008
    Location
    Indianapolis, IN
    Posts
    75

    resolved [RESOLVED] Printing a specific movieclip

    Hi! I have a swf with multiple movieclips on the stage. The user interaction involves adding images to one of the movieclips (the one outlined in red in the image below). I would like the user to then be able to print the movieclip that they were adding images to...NOT the whole stage.


    I can kind of do this by specifying the print area, but I would rather not do this as it also prints some overlapping images (see image below).


    I thought I remembered there being a way in AS2 to just print one of the movieclips on the stage, but I can't figure out how to do it in AS3.

    Thanks for any help.

  2. #2
    Senior Member cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,448
    When you use addPage you enter only the name of the MovieClip.

    var pj:PrintJob = new PrintJob();
    pj.addPage(mc);
    pj.send();
    - The right of the People to create Flash movies shall not be infringed. -

  3. #3
    Member
    Join Date
    Apr 2008
    Location
    Indianapolis, IN
    Posts
    75
    Thanks cancerinform, I have actually tried that before, and it won't let me pass the movieclip like that (I guess it has to be a Sprite?). I get the following error when I try to do that:

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

    This was the code I had tried:

    PHP Code:
    function printGirl (e:MouseEvent):void {
        var 
    pj:PrintJob = new PrintJob();
        
    pj.addPage(mainStage_mc);
        
    pj.send();
    }


    print_btn.addEventListener(MouseEvent.CLICKprintGirl); 
    I have also tried this code, and it prints a blank page and the mainStage_mc movieclip disappears from the stage:

    PHP Code:
    function printGirl (e:MouseEvent):void {
        var 
    myPrintJob:PrintJob = new PrintJob();
        var 
    mySprite:Sprite = new Sprite();
        
    mySprite.addChild(mainStage_mc); 
        
    myPrintJob.start();
        var 
    myOptions:PrintJobOptions = new PrintJobOptions();
        
    myOptions.printAsBitmap true;
        
    myPrintJob.addPage(mySpritenullmyOptions);
        
    myPrintJob.send();

    Thanks again for any help!

  4. #4
    Senior Member cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,448
    You need to add start:

    var pj:PrintJob = new PrintJob();
    pj.start();
    pj.addPage(mainStage_mc);
    pj.send();
    - The right of the People to create Flash movies shall not be infringed. -

  5. #5
    Member
    Join Date
    Apr 2008
    Location
    Indianapolis, IN
    Posts
    75
    Thanks! That did it!

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