Показать сообщение отдельно
Старый 26.05.2008, 11:24
Curizor вне форума Посмотреть профиль Отправить личное сообщение для Curizor Найти все сообщения от Curizor
  № 3  
Ответить с цитированием
Curizor

Регистрация: May 2008
Сообщений: 5
Вот код:
Код:
var isPlay = true;
var clipList:Array = new Array();
if (_root['href'] == undefined) _root['href'] = "sample.xml";

function initSity(caption, href, index) {

	var resultMC = this.cityProto.duplicateMovieClip("city_" + index, this.getNextHighestDepth());	

	resultMC._y = 0;
	resultMC._x = index * resultMC._width;	
	resultMC.__proto__ = new CSity();
	resultMC.init(caption, href, this);
	return resultMC;
}

function init(configFileName) {
	
	_root.config = new XML();
	_root.config.ignoreWhite = true;
	_root.config['owner'] = this;
	_root.config.onLoad = function(success:Boolean)  {			
		if (success) {
			this['owner'].configure(this);
		}
	}
	_root.config.load(configFileName);
}

function configure(xml:XML) {

	var cities = xml.firstChild.childNodes;
    var len = cities.length

	for(var i = 0; i < len; i++) { 
		if (cities[i].nodeName == 'city') {
			var city = cities[i].childNodes;			
			var name = city[0].firstChild.nodeValue;
			var href = city[1].firstChild.nodeValue;
			clipList.push(initSity(name, href, i));
		}
	}
}

init(_root['href']);

function onEnterFrame() {
	// move captions
	if (isPlay) {
		for (var i = 0; i < clipList.length; i++) {
			clipList[i]._x -= 0.3;
			if (clipList[i]._x < -clipList[i]._width) {
				clipList[i]._x = (clipList.length - 1) * clipList[i]._width;
			}
		}
	}
}
Исходник нужен?


Последний раз редактировалось Curizor; 26.05.2008 в 15:40.