Skip to main content
Known Participant
April 23, 2009
Question

how to print with as3??

  • April 23, 2009
  • 3 replies
  • 1415 views

hi guys , i'm new to programming so please give me some help. i'm doing a project on personality test. So different input user will have different result page. At the end of the program , i would like to have a print button to print the result of that particular person, however there are around 4 result page where 1 page will have a few instance in it.  Can anyone guide me through ? Or provide me with the code?

This topic has been closed for replies.

3 replies

Known Participant
April 24, 2009

sorry guys i still dun get it. For example , my 1st page there is myText_txt and myBg_mc . This two will be my 1st result page , but there is still a next button to proceed to the 2nd result page .  So how do we put into the sprite ??

kglad
Community Expert
Community Expert
April 24, 2009

var sp:Sprite=new Sprite();

sp.addChild(myText_txt);

sp.addChild(myBg_mc);

pj.addPage(sp);  // if pj is the printjob instance.

// similarly with whatever is on the 2nd page.

Known Participant
April 24, 2009

Thanks kglad , it works but what if all my instances is in array? my program will be like this?

var sp:Sprite=new Sprite();

sp.addChild(myText);

sp.addChild(myBg);

pj.addPage(sp);

April 23, 2009

start with this:

import flash.printing.*;

import flash.display.Sprint;

var pj:PrintJob = new PrintJob;

if(pj.start())

{

     pj.addpage(YourSprite);

     pj.send();

}

kglad
Community Expert
Community Expert
April 23, 2009

you can use the printjob class to print multiple pages to your printer by using the addPage() method to add sprites/movieclips to your printjob.