VCard

Hi, guys, How I can show avatars in my chat ?.

VCard vCard = new VCard();

vCard.load(connection);

File file = new File (“image_path.jpeg”);

retbytes = new byte[(int)file.length ()];

FileInputStream fis = new FileInputStream (file);

fis.read (retbytes);

vCard.setAvatar(retbytes);

vcard.save(connection);

I hope this will fix your problem.

Hey Leo,

I think Nikhil is actually providing a Smack implementation in Java, not a XIFF implementation in AS3.

To show an avatar, wait for the roster to load then grab a user out of the roster and do something like:

var vCard:VCard = VCard.getVCard( connection, user ); vCard.addEventListener( VCardEvent.AVATAR_LOADED, onAvatarLoaded );

private function ``onAvatarLoaded``( event:VCardEvent ):void { trace( event.vcard.avatar ); }