Path: csiph.com!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Ben Bacarisse Newsgroups: comp.lang.javascript Subject: Re: Javascripts and highlevel computer language programming of graphics Date: Mon, 24 Apr 2017 21:24:48 +0100 Organization: A noiseless patient Spider Lines: 60 Message-ID: <87k269zh7z.fsf@bsb.me.uk> References: <9fcf7c9e-a38d-4b45-bcfb-347c5d15d930@googlegroups.com> <03b9843f-a669-4e7b-b18d-bd2bd7240e16@googlegroups.com> <013aedad-faa3-4207-92bf-6c18ef764969@googlegroups.com> <3191717e-3652-45ad-a526-86f07b74f6d5@googlegroups.com> <9depfctc9stkatqhtk8b5g6v8g754bda0u@4ax.com> <48cfe37e-e2b5-4d29-b5a7-0bc6c0f5a34c@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: mx02.eternal-september.org; posting-host="4b5926b31dc2befa16801b828efa46f5"; logging-data="19503"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19wJEhuk7Hgl/C9llItj0deLvf/iuCBlRA=" Cancel-Lock: sha1:tB5bEJmweP8cPuZIWpdy6p+ZOY8= sha1:Mh+TNVJcexsJQgfxBF0zR+NmvNM= X-BSB-Auth: 1.ccf44397452b708b2b0e.20170424212448BST.87k269zh7z.fsf@bsb.me.uk Xref: csiph.com comp.lang.javascript:33109 jonas.thornvall@gmail.com writes: > I have tried your approach i get a type error > > TypeError: callfunctions[m] is not a function > at redraw (6PAINTCANVAS.4 > > // Paint logic *here i call redraw > function redraw() { > // Redraw graph every x-th millisec > for (var m=0;m } > > //This is in init *global* > callfunctions = new Array(); > > //HERE I BUILD UP CANVAS *HARDCODED* probably should use push... > function build_canvas(arr) { > callfunctions[0]=back_ground; > > if (grid==true) { callfunctions[1]=graphBackground; } but if grid is false, callfunctions[1] will not be a function. > if (markarea == true) { > callfunctions[2]=markDraw; > } else if (moveit == true) { > callfunctions[2]=moveDraw; > } else if (reshape == true) { > callfunctions[2]=boundariesDraw; > } else if (doreshape == true) { > callfunctions[2]=reshapeDraw; > } else if (holdbezier1==true){ > callfunctions[2]=moveBezierDraw1; > } else if (holdbezier2==true){ > callfunctions[2]=moveBezierDraw2; > } The same could also happen with callfunctions[2] depending on the outcome of all these tests. > callfunctions[3]=graphDraw; > > if (handles==true){ > callfunctions[4]=nodeDraw; > } > > callfunctions[4]=paint_message; This is odd. There's no point in setting callfunctions[4]=nodeDraw of you are going to assign a different value immediately afterwards. > } -- Ben.