A Flash Developer Resource Site

Results 1 to 8 of 8

Thread: Printable results

  1. #1
    Member
    Join Date
    Jun 2006
    Posts
    34

    Printable results

    I'm making a bracket tool for march madness. I have everything done except now I have to make the content be printable. Not only does it have to print the teams that the person picks but also the graphics that make up the bracket.

    I've searched this form and many others without much help. Could someone point me in the right direction or at least let me know if this is possible?

    (It doesn't matter if version of flash either.)

    Thanks in advance

  2. #2
    Ryan Thomson EvolveDesigns's Avatar
    Join Date
    Oct 2001
    Location
    British Columbia
    Posts
    3,338
    Look up the print function in your flash help (just type print in the actions window then click F1) It's pretty easy to set up as long as you don't have to print multiple pages - that is a nightmare

    What I do is make a new movie clip (instance name of printMe) and hide it off stage. Format it as you want (ie add a nice header/footer) then duplicate the content entered by the visitor in the hidden movieclip. Now when you want to print you'd use code something like:

    PHP Code:
    print(printMe"bframe"); 
    There are even easier approaches, but I like the offstage clip approach because you can control the formating without affecting the look of your flash piece.
    Evolve Designs Interactive Media
    the natural selection

  3. #3
    Member
    Join Date
    Jun 2006
    Posts
    34
    Ah thanks man. As soon as I posted this I found something about the code you posted.

    I'll give your advice a shot.

  4. #4
    Member
    Join Date
    Jun 2006
    Posts
    34
    I just tried it out. Your advice worked perfect. All I have to do is figure out how to make it print landscape and then it's a wrap.

    Thanks again EvolveDesign

  5. #5
    Member
    Join Date
    Jun 2006
    Posts
    34
    ok. not to totally go against what you gave me (which I tried and it worked perfect). I wanted to use as3 if I could.

    So I did some more searching and messing around and got my swf to print. using as3. The weird thing is it prints a blank page. Here's my script.

    PHP Code:
    import flash.printing.PrintJob
    import flash
    .display.Sprite;

    print_btn.addEventListener(MouseEvent.MOUSE_DOWNprintthis);

    function 
    printthis(event:MouseEvent):void {
        var 
    myPrintJob:PrintJob = new PrintJob();
        var 
    mySprite:Sprite = new Sprite();

        {
        
    myPrintJob.start();
        
    myPrintJob.addPage(mySprite);
        
    myPrintJob.send();
        }

    I have a button on the stage that someone presses to get this to print (print_btn).

    All of what I know about flash is self taught so I might have some extra code that isn't needed.

    I can always use the first bit of code you gave me if we can't this deal to work.

    Thanks again

  6. #6
    Ryan Thomson EvolveDesigns's Avatar
    Join Date
    Oct 2001
    Location
    British Columbia
    Posts
    3,338
    Sorry I'm not much help with as3, it scares me I don't see anywhere in your code that connecting the print job with what to print? Is that the sprite part? Maybe someone else will have more to offer.

    ps there's an as3 section, you might get more feedback there.

    good luck!
    Evolve Designs Interactive Media
    the natural selection

  7. #7
    Member
    Join Date
    Jun 2006
    Posts
    34
    If I were to use as2 do you know how to make the content scale to fit the page and adjust page orientation?

  8. #8
    Ryan Thomson EvolveDesigns's Avatar
    Join Date
    Oct 2001
    Location
    British Columbia
    Posts
    3,338
    scaling to fit is one of things you can waste alot of paper on saddly... I use acrobat distiller to print to pdf for testing. I think 800x600 works ok. As to page orientation, can u just flip your movieclip 90degrees?
    Evolve Designs Interactive Media
    the natural selection

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