Показать сообщение отдельно
Старый 21.03.2008, 15:01
Iv вне форума Посмотреть профиль Отправить личное сообщение для Iv Посетить домашнюю страницу Iv Найти все сообщения от Iv
  № 54  
Iv
 
Аватар для Iv

Регистрация: Apr 2001
Адрес: Moscow
Сообщений: 1,475
По умолчанию hasStroke

На очереди следующий участок - блок 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);
}
__________________
http://realaxy.com


Последний раз редактировалось iNils; 20.12.2010 в 13:35.