[flexcoders] Converting TIFF to Jpg and sending as a bytestream
Hi, I am trying to convert a tiff to a jpg and send to a preview screen using a remote service and loading using Loader class. Like this. var img : ByteArray = event.result as ByteArray; var loader : Loader = new Loader(); loader.loadBytes(img); myModel.img.addChild(loader); I am having a problem with scaling and displaying using a hbox and image tag it does not fit the image into the hbox as it does not seem to recognize the size of the image and scrolling does not seem to work. Pretty new with flex, so let me know if this is a bad approach.
[flexcoders] Re: Converting TIFF to Jpg and sending as a bytestream
I add a complete event listener like so loader.loadBytes(img); loader.contentLoaderInfo.addEventListener (Event.COMPLETE,imgLoaded); then in imgLoaded I set the width and height of the image to loader.content.width(height) and addChild. I wont bother with scaling yet.. but want to have the image in a smaller hbox with scroll bars enabled but cant seem to get it to work. It will display the entire image if I do not set width/height on the HBox but I cannot set a limit to the size of the Hbox. Anything I may be missing? Thanks. --- In flexcoders@yahoogroups.com, "Alex Harui" <[EMAIL PROTECTED]> wrote: > > images are loaded asynchronously, so at the time of layout we don't know > how big it will be. > > you might try waiting until a "complete" event before changing the > scale. > > > > From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On > Behalf Of truongdav > Sent: Tuesday, April 17, 2007 9:59 AM > To: flexcoders@yahoogroups.com > Subject: [flexcoders] Converting TIFF to Jpg and sending as a bytestream > > > > Hi, > > I am trying to convert a tiff to a jpg and send to a preview screen > using a remote service and loading using Loader class. > Like this. > > var img : ByteArray = event.result as ByteArray; > var loader : Loader = new Loader(); > loader.loadBytes(img); > myModel.img.addChild(loader); > > > > verticalScrollPolicy="on" width="100%" height="100%"> > > > > I am having a problem with scaling and displaying using a hbox and > image tag it does not fit the image into the hbox as it does not seem > to recognize the size of the image and scrolling does not seem to > work. Pretty new with flex, so let me know if this is a bad approach. >
[flexcoders] Re: Converting TIFF to Jpg and sending as a bytestream
Thanks Alex. --- In flexcoders@yahoogroups.com, "Alex Harui" <[EMAIL PROTECTED]> wrote: > > set minHeight/minWidth = 0 on the HBox that you want to have scrollbars. > > > > From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On > Behalf Of truongdav > Sent: Wednesday, April 18, 2007 9:53 AM > To: flexcoders@yahoogroups.com > Subject: [flexcoders] Re: Converting TIFF to Jpg and sending as a > bytestream > > > > I add a complete event listener like so > > loader.loadBytes(img); > loader.contentLoaderInfo.addEventListener > (Event.COMPLETE,imgLoaded); > > then in imgLoaded I set the width and height of the image to > loader.content.width(height) and addChild. > > I wont bother with scaling yet.. but want to have the image in a > smaller hbox with scroll bars enabled but cant seem to get it to > work. It will display the entire image if I do not set width/height > on the HBox but I cannot set a limit to the size of the Hbox. > Anything I may be missing? > > Thanks. > > --- In flexcoders@yahoogroups.com <mailto:flexcoders% 40yahoogroups.com> > , "Alex Harui" wrote: > > > > images are loaded asynchronously, so at the time of layout we don't > know > > how big it will be. > > > > you might try waiting until a "complete" event before changing the > > scale. > > > > ____ > > > > From: flexcoders@yahoogroups.com <mailto:flexcoders% 40yahoogroups.com> > > [mailto:flexcoders@yahoogroups.com <mailto:flexcoders% 40yahoogroups.com> > ] On > > Behalf Of truongdav > > Sent: Tuesday, April 17, 2007 9:59 AM > > To: flexcoders@yahoogroups.com <mailto:flexcoders% 40yahoogroups.com> > > Subject: [flexcoders] Converting TIFF to Jpg and sending as a > bytestream > > > > > > > > Hi, > > > > I am trying to convert a tiff to a jpg and send to a preview screen > > using a remote service and loading using Loader class. > > Like this. > > > > var img : ByteArray = event.result as ByteArray; > > var loader : Loader = new Loader(); > > loader.loadBytes(img); > > myModel.img.addChild(loader); > > > > > > > > > verticalScrollPolicy="on" width="100%" height="100%"> > > > > > > > > I am having a problem with scaling and displaying using a hbox and > > image tag it does not fit the image into the hbox as it does not > seem > > to recognize the size of the image and scrolling does not seem to > > work. Pretty new with flex, so let me know if this is a bad > approach. > > >
[flexcoders] RemoteObject handling exceptions onFault
Hi, I am having problems I want to throw some exception on a remote call and then display the Exception on the client side. But this always returns an onResult instead of an onFault. Anything I am doing wrong? Thanks. --- POJO --- public void test() throws Exception { throw new exception("blah"); } --- services.mxml -- - public function execute( event : CairngormEvent ):void { var delegate : SomeDelegate = new SomeDelegate( this ); var someEvent : SomeEvent = SomeEvent( event ); delegate.test(); } public function onResult( event : * = null ) : void { Alert.show("success"); } public function onFault( event : * = null) : void { Alert.show(event.fault.message, "Error"); } public class SomeDelegate { public function SomeDelegate( responder : Responder ) { this.service = ServiceLocator.getInstance().getService ( "someServiceId" ); this.responder = responder; } public function test(): void { var call : Object = service.test(); call.resultHandler = responder.onResult; call.faultHandler = responder.onFault; } // - private var responder:Responder; private var service:Object;
[flexcoders] Re: RemoteObject handling exceptions onFault
Anyone know the answer for this? --- In flexcoders@yahoogroups.com, "truongdav" <[EMAIL PROTECTED]> wrote: > > Hi, > > I am having problems I want to throw some exception on a remote call > and then display the Exception on the client side. But this always > returns an onResult instead of an onFault. Anything I am doing wrong? > > Thanks. > > > --- POJO --- > public void test() throws Exception > { > throw new exception("blah"); > } > > --- services.mxml -- > > destination="someService" >showBusyCursor="true" >result="event.token.resultHandler( event )" >fault="event.token.faultHandler( event )"> > > > - > > public function execute( event : CairngormEvent ):void > { > var delegate : SomeDelegate = new SomeDelegate( this ); > var someEvent : SomeEvent = SomeEvent( event ); > delegate.test(); > } > > public function onResult( event : * = null ) : void > { > Alert.show("success"); > } > > public function onFault( event : * = null) : void > { > Alert.show(event.fault.message, "Error"); > } > > > public class SomeDelegate > { > public function SomeDelegate( responder : Responder ) > { > this.service = ServiceLocator.getInstance().getService > ( "someServiceId" ); > this.responder = responder; > } > > public function test(): void > { > var call : Object = service.test(); > > call.resultHandler = responder.onResult; > call.faultHandler = responder.onFault; > } > > // > - > > private var responder:Responder; > private var service:Object; >
[flexcoders] Re: RemoteObject handling exceptions onFault
I think i found my stupid mistake just need to wrap in a MessageException. --- In flexcoders@yahoogroups.com, "truongdav" <[EMAIL PROTECTED]> wrote: > > Anyone know the answer for this? > > > --- In flexcoders@yahoogroups.com, "truongdav" wrote: > > > > Hi, > > > > I am having problems I want to throw some exception on a remote > call > > and then display the Exception on the client side. But this always > > returns an onResult instead of an onFault. Anything I am doing > wrong? > > > > Thanks. > > > > > > --- POJO --- > > public void test() throws Exception > > { > > throw new exception("blah"); > > } > > > > --- services.mxml -- > > > > > destination="someService" > > showBusyCursor="true" > > result="event.token.resultHandler( event )" > > fault="event.token.faultHandler( event )"> > > > > > > - > > > > public function execute( event : CairngormEvent ):void > > { > > var delegate : SomeDelegate = new SomeDelegate( this ); > > var someEvent : SomeEvent = SomeEvent( event ); > > delegate.test(); > > } > > > > public function onResult( event : * = null ) : void > > { > > Alert.show("success"); > > } > > > > public function onFault( event : * = null) : void > > { > > Alert.show(event.fault.message, "Error"); > > } > > > > > > public class SomeDelegate > > { > > public function SomeDelegate( responder : Responder ) > > { > > this.service = ServiceLocator.getInstance().getService > > ( "someServiceId" ); > > this.responder = responder; > > } > > > > public function test(): void > > { > > var call : Object = service.test(); > > > > call.resultHandler = responder.onResult; > > call.faultHandler = responder.onFault; > > } > > > > // > > - > > > > private var responder:Responder; > > private var service:Object; > > >