我想用flex / air打印 - 正常的打印对话工作..但是当我开始使用start2时,我得到以下错误:
$ grep '^[^[\s]*#]' infile
abc#] does not start with blank or [ and has #]
abc#]] does not start with blank or [ and has #]]
abc#]] starts with blank and has #]]
这是我的班级:
/Users/myuser/Test2.as:9
Warning: Definition flash.printing.PrintUIOptions could not be found.
import flash.printing.PrintUIOptions;
^
/Users/myuser/Test2.as:12
Error: Type was not found or was not a compile-time constant: PrintUIOptions.
var uiOpt:PrintUIOptions = new PrintUIOptions();
^
/Users/myuser/Test2.as:12
Error: Call to a possibly undefined method PrintUIOptions.
var uiOpt:PrintUIOptions = new PrintUIOptions();
^
/Users/myuser/Test2.as:15
Error: Call to a possibly undefined method start2 through a reference with static type PrintJob.
var accepted:Boolean = myPrintJob.start2(uiOpt);
^
当我看到这个答案时,应该很容易:How to hide print dialog box in Flex?
我在网上找不到任何信息,也许某人对我有暗示?
编辑:我正在使用命令行中的命令编译整个事情:
package {
import flash.display.Sprite;
public class Test2 extends Sprite {
public function Test2 () {
import flash.printing.PrintJob;
import flash.printing.PrintUIOptions;
var myPrintJob:PrintJob = new PrintJob();
var uiOpt:PrintUIOptions = new PrintUIOptions();
uiOpt.minPage = 1;
uiOpt.maxPage = 3;
var accepted:Boolean = myPrintJob.start2(uiOpt);
}
}
}
编译与amxmlc一起运行正常,但是当我尝试打印文档时,我会遇到奇怪的异常。