A Flash Developer Resource Site

Results 1 to 4 of 4

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

  1. #1
    Junior Member
    Join Date
    Apr 2011
    Posts
    23

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

    Hello peeps!

    I already have a flash form(1280x1024 stagesize fullscreen) that allows the users to type in their name/age and take a photo of their face. I was thinking is it possible to print out a card , for example "credit size CARD" with flash AS3? And of course, is it also possible to generate a unique barcode for every user and print it on the card? Any tutorials/tips out there please? I just started AS3 3 weeks ago so I think I need some sample codes to play with..

  2. #2
    Junior Member
    Join Date
    Aug 2013
    Posts
    24
    Quote Originally Posted by celestale View Post
    Hello peeps!

    I already have a flash form(1280x1024 stagesize fullscreen) that allows the users to type in their name/age and take a photo of their face. I was thinking is it possible to print out a card , for example "credit size CARD" with flash AS3? And of course, is it also possible to generate a unique barcode for every user and print it on the card? Any tutorials/tips out there please? I just started AS3 3 weeks ago so I think I need some sample codes to play with..
    but how to make it unique?

  3. #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

  4. #4
    Junior Member
    Join Date
    Aug 2013
    Posts
    24
    Quote Originally Posted by angelhdz View Post
    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.
    thanx for your kindness

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