tags:

views:

75

answers:

1

I draw figure in Flsh ID with JSFL methods, for example

// draw rectangle
doc.addNewLine({x:0, y:0}, {x:2000, y:0});
doc.addNewLine({x:2000, y:0}, {x:2000, y:500});
doc.addNewLine({x:2000, y:500}, {x:0, y:500});
doc.addNewLine({x:0, y:500}, {x:0, y:0});
// how can I fill it, because this way doesn't work
doc.setFillColor('#0000ff');
+1  A: 

Try this:

var doc = fl.getDocumentDOM();
// draw rectangle
doc.addNewLine({x:0, y:0}, {x:2000, y:0});
doc.addNewLine({x:2000, y:0}, {x:2000, y:500});
doc.addNewLine({x:2000, y:500}, {x:0, y:500});
doc.addNewLine({x:0, y:500}, {x:0, y:0});
//fill
fl.getDocumentDOM().selectAll();
fl.getDocumentDOM().union();

var fillA = fl.getDocumentDOM().getCustomFill();
fillA.style = 'radialGradient';
fl.getDocumentDOM().setCustomFill(fillA);

var fillB = fl.getDocumentDOM().getCustomFill();
fillB.style = "solid";
fillB.color = 0x0000FF;
fl.getDocumentDOM().setCustomFill(fillB);

Credits actually go to Christian Guirreri, not me. Here is the full jsfl article.

George Profenza