Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Printing problems with Flash actionscript 3.0 application

Posted on 2011-10-01
2
Medium Priority
?
443 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 2000 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have been doing hardcore actionscripting for some time; and needless to say I have faced a lot of problems in just understanding others' code rather than understanding what the code executes. A programmer's life can become hell when there are a lo…
The Windows functions GetTickCount and timeGetTime retrieve the number of milliseconds since the system was started. However, the value is stored in a DWORD, which means that it wraps around to zero every 49.7 days. This article shows how to solve t…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
This Micro Tutorial will teach to how to utilize bit rate in Adobe Flash Media Live Encoder.
Suggested Courses

886 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