{"id":55,"date":"2009-02-20T17:22:22","date_gmt":"2009-02-21T01:22:22","guid":{"rendered":"http:\/\/sambaker.net\/neattools\/?p=55"},"modified":"2009-02-20T17:22:53","modified_gmt":"2009-02-21T01:22:53","slug":"victory-is-mine-sort-of","status":"publish","type":"post","link":"https:\/\/sambaker.net\/neattools\/?p=55","title":{"rendered":"Victory is Mine. Sort of."},"content":{"rendered":"<p>The reason I had to disable the dragging in the last one, was to get the children of a module (the ones it&#8217;s plugged into), I put a function call in the drawConnection function that collects the modules you&#8217;re passing it to connect.\u00c2\u00a0 So, for instance, when you create a connection between box1 and box2, this function says ok box1 has the child box2.\u00c2\u00a0 If you connect box1 and box3, it say ok box 3 is also a child of box1.\u00c2\u00a0 The function is a method of the Module class. The function looks like this:<\/p>\n<pre name=\"code\" class=\"AS3\">public function addKid(m:Module):void\r\n{\r\n\tvar max:int = kid.length;\r\n\tkid[max] = m;\r\n}<\/pre>\n<p>The problem with putting it in the draw connection method is that that method is called every frame to redraw the connection, so every frame, it re-adds the same children to the parent module, making the array.length much much longer than it should be and consequently producing some unpredictable behavior.  My solution was to create two methods one that draws the connection initially and one that redraws it. They are identical save the one line that calls the function above.  This is obviously not ideal, but it works.  Switches next&#8230;<br \/>\n<div id=\"swfed9a1\">This movie requires Flash Player 9<\/div>\n<script type=\"text\/javascript\">\n\tswfobject.embedSWF(\"source\/neattools6.swf\", \"swfed9a1\", \"400\", \"400\", \"9.0.0\", \"\", {}, {wmode: \"window\", menu: \"false\", quality: \"high\", bgcolor: \"#FFFFFF\", allowScriptAccess: \"always\"}, {});\n<\/script>\n<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The reason I had to disable the dragging in the last one, was to get the children of a module (the ones it&#8217;s plugged into), I put a function call in the drawConnection function that collects the modules you&#8217;re passing it to connect.\u00c2\u00a0 So, for instance, when you create a connection between box1 and box2, [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[3],"tags":[],"_links":{"self":[{"href":"https:\/\/sambaker.net\/neattools\/index.php?rest_route=\/wp\/v2\/posts\/55"}],"collection":[{"href":"https:\/\/sambaker.net\/neattools\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sambaker.net\/neattools\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sambaker.net\/neattools\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/sambaker.net\/neattools\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=55"}],"version-history":[{"count":2,"href":"https:\/\/sambaker.net\/neattools\/index.php?rest_route=\/wp\/v2\/posts\/55\/revisions"}],"predecessor-version":[{"id":57,"href":"https:\/\/sambaker.net\/neattools\/index.php?rest_route=\/wp\/v2\/posts\/55\/revisions\/57"}],"wp:attachment":[{"href":"https:\/\/sambaker.net\/neattools\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=55"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sambaker.net\/neattools\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=55"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sambaker.net\/neattools\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=55"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}