samedi 18 février 2017

Print and hide dialogue with Flex/ActionScript/Air - PrintUIOptions not found

I want to print with flex/air - the normal print dialogue works.. But when I start to use start2, I get following error:

/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);
                                        ^

And this is my class:

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);
    }
  }
}

When I look at this SO answer, it should be easily possible: How to hide print dialog box in Flex?

I cannot find anymore infos in the web, maybe someone has a hint for me?

Aucun commentaire:

Enregistrer un commentaire