На очереди следующий участок - блок if (hasStroke).
Поступаем аналогично предыдущему случаю и получаем такой метод:
Код AS3:
private function getStroke(node:XMLNode) : Stroke {
// parse for stroke color specification
var startColor:Number = getAttribute(node, "stroke").indexOf("#") + 1;
if (startColor == 0) {
// name specified instead of color number
var thisColor:Number = colors[getAttribute(node, "stroke")];
// if (thisColor == undefined) {
if (isNaN(thisColor)) {
return new Stroke(0, 0, 0);
}
return new Stroke(colors[getAttribute(node, "stroke")], 0, 100);
}
return new Stroke(parseInt(getAttribute(node, "stroke").substr(startColor, 6), 16), 0, 100);
}
и вот такой вызов:
Код AS3:
// stroke: color, width, alpha
if (hasStroke) {
stroke = getStroke(node);
} else { // if stroke is undefined, use invisible stroke
stroke = new Stroke(0, 0, 0);
}