# HELP ! Print Job()

**URL:** <https://forum.kirupa.com/t/help-print-job/119284>\
**Category:** Uncategorized\
**Created:** [August 13, 2004, 5:30am UTC](https://forum.kirupa.com/t/help-print-job/119284 "2004-08-13T05:30:30Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![ashishchandras](https://avatars.discourse-cdn.com/v4/letter/a/7993a0/32.png) [@ashishchandras](https://forum.kirupa.com/u/ashishchandras)\
**Post date:** [August 13, 2004, 5:30am UTC](https://forum.kirupa.com/t/help-print-job/119284/1 "2004-08-13T05:30:30Z")

</div>

Hi

I am facing one problem with Print Job Object. When I create a Print Job Object and try to trace its value on .start() in the output window its shows undefined:

my\_pj = new Print Job()

trace(my\_pj.start()) // here …output window shows…UNDEFINED  
if(my\_pj.start()){  
…  
…  
}

Now if I copy the same script into a new movie it works fine, but in my MC where I have my print button, where i need to create this printob(). And another thing is I have not used or created Print Job() anywhere in my Movie and not used the same name (my\_pj) also.

Can anyone help me out with it…Thanx

Ashish

---

<div class="post-metadata">

**Author:** ![arcaRox](https://avatars.discourse-cdn.com/v4/letter/a/7c8e57/32.png) [@arcaRox](https://forum.kirupa.com/u/arcaRox)\
**Post date:** [August 13, 2004, 10:18am UTC](https://forum.kirupa.com/t/help-print-job/119284/2 "2004-08-13T10:18:30Z")

</div>

It looks like you are creating the PrintJob instance and calling its method on separate frames. This is a known limitation of the PrintJob class. Here’s a technote that will explain further.

[http://www.macromedia.com/support/flash/ts/documents/printjob.htm](http://www.macromedia.com/support/flash/ts/documents/printjob.htm)

---

<div class="post-metadata">

**Author:** ![ashishchandras](https://avatars.discourse-cdn.com/v4/letter/a/7993a0/32.png) [@ashishchandras](https://forum.kirupa.com/u/ashishchandras)\
**Post date:** [August 13, 2004, 3:15pm UTC](https://forum.kirupa.com/t/help-print-job/119284/3 "2004-08-13T15:15:31Z")

</div>

> [@arcaRox](#):
>
> It looks like you are creating the PrintJob instance and calling its method on separate frames. This is a known limitation of the PrintJob class. Here’s a technote that will explain further.
> 
> [http://www.macromedia.com/support/flash/ts/documents/printjob.htm](http://www.macromedia.com/support/flash/ts/documents/printjob.htm)

Hey Thanx for your reply first.

I did checked the Link attached, but this is not the case, anyways.  
Could u just clear me out few things i will be greatful to u…

I have a MC in which i am loading data from XML and there around 10-50 dynamic textfields gets created per page. There is pagination also in the Movie which displays next set of records

Now i want to get them all printed at one command with the help of Print Job(). What i am trying right now is creating MCs at run time and attaching them to an EmptyMC and finally printing EmptyMC. But i am getting the same set of record printed again and again. Any suggession on this…while tracing the output i can see my pointer moving correcly from one set to another…

Thanx 1s again  
Ash

---

<div class="post-metadata">

**Author:** ![arcaRox](https://avatars.discourse-cdn.com/v4/letter/a/7c8e57/32.png) [@arcaRox](https://forum.kirupa.com/u/arcaRox)\
**Post date:** [August 14, 2004, 3:52am UTC](https://forum.kirupa.com/t/help-print-job/119284/4 "2004-08-14T03:52:32Z")

</div>

Try seeing if the EmptyMc is getting the contents that you want to print correctly. If it offstage move it inside the visible area and test. That’s all i can suggest right now. If you post your code, it might help a bit more…

---

<div class="post-metadata">

**Author:** ![ashishchandras](https://avatars.discourse-cdn.com/v4/letter/a/7993a0/32.png) [@ashishchandras](https://forum.kirupa.com/u/ashishchandras)\
**Post date:** [August 14, 2004, 10:20am UTC](https://forum.kirupa.com/t/help-print-job/119284/5 "2004-08-14T10:20:57Z")

</div>

Hi

Here is the code what i am using for getting Muliple Print to work but it doesnt :sigh:

I have two buttons in one button i am calling duplicatePages() function and on another i am calling printingPages(). In the following example i have 26 records which i can show 13 per page. So i should create 2 MCs dynamically each with 13 records ( 0 - 12 and 13-26). I have 4 columns in one row.  
say (name, address, age, sex);  
I have kept those 2 buttons inside the Main MC along with these funnctions

function duplicatePages(){  
st=0 ;  
ed= 13  
z=13;  
for(i=0; i\<2; i++){ //to create 2 MCs  
m=0;  
// att1 is the identifier to the MC in Library where i am loading the XML  
// This MC is attached on the the stage (script for this is their on the stage)

```
	_root.EmptyMC.attachMovie("att1", "prints"+i, i+5555);
	myPage = eval("_root.EmptyMC.prints"+i);
	trace("

```

myPage : " + myPage);  
myPage.\_x = 5;  
myPage.\_y = 5;

```
                      for(j=st; j&lt;ed; j++){
		for(k=0; k&lt;4; k++){

myPage.myText = eval("data"+m) 

```

// here data is the name given to the (13x4)dynamic textfields created  
// inside the main MC which is in Library  
myPage.myText.html = true;   
myPage.myText.htmlText = pName[j][k]; //array obj with all data  
trace("  
myPage.myText  
" + myPage.myText.htmlText)

```
m++;
     }
  }
st+=z;
        ed+=z;
 }

```

}

// Printing Function

function printPages(){  
trace("  
\_\_\_\_\_\_\_\_\_\_ PRINTING \_\_\_\_\_\_\_\_  
“)  
my\_pj = new PrintJob();  
if(my\_pj.start()){  
for(i=0; i\<2; i++){  
myPrintPage = eval(”\_root.EmptyMC.prints"+i);  
myPrintPage.\_x=5;  
myPrintPage.\_y=5;  
my\_pj.addPage(myPrintPage);  
trace("  
myPrintPage "+myPrintPage)  
}  
}  
my\_pj.send();  
delete my\_pj();  
}

2 pages are getting printed but they are BLANK. And in Output window i can see the things properly executed. Any doubts pls let me know…

Thanx for ur concern…

Ashish

---

<div class="post-metadata">

**Author:** ![arcaRox](https://avatars.discourse-cdn.com/v4/letter/a/7c8e57/32.png) [@arcaRox](https://forum.kirupa.com/u/arcaRox)\
**Post date:** [August 15, 2004, 7:22am UTC](https://forum.kirupa.com/t/help-print-job/119284/6 "2004-08-15T07:22:19Z")

</div>

The code looks correct to me. You can try making my\_pj a local var of the printPages function. Also, The print object in flash is synchronous so unless you have a special need to know if the user clicked the selected print or not, i would avoid the start method. Once the printing is done the next action gets control anyway.

---

<div class="post-metadata">

**Author:** ![ashishchandras](https://avatars.discourse-cdn.com/v4/letter/a/7993a0/32.png) [@ashishchandras](https://forum.kirupa.com/u/ashishchandras)\
**Post date:** [August 16, 2004, 5:15am UTC](https://forum.kirupa.com/t/help-print-job/119284/7 "2004-08-16T05:15:23Z")

</div>

> [@arcaRox](#):
>
> The code looks correct to me. You can try making my\_pj a local var of the printPages function. Also, The print object in flash is synchronous so unless you have a special need to know if the user clicked the selected print or not, i would avoid the start method. Once the printing is done the next action gets control anyway.

Hi friend,

I didnt get u 100%. If I do not use start method then what else option I have left with, I have also tried printing ,…this way

print(\_root.EmptyMC, “bframe”)

But this is printing only one page ie the first set. Could you to be littile brief on what you want to say.

Thanx again for ur concern.

Ashish Chandras

---

<div class="post-metadata">

**Author:** ![arcaRox](https://avatars.discourse-cdn.com/v4/letter/a/7c8e57/32.png) [@arcaRox](https://forum.kirupa.com/u/arcaRox)\
**Post date:** [August 16, 2004, 5:34am UTC](https://forum.kirupa.com/t/help-print-job/119284/8 "2004-08-16T05:34:19Z")

</div>

> [@ashishchandras](#):
>
> Hi friend,
> 
> I didnt get u 100%. If I do not use start method then what else option I have left with, I have also tried printing ,…this way
> 
> print(\_root.EmptyMC, “bframe”)
> 
> But this is printing only one page ie the first set. Could you to be littile brief on what you want to say.
> 
> Thanx again for ur concern.
> 
> Ashish Chandras

I wasn’t suggesting to not use the start method. Rather that the conditional might be the problem since you said the start method is returning undefined instead of true/false for you. Other than your code looks fine to me.

---

<div class="post-metadata">

**Author:** ![ashishchandras](https://avatars.discourse-cdn.com/v4/letter/a/7993a0/32.png) [@ashishchandras](https://forum.kirupa.com/u/ashishchandras)\
**Post date:** [August 16, 2004, 7:43am UTC](https://forum.kirupa.com/t/help-print-job/119284/9 "2004-08-16T07:43:12Z")

</div>

> [@arcaRox](#):
>
> I wasn’t suggesting to not use the start method. Rather that the conditional might be the problem since you said the start method is returning undefined instead of true/false for you. Other than your code looks fine to me.

Ok Fine,

But I am getting true returned (on trace) for start method. That is its working fine. Anyways…thanx for your help…I am really exhausted now.  
One question again. See… I have few frames in my Main MC in whcih i am loading XML File.

1st - Loading XML File;  
2nd - Play (if takes time to load.just looping it)  
3rd - Parsing XML File and calling a my main function where i am getting all the data stored in diff array objects  
4th - Displating records …here creating textfields and just filling it up with data  
5th - Incemening variblaes clicking on Next Button, whcih refreshes the data with new set of records  
6th- Decementing varbilaes…on Back Button.

Thats…it…now what is my question when i create Multiple (MCs) of this Main MC in Library…would that XML file go loaded each time.  
Practically…I am not bothered about XML getting loaded or not…since in the output window i can see data is getting displayed properly…in diff MC…

Still thax…again…if u get rid of this or get any hint on this problem …pls let me know …

Thanx…dude…  
Ashish
