开发者

JSFL setCustomStroke does not work with stroke.style = "noStroke"

So I was messing around with JSFL, and I wanted to set the storke to None. That should be done like this:

var stroke = fl.getDocumentDOM().getCustomStroke("toolbar");
stroke.style = "noStroke";
fl.getDocumentDOM().setCustomStroke(stroke);

But that does NOT work.

Doing the corresponding thing with fills work! (I've had NO trouble with fills at all!)

If I manually set the storke to "None" in the toolbar (using the color-picker), and then execute this:

var stroke = fl.getDocumentDOM().getCustomStroke("toolbar");
stroke.style = "solid";
stroke.color = "#0066ff";
fl.getDocumentDOM().setCustomStroke(stroke);

I get a solid storke with aRGB value: 00 00 00 00 (0 alpha, 0 red, 0 green, 0 blue). (Which normally is impossible using the color-toolbar)

If I execute that command once more, I get the right stroke color! (It also works if I have any normal solid color. If the str开发者_运维百科oke is a gradient or bitmap, nothing happens).

As I mentioned, there have been NO problems at all with setting things for fills. ONLY strokes.


I've also encountered this bug that doesn't allow you to set "noStroke." I have found a workaround, though. Swap the stroke and fill, then set the fill to "noFill" and swap back. Like so:

var dom = fl.getDocumentDOM();
dom.swapStrokeAndFill();
var tempFill = dom.getCustomFill("toolbar");
tempFill.style = "noFill";
dom.setCustomFill(tempFill);
dom.swapStrokeAndFill();


Actually you can set the value to "null" and it will set the color to no color.


It seems that setCustomStroke(mystroke) sets stroke to none only when mystroke.style="solid" and there are no other properties. You don't have to get mystroke using getCustomStroke. It can be generic object with only one attribute style set to solid.

var mystroke=new Object();
mystroke.style="solid";
fl.getDocumentDOM().setCustomStroke(mystroke);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜