toSource toschmorze.
Array.prototype.trace = function() {
var retString = "Array contents:"+newline;
for (var i = 0; i<this.length; i++) {
retString+=i+": ";
if (typeof (this[i]) == "object") {
for(var prop in this[i]){
retString+=prop+" = "+this[i][prop]+newline;
}
retString+=newline;
}else{
retString+=this[i];
retString+=newline;
}
}
trace(retString);
};
//usage
arr = ["lol", {horse:"yes",donkey:"no"}];
arr.trace();
Just an example.
>zwetan wrote:
Hi,
I'm populating an array with objects.
When I trace out the array I get
==[object Object]
Whats the best way to trace out the contents of the objects once they're
in the array?
There are different ways
It could be as simple as
trace( myArray.toSource( 0 ) );
for more info see:
http://www.burrrn.com/projects/core2.html
http://www.burrrn.com/documentation/core2/files/buRRRn/core2/Array-es.html#A
rray.toSource
http://live.burrrn.com/browser/ECMA-262/core2/branches/core2_v1.0.x/src/buRR
Rn/core2/Array.es#L710
HTH
zwetan
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
--
- Andreas Rønning
---------------------------------------
Flash guy
Rayon Visual Concepts, Oslo, Norway
---------------------------------------
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders