Difference between revisions of "User talk:Jack"

From Organic Design wiki
m
m
Line 12: Line 12:
 
;Nodal code fragment example
 
;Nodal code fragment example
 
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]].
 
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|]]
+
<table class=document-code><tr><td>[[+node.resolve.as|]]</table>
 
;Notes
 
;Notes
 
*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''

Revision as of 21:55, 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:


Nodal code fragment example

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|]]
Notes
  • 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)