Hello,

Thanks for your replies and suggestions !

I have it now working with a URLLoader as suggested, but I don't like
the different approaches I have to deal with. I have HTTPService
requests, file upload's through FileReference and now URLLoader calls
which all have their specificities in terms of how to deal with the
results and errors/faults.

An overall service invocation class/component that deals with all thes
e things in a unified flow would be nice.

But again, many thanks indeed for taking the time to put me on the
right track and making clear that I was wasting my time trying to get
it going with HTTPService,

Peter



--- In [email protected], "dario.drome" <[EMAIL PROTECTED]>
wrote:
>
> Yes... in that case, he will pay for it in terms of performance and 
> size
> 
> --- In [email protected], "Alex Harui" <aharui@> 
> wrote:
> >
> > Couldn't he get a base64 encoded image or HTTP?
> > 
> >  
> > 
> > ________________________________
> > 
> > From: [email protected]
> > [mailto:[EMAIL PROTECTED] On Behalf Of dario.drome
> > Sent: Friday, July 06, 2007 12:21 AM
> > To: [email protected]
> > Subject: [flexcomponents] Re: How to create Bitmap/Image from
> > HTTPService output
> > 
> >  
> > 
> > Hi Peter,
> > First, you can not use HTTPService component to retrive binary data 
> > because HTTPService only understand text, object, e4x... but not 
> raw 
> > binary data. Use URLLoader or URLStream to retrieve your raw images.
> > 
> > Second, loader.load() method, as stated in docs, is only able to 
> > interpret JPG, GIF, PNG and SWF. In that way, if your raw image 
> data 
> > has any of these formats, you will succeed, if not (if your data is 
> > in another format or even if it is a secuence of pixels' color 
> > values) you will have to compose the bitmapdata at your own 
> (probably 
> > using the setPixels method found in BitmapData)
> > 
> > After having a good bitmap you can display it with the following 
> > piece of code:
> > 
> > image.source = new Bitmap( myBitmapData )
> > 
> > Hope this helps.
> > 
> > --- In [email protected]
> > <mailto:flexcomponents%40yahoogroups.com> , "pgp.coppens" 
> > <pc.subscriptions@> wrote:
> > >
> > > Hello,
> > > 
> > > The reason why is a bit convoluted, but I need to create a Bitmap 
> > (and
> > > Image) from the result of an HTTPService invocation.
> > > 
> > > I am able to extract the "raw" image data from the event.result
> > > property in the ResultEvent.RESULT listener, but then I am stuck.
> > > 
> > > I have two questions with respect to this.
> > > 
> > > First is what resultFormat I need to ask from the HTTPService (I 
> now
> > > use HTTPService.RESULT_FORMAT_TEXT) ?
> > > 
> > > Second is what after I get hold of the event.result
> > > 
> > > I tried a lot of things, like e.g.
> > > 
> > > 
> > > var loader:Loader=new Loader();
> > > var byteArray:ByteArray=new ByteArray();
> > > byteArray.writeUTFBytes(result.event as String);
> > > loader.loadBytes(byteArray);
> > > var bitMap:Bitmap=Bitmap(loader.content);
> > > 
> > > But I typically get an error saying the data is not a valid 
> bitmap.
> > > 
> > > I guess some cast and/or property is wrong but I have not been 
> able 
> > to
> > > sort it out just yet.
> > > 
> > > Any help much appreciated
> > > 
> > > Peter
> > >
> >
>


Reply via email to