How to extend Message element in Message.as

I want to be able to extend the functionality of the Message object so that I can send data relating to the particular chat message in addition to the message. To do this, I have created another variable in the Message construtor called “data”. The data type for this variable is of a new type I created called “MessageData”. Doing this I thought would allow me to pass a lot of info instead of just a single string of data. My question is how do I convert this MessageData type object into the message? I assume I need to create a data function/get/set/property?

Here is my code (my question is below):

public function set data( msgDataText:MessageData ):void
{
myMsgDataNode = replaceTextNode(getNode(), myMsgDataNode, “data”, msgDataText);
}

  1. The MessageData object has 2 array members called “paramNames” and “paramValues”.

OR…

  1. I could also change the MessageData object so it has only one member called “params” that would be an associative array of names and values. In this case I’d then like to make this data property/function generic enough so that I can use different values for paramNames and ParamValues.

Make sense?

Hey Will,

I wrote an article a little bit ago about how to send custom data over XMPP using extensions. The article translates well for Message.

http://yourpalmark.com/2009/07/30/writing-xiff-extensions-to-pass-custom-data-ov er-xmpp/

Hopefully that will help you get started.

  • Mark

this is great! Thanks!

On Sat, Nov 21, 2009 at 10:20 PM, driverjase