Solved

Printing problems with Flash actionscript 3.0 application

Posted on 2011-10-01
2
384 Views
Last Modified: 2012-05-12
I am utilizing the following code to print the contents of my flash application after the user clicks the print button, the printer dialogue screen comes up and you select ok, but nothing prints, it doesn't even show any documents pending. Ive tried printing from other applications and there is no problems. Please advise.
 
function printContent(event: MouseEvent):void
{
var printContent = overallTrainingCost_txt.text + returnedDistance_txt.text + returnedTime_txt.text
var pageSprite: Sprite = new Sprite;
var printJob:PrintJob = new PrintJob();
   if (printJob.start()) 
   
if (printJob.start()) {

     if (printContent.width>printJob.pageWidth) {
         printContent.width = printJob.pageWidth;
		 printContent.wordWrap = true;
		 addChild (pageSprite);
		 pageSprite.addChild(printContent);
		 printContent.addPage(pageSprite);
		 
		 }
   
     printJob.send();
	 removeChild (pageSprite);
   }
}

Open in new window

MapSimple-Testing2.fla
0
Comment
Question by:fool5683
2 Comments
 
LVL 29

Accepted Solution

by:
dgofman earned 500 total points
ID: 36898750
I cannot see where in your code you are concatinating string.
Ok, try my solution and let me know if works for you or not

var textArea:TextField = new TextField();
textArea.multiline = true;
textArea.wordWrap = true;
textArea.text = overallTrainingCost_txt.text + returnedDistance_txt.text + returnedTime_txt.text;

var pageSprite: Sprite = new Sprite;
pageSprite.addChild(textArea);

var printJob:PrintJob = new PrintJob();  
if (printJob.start()) {
      textArea.width = printJob.pageWidth;
      textArea.height = printJob.pageHeight;
      printJob.addPage(pageSprite);
    printJob.send();
}
0
 

Author Closing Comment

by:fool5683
ID: 36899060
It worked perfectly! Thank you very much. You have been a godsend on this project dgofman:)
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Here are some practices and techniques that can be adopted into your Flash/Flex application development process. Note: Not all "performance tips" provide an immediately-recognizable benefit.   This article does not include timing validation data,…
This article describes a solution to a problem of subloading one movie into another when they have different SWF versions. Sometime back, I was working on an ActionScript project while I came across an interesting fact which I would like to share…
The viewer will learn how to count occurrences of each item in an array.
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now