> > toSource toschmorze. > Meaning ?
> 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. > Here another one arr = [ "humm",["I",{wonder:["where","you","learned",{to:"indent",so:["badly"]}]}] ]; trace -------- Array contents: 0: humm 1: trace = [type Function] 1 = [object Object] 0 = I -------- Now let's try core2 #include "core2_v1.0.1_AS.as1" trace( arr.toSource( 0 ) ); trace -------- [ "humm", [ "I", { wonder: [ "where", "you", "learned", { to:"indent", so: [ "badly" ] } ] } ] ] -------- You could also try that for some more fun _global.walk = {the:{path:{of:{the:{object:{}}}}}}; trace( GetObjectPath( walk.the.path.of.the.object ) ); trace -------- walk.the.path.of.the.object -------- trace( "walk:" + walk.toSource( 1, "**" ) ); trace -------- walk: ****{ ****the: ******{ ******path: ********{ ********of: **********{ **********the: ************{ ************object: **************{ **************__path__:"walk.the.path.of.the.object" **************} ************} **********} ********} ******} ****} -------- trace( String.format( "{0,40:_}", GetObjectPath( walk ) ) ); trace( String.format( "{0,40:_}", GetObjectPath( walk.the ) ) ); trace( String.format( "{0,40:_}", GetObjectPath( walk.the.path ) ) ); trace( String.format( "{0,40:_}", GetObjectPath( walk.the.path.of ) ) ); trace( String.format( "{0,40:_}", GetObjectPath( walk.the.path.of.the ) ) ); trace( String.format( "{0,40:_}", GetObjectPath( walk.the.path.of.the.object ) ) ); trace -------- ____________________________________walk ________________________________walk.the ___________________________walk.the.path ________________________walk.the.path.of ____________________walk.the.path.of.the _____________walk.the.path.of.the.object -------- Do you understand *now* the difference between a library and a single function ? zwetan _______________________________________________ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders