Error During Print
There are a three public variable
public var objPrintJob:FlexPrintJob;
public var objPrintTemplate:canvas;
Fn1:
objPrintJob = new FlexPrintJob();
if (objPrintJob.start() != true)
{
printCount--;
return;
}
Starting t开发者_如何学Che PrintJob;
Fn2:
Am adding the Object and calling send for the Print
objPrintJob.addObject(objPrintTemplate, FlexPrintJobScaleType.SHOW_ALL);
objPrintJob.send();
During Run
It Throws the Error:
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at mx.printing::FlexPrintJob/addObject()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\printing\FlexPrintJob.as:252]
at org.dckap.mafcote.views.mediators::WorkAreaMediator/parseXML()[F:\MafcoteMGP\MafcoteMGP\src\org\dckap\mafcote\views\mediators\WorkAreaMediator.as:3243]
at org.dckap.mafcote.views.mediators::WorkAreaMediator/onSaveTemplateWithCredits()[F:\MafcoteMGP\MafcoteMGP\src\org\dckap\mafcote\views\mediators\WorkAreaMediator.as:2896]
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at mx.core::UIComponent/dispatchEvent()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\core\UIComponent.as:12266]
at org.dckap.mafcote.views::CreditsShowPanel/okButtonClickHandler()[F:\MafcoteMGP\MafcoteMGP\src\org\dckap\mafcote\views\CreditsShowPanel.mxml:41]
at org.dckap.mafcote.views::CreditsShowPanel/__btnOk_click()[F:\MafcoteMGP\MafcoteMGP\src\org\dckap\mafcote\views\CreditsShowPanel.mxml:159]
Need Help For This..
}
This has to be that your objPrintTemplate object is null. The stack trace in your error shows that it's erroring in FlexPrintJob/addObject()
, which means it made it into that method but did not complete executing the method. Since the only parameters you're sending to it are your object reference and a constant value, the object must be null.
After your support I found out my solution. Thank U all.
The object does not seems to be null. I did one mistake that is i didn't added the object as a child anywhere else. so the addObject() in print requires the systemManager. which will be null if i didn't add as a child.
Thank You for your support
精彩评论