2 Replies Latest reply on Oct 4, 2010 8:46 AM by Devtron

    Printing both tabs of a TabNavigator

    330cic

      I have a TabNavigator contained within a TitleWindow.  The TabNavigator contains 2 canvases.  I want to print with each one coming out on a new page (I have a "Print" button on the TitleWIndow, outside of the TabNavigator).  Seems straight forward but I am missing something.

       

      The structure:

       

      <mx:TitleWindow

            xmlns:mx="http://www.adobe.com/2006/mxml"

            showCloseButton="true"

            close="closeWindow(event)"

            title="Reports"

            creationComplete="init()"

            height="800"

            width="750"

            >

      <mx:TabNavigator id="tabNavigator" width="100%" height="80%" creationPolicy="all">

       

         <mx:Canvas id="stuff1" label="Stuff 1" width="100%" height="100%">

            ...some labels, images, etc in here ...

         </mx:Canvas>

         <mx:Canvas id="stuff2" label="Stuff 2" width="100%" height="100%">

            ...some other labels, images, etc in here ...

         </mx:Canvas>

      </mx:TabNavigator>


      <mx:Button label="Print" click="printReport()"/>

      </mx:TitleWindow>

       

       

      My code to do the printing:

       

       

       

      public function printReport():void {

         var printJob:FlexPrintJob = new FlexPrintJob();

         if (printJob.start()) {

            printJob.addObject(stuff1);

            printJob.addObject(stuff2);

            printJob.send();

         }

      }

       

       

       

      When I run, I only get stuff1.  However, if before I hit the Print button I hit the second tab (for stuff2) then it prints correctly - stuff1 on page1, stuff2 on page 2.

       

      I thought that was what "creationPolicy=all" was supposed to do???

       

      Thanks,

      SteveH