topical media & game development

talk show tell print

professional-flex-code-08-SimplePrintJob.mx

professional-flex-code-08-SimplePrintJob.mx [swf] flex


  <?xml version="1.0" encoding="utf-8"?>
  <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
    <mx:Script>
    <![CDATA[
    import mx.printing.FlexPrintJob;    
    private function print():void {
      // create print job
      var printJob:FlexPrintJob = new FlexPrintJob();
      if(printJob.start()){
        // add page
        printJob.addObject(myLabel,"none");
        // send to printer
        printJob.send();
      }
    }
    ]]>
    </mx:Script>
    <mx:Label id="myLabel" text="Hello World" />
    <mx:Button click="print()" label="Print" />
  </mx:Application>
  


(C) Æliens 04/09/2009

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.