Solved

Printing problems with Flash actionscript 3.0 application

Posted on 2011-10-01
2
408 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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Sed question 2 85
AutoHotkey ActiveX Component Error 8 86
Using a variable to name output in powershell script 2 38
Bartender label printing - switch on and off graphics 3 38
Recently I have been answering a lot of questions like this in IT forums that I frequent. The question posed is usually something along the lines of "We have software X installed and need to uninstall it for reason Y" or some other variant of the sa…
This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The goal of the tutorial is to teach the user how to select which audio input to use. Once you have an audio input plugged into the laptop or computer, you will go into the audio input settings and choose which audio input you want to use.

773 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