Difference between revisions of "User talk:Jack"

From Organic Design wiki
(explain array.shift())
(Note on key.id and why its needed)
Line 14: Line 14:
 
*The ''path'' parameter is an array of node-refs to be treated as relative path from ''this''
 
*The ''path'' parameter is an array of node-refs to be treated as relative path from ''this''
 
*The ''shift'' method applied to it in the loop means to pull the first item out of the array reducing its length by one.
 
*The ''shift'' method applied to it in the loop means to pull the first item out of the array reducing its length by one.
 +
*We need to introduce internal id's for nodes and use ''key.id'' rather than just ''key'' because ''key'' is a node-ref and isn't allowed as an associative-array-key (ie. ECMA fails the key-as-ref'' test).
 
*The difficult looking line is using the ?: operator
 
*The difficult looking line is using the ?: operator
 
::'''A = cond ? B : C''' is equiv to '''if (cond) A = B else A = C'''
 
::'''A = cond ? B : C''' is equiv to '''if (cond) A = B else A = C'''
 
*In ECMA, the ''prototype'' property of a constructor defines all the methods and properties that will be available to instances (in this case instances of ''node'')
 
*In ECMA, the ''prototype'' property of a constructor defines all the methods and properties that will be available to instances (in this case instances of ''node'')

Revision as of 21:53, 6 April 2006

Thanks for pointing that out - there was a strange glitch in the dynamic-dns service where it suddenly switched back to an ip from 9 days ago?! so I just changed them to 0.0.0.0 and back again which always seems to fix these dynamic-dns issues. --Nad 16:59, 30 Mar 2006 (NZST)


Gooday - you might want to set hide-minor-edits by default in your prefs page, so that huge lists of minor corrections don't show up :-) Nad 16:43, 15 Mar 2006 (NZDT)

http://www.jack.co.nz/calc.jpg


Okidoki, there you go, I've made an Actionscript sandbox for you with the bouncing ball in it that you can modify etc. There's three articles involved:


Here's a nodal function called resolve which is used by get/set to allow a path to be specified which is relative to the current this. It's taken from the currently developing peer-nodal.as. [[+node.resolve.as|]]

  • The path parameter is an array of node-refs to be treated as relative path from this
  • The shift method applied to it in the loop means to pull the first item out of the array reducing its length by one.
  • We need to introduce internal id's for nodes and use key.id rather than just key because key is a node-ref and isn't allowed as an associative-array-key (ie. ECMA fails the key-as-ref test).
  • The difficult looking line is using the ?: operator
A = cond ? B : C is equiv to if (cond) A = B else A = C
  • In ECMA, the prototype property of a constructor defines all the methods and properties that will be available to instances (in this case instances of node)