A Flash Developer Resource Site

Results 1 to 10 of 10

Thread: [RESOLVED] Print masked shape?

  1. #1
    Member
    Join Date
    Oct 2010
    Posts
    55

    resolved [RESOLVED] Print masked shape?

    Hey guys, is there anyway I can print a masked shape?

    I'm doing a drawing application, and the 'paint' on it is a mask. When I try to print, it either prints only the whole mask, or only the shape, all in black.

    Any help is much appreciated!

  2. #2
    Senior Member cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,449
    How do you create the mask, probably not by code?
    - The right of the People to create Flash movies shall not be infringed. -

  3. #3
    Member
    Join Date
    Oct 2010
    Posts
    55
    hi cancerinform, thanks for the reply.

    And yes, the mask is created by code...I believe its this one (I'm new on AS3...if its not, please tell me.)

    maskmovieclip.cacheAsBitmap = true;
    draw.cacheAsBitmap = true;
    maskmovieclip.mask = draw;

  4. #4
    Member
    Join Date
    Oct 2010
    Posts
    55
    no one?

  5. #5
    Senior Member cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,449
    This works. You have a MovieClip mc on the stage and another Movieclip myMask as a mask over it. Then you have a function with a printjob.

    PHP Code:
    import flash.events.MouseEvent;
    import flash.printing.PrintJob;

    mc.mask myMask;
    addEventListener (MouseEvent.CLICKch);
    function 
    ch (e:MouseEvent)
    {
        var 
    pj:PrintJob = new PrintJob();
        if (
    pj.start())
        {
            try
            {
                
    pj.addPage (mc);
            }
            catch (
    e:Error)
            {
                
    // handle error 
            
    }
        }
        
    pj.send ();

    - The right of the People to create Flash movies shall not be infringed. -

  6. #6
    Member
    Join Date
    Oct 2010
    Posts
    55
    I gave it a try, cancer...but, as I said, it's only printing the shape in black, or printing the whole mask...

    I'm trying to print both at the same page...I believe this is not possible using PrintJob?

    sorry for me being such a noob.

  7. #7
    Senior Member cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,449
    The script I provided prints only the masked area in the correct color. To print anything from flash you can only use the printjob.
    - The right of the People to create Flash movies shall not be infringed. -

  8. #8
    Member
    Join Date
    Oct 2010
    Posts
    55
    that's odd...i did the code exactly as you did, but it prints the stupid whole mask..

    here's the printJob code.

    PHP Code:
    function imprime (e:MouseEvent){
        var 
    imprime:PrintJob = new PrintJob();
        var 
    options:PrintJobOptions = new PrintJobOptions();
        
    options.printAsBitmap true;
        if(
    imprime.start()) {                
            try {
            
    imprime.addPage(maskmovieclip);
        } catch(
    e:Error) {
            
    // do nothing
        
    }
        
    imprime.send();
    }


  9. #9
    Senior Member cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,449
    It will print the mask only when the mask is the object to print and when the mask does not function as the mask.
    - The right of the People to create Flash movies shall not be infringed. -

  10. #10
    Member
    Join Date
    Oct 2010
    Posts
    55
    stupid me, I forgot to set the mask in the function. It worked pretty well.

    thank you very very very much, cancerinform!

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