HELP ! Print Job()

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

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

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

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…

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

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

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