My problem isn't the draw, because if I add the bitmap to the screen
ala this.addChild(tempUI), it works fine (aka it shows up on the
screen). It still prints blank though.....also, the
printJobOptions.printAsBitmap=true also makes anything always show up
blank. Anyone actually used this before :) The example fails if you
add this, the example in the helpfile is wrong and there's no comments
on it in the live help.

Oh that and my bitmap has a white background even though I set
translucent to true when I make the bitmapdata. (var
myBMD                   :BitmapData     = new
BitmapData(myLineChart.width,myLineChart.height,true);)

Thanks for the FinePrint though.....still stuck on this after a few
hours, so let me know if ya got any other ideas.

On 11/3/06, Ely Greenfield <[EMAIL PROTECTED]> wrote:
>
>
>
> Hmm...a couple of things...
>
> 1) try passing an identity matrix to the draw() function. I don't think
> it will make a difference...passing null should be the same thing...but
> it's worth a try.
>
> 2) I didn't realize your container was a sprite.  You can ditch the
> tempUI and just attach the bitmap to the sprite directly.  Probably
> won't help, but reducing complexity is good for reducing bugs.
>
> 3) I've had some funny behavior trying to draw() a component that's
> masked into a bitmap.  Your component might have a mask applied to it
> somewhere in its parent hierarchy, which could be causing problems.
>
> 4) rather than draw()ing the chart into the bitmap, try just filling the
> bitmap with a color and printing that.  See if that shows up. If it
> does, it's a problem with getting the bits into the bitmap. If it
> doesn't, it's a problem with printing a bitmap in general.
>
> 5) you probably already have figured out some other solution, but
> there's a software printer called FinePrint that comes in very handy
> when writing print code.  Wastes much less paper ;)
>
> Ely.
>
>
>
> -----Original Message-----
> From: Jonathan Miranda [mailto:[EMAIL PROTECTED]
> Sent: Friday, November 03, 2006 1:23 PM
> To: Ely Greenfield
> Cc: flexcoders@yahoogroups.com
> Subject: Re: FilteredLineSeries and Printing - ChartMan Ely, we need
> you!
>
> Alright, first round at printing....and after about 30 blank pages, I
> can't figure it out. Just doing an addChild to a sprite with the chart
> itself works fine. Creating the Bitmap/UI component like you said works
> fine - but printing it shows up as blank. Here's a real easy example you
> can use to see what I'm doing: if you uncomment the
> sprite.addChild(tempUI) and do addChild(myLineChart), it works fine.
>
> <?xml version="1.0" encoding="utf-8"?>
> <mx:Application layout="absolute" verticalGap="100"
>                                 creationComplete="initApp()"
>
> xmlns:mx="http://www.adobe.com/2006/mxml";
>                                 >
>
>         <mx:Script>
>                 <![CDATA[
>                         import mx.core.UIComponent;
>                         import mx.collections.ArrayCollection;
>                         import mx.charts.series.LineSeries;
>
>                         private function initApp():void {
>                                 addLineSeries();
>                         }
>
>                         private function printChart():void {
>                                 var myBMD
> :BitmapData     = new
> BitmapData(myLineChart.width,myLineChart.height,true);
>                                 myBMD.draw(myLineChart);
>                                 var image                       :Bitmap
> = new Bitmap(myBMD);
>                                 var tempUI
> :UIComponent    = new UIComponent();
>                                 tempUI.addChild(image);
>                                 tempUI.x = 0;
>                                 tempUI.y = 0;
>                                 tempUI.cacheAsBitmap = true;
>                                 var sheet1                      :Sprite
> = new Sprite();
>                                 sheet1.addChild(tempUI);
>                                 //To see it print, uncomment this and
> REMOVE PrintJobOptions
>                                 //sheet1.addChild(myLineChart);
>                                 var pj
> :PrintJob               = new PrintJob();
>                                 var pagesToPrint        :uint
> = 0;
>                                 var options:PrintJobOptions
> = new PrintJobOptions();
>                         options.printAsBitmap = true;
>                 if(pj.start()) {
>
>                         sheet1.height   = pj.pageHeight / 2;
>                         sheet1.width    = pj.pageWidth;
>                         try {
>                             pj.addPage(sheet1,null,options);
>                             pagesToPrint++;
>                         }
>                         catch(e:Error) {
>
>                         }
>
>                         if(pagesToPrint > 0) {
>                             pj.send();
>                         }
>                 }
>                 //    */
>                         }
>
>                         private function addLineSeries():void {
>                                 var mySeries:Array = new Array();
>                                 var newLineSeries:LineSeries = new
> LineSeries();
>                                 newLineSeries.filterData = true;
>                                 newLineSeries.interpolateValues = true;
>                                 newLineSeries.yField = "amount";
>                                 newLineSeries.form = "curve";
>                                 mySeries.push(newLineSeries);
>                                 myLineChart.series = mySeries;
>                         }
>
>
>                         private var __alteredData       :
> ArrayCollection = new
> ArrayCollection([{name:1,amount:"100"},
>
> {name:2,amount:"200"},
>
> {name:3,amount:"0"},
>
> {name:4,amount:"50"},
>
> {name:5,amount:"0"},
>
> {name:6,amount:"150"},
>
> {name:7,amount:"200"}]);
>
>                 ]]>
>         </mx:Script>
>                 <mx:Button x="0" y="0" label="Print"
> click="printChart()"/>
>                 <mx:LineChart x="0" y="20" id="myLineChart"
> dataProvider="{__alteredData}" width="100%" height="100%"
> showDataTips="true">
>                         <mx:horizontalAxis>
>                                 <mx:CategoryAxis
> dataProvider="{__alteredData}" categoryField="name"/>
>                         </mx:horizontalAxis>
>
>                         <mx:verticalAxis>
>                                 <mx:LinearAxis maximum="200"/>
>                         </mx:verticalAxis>
>                 </mx:LineChart>
>
> </mx:Application>
>


--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/flexcoders/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:[EMAIL PROTECTED] 
    mailto:[EMAIL PROTECTED]

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 

Reply via email to