A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: [Flash] How to print a credit size card with flash

Threaded View

  1. #3
    Designer, Programmer, Musician angelhdz's Avatar
    Join Date
    Mar 2010
    Posts
    971
    Just add a Print button and name it anything you like like "printButton" and place this code in the current frame in the main timeline:

    PHP Code:
    printBtn.addEventListener(MouseEvent.MOUSE_UPprintThis);
    function 
    printThis(e:MouseEvent):void
    {
    var 
    myPrintJob:PrintJob = new PrintJob();
    myPrintJob.start(); 
    myPrintJob.addPage(card);
    myPrintJob.send();

    Where "card" is the name of the movieclip to be printed.
    If you want to print the whole stage, use this in the printThis function:

    PHP Code:
    var bd :BitmapData = new BitmapData(stage.stageWidthstage.stageHeightfalse);
     
    bd.draw(stage);
     var 
    b:Bitmap = new Bitmap (bd);
     var 
    card:Sprite = new Sprite();
     
    card.addChild(b);


    var 
    myPrintJob:PrintJob = new PrintJob();
    myPrintJob.start(); 
    myPrintJob.addPage(card);
    myPrintJob.send(); 
    And for the "card size", you have to check how to convert the ID or Credit card size (inches) to pixeles
    (Government Size 2 5/8" x 3 7/8")

    And make the movieclip of the card that size.


    Now...for the barcode thing, I've read something about barcodes in this forum, i will be reading about it and let you know.
    Last edited by angelhdz; 01-25-2014 at 06:19 AM.
    Already mastering AS3. It was so fun. Now into Javascript and PHP and all its libraries

Tags for this Thread

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