Send your object using this 

//flex

package server
{ 
    import flash.utils.ByteArray; 
     
    [RemoteClass(alias="server.Tag")] 
    public class Tag 
    { 
         
        public function Tag(){ 
            picture = new ByteArray(); 
        } 
        public var info:String; 
        public var picture:ByteArray; 
    } 
}

// Java

package server; 

public class Tag { 

    private String info; 
    private byte[] picture; 
     
    public Tag() 
    {} 

    public String getInfo() { 
        return info; 
    } 

    public void setInfo(String info) { 
        this.info = info; 
    } 

    public byte[] getPicture() { 
        return picture; 
    } 

    public void setPicture(byte[] picture) { 
        this.picture = picture; 
    } 
}  
 
Cato Paus



--- In flexcoders@yahoogroups.com, "Jim Hayes" <[EMAIL PROTECTED]> wrote:
>
> Ok, gotcha!
> You need to use Loader.loadBytes(b:byteArray)
> 
> var loader:Loader = new Loader();
> 
> loader.loadBytes(yourByteArray);
> 
> Now, the bitmap *will* be available in the loaders "content" 
property, but do not assume that just because you gave it a preloaded 
bytearray that it will be *immediately* available. Or you will be sad 
and confused, as was I :)
> 
> No, the bitmap will only be available once the 
loader.contentLoaderInfo complete event fires.
> 
> So, add an event listener for the complete event :
> 
> loader.contentLoaderInfo.addEventListener
(Event.COMPLETE,loaderCompleteHandler);
> 
> Then get the bitmap from the loader at that point in time :
> 
> private function loaderCompleteHandler(event:Event)
> 
> {
> 
> var loader:Loader = event.target as Loader;
> var bmp:Bitmap = Bitmap(loader.content);
> // do something with bmp here, such as displaying it.....
> }
> 
> I'm not sure if the image component now will take a byteArray 
directly, there was some talk of it a few months back so it may have 
got added to the flex 3 code.
> 
> 
> -----Original Message-----
> From: flexcoders@yahoogroups.com on behalf of Jon Santos
> Sent: Sat 12/04/2008 13:01
> To: flexcoders@yahoogroups.com
> Subject: Re: [flexcoders] How to download a BLOB from 
database....using Java
>  
> Hi Jim.....i know how to get the image in my POJO.....
> 
> The process i´m following: 
> 
> I get the image form database throw my servlet. In this class i get 
the ImageObject (POJO), it means the image and other data.
> In my FLEX application i have one object ImageObject (Action 
Script)....like Remote Object for the java object....then i able to 
get the image and the other data in my FLEX application....
> 
> The unique problem i´m finding : I don´t know how to display in my 
FLEX application (it means your B question).....i don´t know which 
component i must use to display my image (array of bytes).....
> 
> Thanks in advance....and i hope u already understad my problem.
> 
> ----- Original Message ----
> From: Jim Hayes <[EMAIL PROTECTED]>
> To: flexcoders@yahoogroups.com
> Sent: Friday, April 11, 2008 11:53:38 PM
> Subject: RE: [flexcoders] How to download a BLOB from 
database....using Java
> 
> 
> Is your question
> a) how to get the byteArray into flex?
> b) how to display it once it is in flex?
> c) both a and b ?
> 
> I can help you with b !
> 
> -----Original Message-----
> From: [EMAIL PROTECTED] ups.com on behalf of txakin
> Sent: Fri 11/04/2008 14:29
> To: [EMAIL PROTECTED] ups.com
> Subject: [flexcoders] How to download a BLOB from database.... 
using Java
> 
> Hi all....
> 
> I would like to know...how to download a BLOB (image, file...binary 
> data) from my Oralce database to my Flex application.
> 
> I think i already have my servlet created....the souce can be more 
> or less like the next one:
> 
> Session session = HibernateSessionFac tory.getSession( );
> 
> //Here i get my POJO (my movieImage object)
> MovieImage myMovieImage = (MovieImage) session.load( MovieImage. 
class, 
> movieId);
> 
> //I got the binary data (in this case one image), into array of 
bytes
> byte[] myCover = myMovieImage. getCover( );
> ServletOutputStream servletOutputStream = res.getOutputStream ();
> res.setContentType( "application/ image");
> res.setContentLengt h(myCover. length);
> servletOutputStream .write(myCover, 0, myCover.length) ;
> servletOutputStream .flush();
> servletOutputStream .close();
> 
> But my problem is how to show that image in my component... .
> 
> Can someone help me (with some source or with some steps or some 
> example) to get the solution?
> 
> Thansk in advance.
> 
> ____________ _________ _________ _________ _________ _________ _
> This communication is from Primal Pictures Ltd., a company 
registered in England and Wales with registration No. 02622298 and 
registered office: 4th Floor, Tennyson House, 159-165 Great Portland 
Street, London, W1W 5PA, UK. VAT registration No. 648874577.
> 
> This e-mail is confidential and may be privileged. It may be read, 
copied and used only by the intended recipient. If you have received 
it in error, please contact the sender immediately by return e-mail 
or by telephoning +44(0)20 7637 1010. Please then delete the e-mail 
and do not disclose its contents to any person.
> This email has been scanned for Primal Pictures by the MessageLabs 
Email Security System.
> ____________ _________ _________ _________ _________ _________ _
>  
> 
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around 
> http://mail.yahoo.com 
> 
> 
> 
______________________________________________________________________
> This communication is from Primal Pictures Ltd., a company 
registered in England and Wales with registration No. 02622298 and 
registered office: 4th Floor, Tennyson House, 159-165 Great Portland 
Street, London, W1W 5PA, UK. VAT registration No. 648874577.
> 
> This e-mail is confidential and may be privileged. It may be read, 
copied and used only by the intended recipient. If you have received 
it in error, please contact the sender immediately by return e-mail 
or by telephoning +44(0)20 7637 1010. Please then delete the e-mail 
and do not disclose its contents to any person.
> This email has been scanned for Primal Pictures by the MessageLabs 
Email Security System.
> 
______________________________________________________________________
>


Reply via email to