Solved

Printing problems with Flash actionscript 3.0 application

Posted on 2011-10-01
2
437 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

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

While working over numerous projects I often had the requirement for doing a screen capture in AS3.0. Unfortunately I found no "ready made" solutions in google search that suited my requirements. But I did come across some great resources which help…
This article will show, step by step, how to integrate R code into a R Sweave document
The goal of the tutorial is to teach the user what frame rate is, how to control it and what effect it has on the video.
This Micro Tutorial will teach to how to utilize bit rate in Adobe Flash Media Live Encoder.

617 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