Re: [flexcoders] Re: Flex 2.0.1: itemRenderer won't get printed using PrintDataGrid
Here's one way of doing it: ?xml version=1.0 encoding=utf-8? mx:Application xmlns:mx=http://www.adobe.com/2006/mxml; layout=absolute creationComplete=appInit(); mx:Script ![CDATA[ import mx.events.FlexEvent; import mx.controls.SWFLoader; private var swfContent:MovieClip; private function appInit():void { trace(Application ::: appInit); var swfReq:URLRequest = new URLRequest(_assets/test.swf); var loader:Loader = new Loader(); loader.contentLoaderInfo.addEventListener(Event.COMPLETE, swfCompleteHandler); loader.load(swfReq); } private function swfCompleteHandler(evt:Event):void { trace(Application ::: swfCompleteHandler); var t:LoaderInfo = evt.currentTarget as LoaderInfo; this.swfContent = t.content as MovieClip; trace(- target: +t) trace(- content: +t.content); var swf:SWFLoader = new SWFLoader(); swf.addEventListener(FlexEvent.UPDATE_COMPLETE, swfUpdateCompleteHandler); swf.source = this.swfContent; addChild(swf); } private function swfUpdateCompleteHandler(evt:Event):void { trace(Application ::: swfUpdateCompleteHandler); } ]] /mx:Script /mx:Application Note that the loaded swf is not duplicated, but the loader content (which is a MovieClip) is assigned to the source property of an SWFLoader instance. Another way would be to load the swf as Binary data using URLLoader, then use Loader.loadBytes() and display the Loader content in an Image or SWFLoader instance. ?xml version=1.0 encoding=utf-8? mx:Application xmlns:mx=http://www.adobe.com/2006/mxml; layout=absolute creationComplete=appInit(); mx:Script ![CDATA[ import mx.core.UIComponent; import mx.events.FlexEvent; import mx.controls.SWFLoader; private var swfContent:MovieClip; private function appInit():void { trace(Application ::: appInit); var swfReq:URLRequest = new URLRequest(_assets/test.swf); var loader:URLLoader = new URLLoader(); loader.dataFormat = URLLoaderDataFormat.BINARY; loader.addEventListener(Event.COMPLETE, loaderCompleteHandler); loader.load(swfReq); } private function loaderCompleteHandler(evt:Event):void { trace(Application ::: loaderCompleteHandler); var t:URLLoader = evt.currentTarget as URLLoader; var ba:ByteArray = t.data as ByteArray; trace(- target: +t) trace(- data length: +ba.length); var loader:Loader = new Loader(); loader.contentLoaderInfo.addEventListener(Event.COMPLETE, bytesLoaderCompleteHandler); loader.loadBytes(ba); } private function bytesLoaderCompleteHandler(evt:Event):void { trace(Application ::: bytesLoaderCompleteHandler); copyImg.source = evt.currentTarget.content; } ]] /mx:Script mx:Image id=copyImg / /mx:Application regards, Muzak - Original Message - From: Phil Heinz [EMAIL PROTECTED] To: flexcoders@yahoogroups.com Sent: Thursday, November 08, 2007 5:41 AM Subject: [flexcoders] Re: Flex 2.0.1: itemRenderer won't get printed using PrintDataGrid Hi Muzak, Do you know of any way to apply the same logic, but as a MovieClip instead of a Bitmap? I have a swf that loads in a SWFLoader and I want to take the content of that loader (as a MovieClip) and duplicate it so I can put it in the display list in other areas of my application at the same time. The content of the SWFLoader needs to remain vector so it can be zoomed effectively. duplicateMovieClip doesn't exist any more and any attempt to assign the completed content of one SWFLoader to another's source (so it doesn't have to load it via http) removes that content from the first component before moving it to the other. Thanks for any insight you might have! Phil -- 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/
Re: [flexcoders] Re: Flex 2.0.1: itemRenderer won't get printed using PrintDataGrid
With the MovieClip route you can duplicate the MovieClip manually: http://www.senocular.com/flash/actionscript.php?file=ActionScript_3.0/com/senocular/display/duplicateDisplayObject.as There's an optimized version in the LiveDocs comments, that duplicates child MovieClips recursively: http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/display/Loader.html regards, Muzak - Original Message - From: Phil Heinz [EMAIL PROTECTED] To: flexcoders@yahoogroups.com Sent: Thursday, November 08, 2007 10:27 PM Subject: [flexcoders] Re: Flex 2.0.1: itemRenderer won't get printed using PrintDataGrid Muzak, Thanks so much for your examples. I have it working using the ByteArray method. I couldn't use the MovieClip example because it still is moving a single copy from Loader to Loader, but with the ByteArray, I can make multiple Loaders load the same ByteArray, and they are separate unique instances. Thanks again! Phil -- 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/
Re: [flexcoders] Re: Flex 2.0.1: itemRenderer won't get printed using PrintDataGrid
Alex, It might worth another mentioning to the player team that print job should survive asynchronous rendering from the print template. In most environments you can do setTimeout to validate that all items are loaded/rendered. Current print job automatically closes upon the script completion. Without printJob being able to run in multiple cycles you are guaranteed to have problem with all asynchronous Loaders, any UIComponent that exibits asynchronous creation/rendering, effects/transitions or large documents (AKA long running scripts). With the current implementation and complex documents we had to build PDF bridge as device printing in player is not robust enough for business apps. Other thing to consider - for AIR to support mashups - something like old print template with unified device will be needed. It might make sense to create some trusted extensions a la www.htmlprinting.com to the player's printer. Sincerely, Anatole On 11/7/07, handitan [EMAIL PROTECTED] wrote: Hi Muzak, Thank you for the suggestion. Hmmm..how do you transform it to a BitmapData? So far I haven't gotten any success out of it. --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.com, Muzak [EMAIL PROTECTED] wrote: Display the images as bitmapdata in the itemrenderer. So rather than passing the image url to the itemrenderer, load the image upfront, transform into bitmapdata and pass that on to the itemrenderer. Haven't tried it, but think it should work. regards, Muzak - Original Message - From: handitan [EMAIL PROTECTED] To: flexcoders@yahoogroups.com flexcoders%40yahoogroups.com Sent: Monday, November 05, 2007 12:16 AM Subject: [flexcoders] Re: Flex 2.0.1: itemRenderer won't get printed using PrintDataGrid I try to use SuperImage but I couldn't get it to work as an itemRenderer. If there's any other way besides using SuperImage, I am all ears.
Re: [flexcoders] Re: Flex 2.0.1: itemRenderer won't get printed using PrintDataGrid
?xml version=1.0 encoding=utf-8? mx:Application xmlns:mx=http://www.adobe.com/2006/mxml; layout=absolute creationComplete=appInit(); mx:Script ![CDATA[ private function appInit():void { trace(Application ::: appInit) var imgReq:URLRequest = new URLRequest(images/risotto010.jpg); var imgLoader:Loader = new Loader(); imgLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, imgCompleteHandler); imgLoader.load(imgReq); } private function imgCompleteHandler(evt:Event):void { trace(Application ::: imgCompleteHandler) var loader:LoaderInfo = evt.currentTarget as LoaderInfo; // grab image var bmp:Bitmap = loader.content as Bitmap; // grab image bitmapdata var bmd:BitmapData = bmp.bitmapData; // create new Bitma with bitmapdata and use as source for Image component bitmapImg.source = new Bitmap(bmd); } ]] /mx:Script mx:Image id=bitmapImg / /mx:Application regards, Muzak On 11/7/07, handitan [EMAIL PROTECTED] wrote: Hi Muzak, Thank you for the suggestion. Hmmm..how do you transform it to a BitmapData? So far I haven't gotten any success out of it. --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.com, Muzak [EMAIL PROTECTED] wrote: Display the images as bitmapdata in the itemrenderer. So rather than passing the image url to the itemrenderer, load the image upfront, transform into bitmapdata and pass that on to the itemrenderer. Haven't tried it, but think it should work. regards, Muzak - Original Message - From: handitan [EMAIL PROTECTED] To: flexcoders@yahoogroups.com flexcoders%40yahoogroups.com Sent: Monday, November 05, 2007 12:16 AM Subject: [flexcoders] Re: Flex 2.0.1: itemRenderer won't get printed using PrintDataGrid I try to use SuperImage but I couldn't get it to work as an itemRenderer. If there's any other way besides using SuperImage, I am all ears. -- 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/
Re: [flexcoders] Re: Flex 2.0.1: itemRenderer won't get printed using PrintDataGrid
Display the images as bitmapdata in the itemrenderer. So rather than passing the image url to the itemrenderer, load the image upfront, transform into bitmapdata and pass that on to the itemrenderer. Haven't tried it, but think it should work. regards, Muzak - Original Message - From: handitan [EMAIL PROTECTED] To: flexcoders@yahoogroups.com Sent: Monday, November 05, 2007 12:16 AM Subject: [flexcoders] Re: Flex 2.0.1: itemRenderer won't get printed using PrintDataGrid I try to use SuperImage but I couldn't get it to work as an itemRenderer. If there's any other way besides using SuperImage, I am all ears. -- 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/