Just add your Panel and HBox to another container, and send this other
container to the print job.

Here's the pseudo code:

  var newContainer:VBox = new Vbox();
  newContainer.add( hbMainTitle );
  newContainer.add( dspChildWithFocus);
  printJob.addObject (newContainer);

Viola.

Well, you might have to experiment with this.  newContainer may have
to be added to a container...but I don't know off the top of my head.
 But you can see the solution.



--- In flexcoders@yahoogroups.com, "aceoohay" <[EMAIL PROTECTED]> wrote:
>
> I would like to create a generic "screen print" module for my 
> application. I have it working mostly. I can select print from the 
> menu bar and it will render the module with focus.
> 
> I was feeling giddy when I got that to work and I decided to add a 
> heading to the page that prints. I have an object (hbox) on my screen 
> that would look good as a heading, so I did an addObject. This of 
> course creates a new page. After searching around for a solution I 
> decided that I will ask the assembled masses, and go to bed.
> 
> How can I merge multiple items onto a single page?
> 
> In this case I have a Panel and a HBox. I would like the HBox on top, 
> a small gap and then the panel.
> 
> Below is the code that doesn't work;
> 
> private function PrintPanel():void
> {
>       var dspChildWithFocus:Object = this.getChildAt
> (this.numChildren -1);
>       var strPrintObject:String = 
> dspChildWithFocus.child.strPrintObject
> 
>     // Create an instance of the FlexPrintJob class.
>     var printJob:FlexPrintJob = new FlexPrintJob();
>       printJob.printAsBitmap = true;
> 
>     // Start the print job.
>     if (printJob.start() != true) return;
> 
>     // Add the object to print. Scale to fit the width
>     printJob.addObject(hbMainTitle, 
> FlexPrintJobScaleType.MATCH_WIDTH);
>     printJob.addObject(dspChildWithFocus.child[strPrintObject], 
> FlexPrintJobScaleType.MATCH_WIDTH);
> 
>     // Send the job to the printer.
>     printJob.send();
> 
> }
> 
> Anoter related question - I haven't tried to print this on a real 
> printer yet (I am working remotely with no shared printer) only pdf. 
> Will I have problems with printing outside the printable area of the 
> printer?
> 
> Paul
>


Reply via email to