PDA

View Full Version : How to create line/drawing from script


motus
07-24-2006, 04:21 PM
Hello,


I'm trying to draw a grid using a script, rather than having to type 400 lineTo, moveTo..

I know how to write that script but i have no idea how to make it so the lines are drawn inside a specific view.. I know attributes can be set using something like canvas.view.setAttribute but i can't seem to find a way to do what i want


so what's the best way to achieve what i want?


thank you

NuclearWinter
07-25-2006, 07:25 AM
I think the canvas is the only view that can contain material produced by the drawing API. As far as the grid is concerned, why not use a 'for' loop rather than copy/paste 400 lines of procedural code?

bfagan
07-25-2006, 09:32 AM
I threw together a new component for you. It is called 'linegrid'.

See the attached file. Note the comments in the component file for instructions. See the app-test.lzx for an example.

I'll fancy it up when I get a chance.

motus
07-25-2006, 11:05 AM
Thank you. I'll try it out later but from the code it seems perfect