In Flex 1.5:

for( var i in product ) {
  trace( i + " - " + product[i] );
}

In Flex 2.0:

trace( "dump: " + ObjectUtils.toString( product ) );

Enjoy!

Dimitrios Gianninas
Optimal Payments Inc

-----Original Message-----
From: flexcoders@yahoogroups.com on behalf of greenfishinwater
Sent: Tue 9/19/2006 3:46 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Help on a general way to serialize a model and its 
contents
 
I have a number of models in my app and as a debugging help have an
alert fired by a button, which gives me the content of a model.

For example
<mx:Model id="product">
<product>
  <name>{fName.text}</name>
  <code>{fCode.text}</code>
  <discountGroup>{fGroup.text}</discount>
</product>
</mx:Model>

Would give a string:
name: value, code: value, discountGroup: value

I do this the long way:
 m += "name: " + product.name;
 m += ", code: " + product.code;
 m += ", discountGroup: " + discountGroup;

Is there an easier way to achieve this?

Thanks

Andrew




-- 
WARNING
-------
This electronic message and its attachments may contain confidential, 
proprietary or legally privileged information, which is solely for the use of 
the intended recipient.  No privilege or other rights are waived by any 
unintended transmission or unauthorized retransmission of this message.  If you 
are not the intended recipient of this message, or if you have received it in 
error, you should immediately stop reading this message and delete it and all 
attachments from your system.  The reading, distribution, copying or other use 
of this message or its attachments by unintended recipients is unauthorized and 
may be unlawful.  If you have received this e-mail in error, please notify the 
sender.

AVIS IMPORTANT
--------------
Ce message électronique et ses pièces jointes peuvent contenir des 
renseignements confidentiels, exclusifs ou légalement privilégiés destinés au 
seul usage du destinataire visé.  L'expéditeur original ne renonce à aucun 
privilège ou à aucun autre droit si le présent message a été transmis 
involontairement ou s'il est retransmis sans son autorisation.  Si vous n'êtes 
pas le destinataire visé du présent message ou si vous l'avez reçu par erreur, 
veuillez cesser immédiatement de le lire et le supprimer, ainsi que toutes ses 
pièces jointes, de votre système.  La lecture, la distribution, la copie ou 
tout autre usage du présent message ou de ses pièces jointes par des personnes 
autres que le destinataire visé ne sont pas autorisés et pourraient être 
illégaux.  Si vous avez reçu ce courrier électronique par erreur, veuillez en 
aviser l'expéditeur.



--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/flexcoders/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:[EMAIL PROTECTED] 
    mailto:[EMAIL PROTECTED]

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 

<<winmail.dat>>

Reply via email to