Try copying using BitmapData, not ByteArray. Take a visual snapshot, not an object snapshot.
Ian On Fri, Oct 23, 2009 at 6:03 PM, Kevin Holleran <kdaw...@gmail.com> wrote: > On Fri, Oct 23, 2009 at 12:48 PM, Kevin Holleran <kdaw...@gmail.com> wrote: >> How can a copy the display object into another so that I can >> manipulate the coped object but not the original? I want to copy the >> object, not the reference. >> >> Thanks. >> >> Kevin >> > > Okay.... I have the following code: > > public class Coupons extends Sprite { > public var mainMovieClip:MovieClip; > public var printMovieClip:MovieClip = new MovieClip(); > var bytes:ByteArray = new ByteArray(); > > ..... > > public function printCoupons(ev:Event) { > // we set the zoom to 100% > myPDF.setDisplayMode ( Display.REAL ); > bytes.writeObject(mainMovieClip); > bytes.position = 0; > printMovieClip = bytes.readObject(); > printMovieClip.removeChild(printBtn); > printMovieClip.scaleX = .9; > printMovieClip.scaleY = .9; > // we add a page > myPDF.addPage(); > myPDF.addImage(printMovieClip); > > When I click the print button, I am receiving an error: > > TypeError: Error #1009: Cannot access a property or method of a null > object reference. > at Coupons/printCoupons() > > I don't understand what the null object is. When I remove the > attempted clone of the object, the export to PDF works great, but I > don't want the scale to effect the actual canvas. > > Thanks for any help. > > Kevin > > _______________________________________________ > Flashcoders mailing list > Flashcoders@chattyfig.figleaf.com > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders > _______________________________________________ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders