Форум Flasher.ru
Ближайшие курсы в Школе RealTime
Список интенсивных курсов: [см.]  
  
Специальные предложения: [см.]  
  
 
Блоги Правила Справка Пользователи Календарь Сообщения за день
 

Вернуться   Форум Flasher.ru > Flash > ActionScript 1.0/2.0

Версия для печати  Отправить по электронной почте    « Предыдущая тема | Следующая тема »  
Опции темы Опции просмотра
 
Создать новую тему Закрытая тема
Старый 04.06.2007, 00:08
Kaetana вне форума Посмотреть профиль Отправить личное сообщение для Kaetana Найти все сообщения от Kaetana
  № 1  
Kaetana
 
Аватар для Kaetana

Регистрация: Jun 2007
Сообщений: 7
По умолчанию баг в цикле или XML? свежим взглядом видно 100%

Уважаемые! Помогите найти баг, который как мне кажется лежит в области "пропущена скобка, запятая итд ", но от этого в моей опухшей голове более видимым не становящимся...а работу сдавать завтра!
Исходник из-за карты ОЧ. большой (больше максимцма для rar, zip)..к нему XML файлик...при запуске, по тыцу на кнопке должно вылезти сборище из мувиков и TextField-oв, описывающих объект расположенный на карте. (все сырое, потому при первом же движении мыши все рассыпается - не обращайте внимание!) главное, чтобы при определенных параметрах (задаются на экземпляре кнопки), например:
var countryFlag:String="Bulgaria";// соответсвено задаем страну в которой находится объект, к которому привязана кнопка.
var IDsite:Number =9;// номер объекта в стране (<item IDsite="..."> в XML )
срабатывал поиск по XML -ю и свойства <item > расскидывались по ячейкам item_prop[]

сам баг: при тыце на кнопку скрипт зависает...причем правильно находит, количество объектов в <country> </country> , понимает какой номер объекта ему передан из экземпляра кнопки и во сколько(каких) элементов массива item_prop[] ему надо передать данные из XML <item IDsite="...">


Последний раз редактировалось Kaetana; 04.06.2007 в 04:10.
Старый 04.06.2007, 00:12
Kaetana вне форума Посмотреть профиль Отправить личное сообщение для Kaetana Найти все сообщения от Kaetana
  № 2  
Kaetana
 
Аватар для Kaetana

Регистрация: Jun 2007
Сообщений: 7
По умолчанию вот собственно кусок кода из первого кадра

Код:
var col:Number=0;

var wh_place:XML = new XML();
wh_place.ignoreWhite = true;



function fnItemUIdraw(countryFlag, IDsite,  infoLayer){
wh_place.onLoad = function(success:Boolean){
    if (success) {

//===============блок инициализации================================							
var start_node:XMLNode=this.firstChild;
var arr:Array=this.childNodes[0].childNodes;

item_prop = new Array ();
var item_arr:Array = [] ; 
//=================================================================
           		for (var i:Number=0; i<start_node.childNodes.length; i++)
				{ 
					if (start_node.childNodes[i].attributes.label==countryFlag)
					{ 
					    for(var j:Number = 0; j<start_node.childNodes[i].childNodes.length; j++)
						{item_arr[j] = start_node.childNodes[i].childNodes[j];}
					
					}//else {trace("countryFlag UNDERFINED!");}
										
				}//from for (var i:Number=0; i<start_node.childNodes.length; i++)
				
			}else {trace("eroorrr ni figa ne success");}
//=====здесь мы уже имеем item_arr с массивом из item отобранных по стране, 
//=====далее передаем их на разбор по аттрибуту <item IDsite="...">, который в переменной IDsite
for(i=0; i<item_arr.length; i++)
 {		
		var item_nodes:XMLNode = item_arr[i];
     
	    if(item_nodes.attributes["IDsite"]==IDsite)
		{ 		
			for(i=0; i<item_nodes.childNodes.length; i++)
			{
				//trace(i);
				//trace("item_nodes.attributes[IDsite]"+item_nodes.attributes["IDsite"]);
				//trace("item_nodes.childNodes[i].nodeName"+item_nodes.childNodes[i].nodeName);
				
				
				
				switch(item_nodes.childNodes[i].nodeName)
				{
					case "NameSite": 		item_prop["namesite"]=item_nodes.childNodes[i].firstChild.nodeValue; 
									 		trace(item_prop["namesite"]);
											break;
					
					case "LocalSite": 		item_prop["localsite"]=item_nodes.childNodes[i].firstChild.nodeValue; 
									  		break;
											
					case "dateInscription": item_prop["datainscript"]=item_nodes.childNodes[i].firstChild.nodeValue; 
        									break;
					case "criteria": 		item_prop["criteria"]=item_nodes.childNodes[i].firstChild.nodeValue;
											item_prop["critype"]=item_nodes.childNodes[i].attributes["type"];
											break;
					
					case "description": 	item_prop["description"]=item_nodes.childNodes[i].firstChild.nodeValue; 
									    	break;
											
					case "link_ru": 		item_prop["linkru"]=item_nodes.childNodes[i].firstChild.nodeValue; 
											break;
											
					case "link_org": 		item_prop["linkorg"]=item_nodes.childNodes[i].firstChild.nodeValue; 
									 		break;
					default: 				trace("фигня...фигня! фигня фигня фигня");break;
				}
			}
		
		}
}//from for(i=0; i<item_arr.length; i++)

DrawItem (item_prop,  infoLayer);

}//from function OnLoad

//==============Собственно отрисовка эелементов=================
wh_place.load("info.xml");

}//from fnItemUIDraw()

function DrawItem (item_prop:Array,  infoLayer:MovieClip):Void{
//----------создаем элементы, куда будем расскидвать инфу из массива item_prop-----
this.attachMovie("GreenBottomAllText", "green_bottom", 1, {_x:_xmouse+125, _y:_ymouse+200});
this.attachMovie(infoLayer, "country_info_mc", 3, {_x:_xmouse+125,_y:_ymouse+36.5});
this.createTextField("name_obj_tf", 5, _xmouse, _ymouse+78, 250, 24);
this.createTextField("local_obj_tf", 7, _xmouse, _ymouse+102, 250, 20);
this.createTextField("data_obj_tf", 9, _xmouse+120, _ymouse+122, 130, 20);
this.createTextField("data_tf", 10, _xmouse, _ymouse+122, 120, 20);
this.createTextField("criteria_tf", 11, _xmouse, _ymouse+142, 50, 20);
this.createTextField("criteria_obj_tf", 13, _xmouse+100, _ymouse+142, 150, 20);
this.createTextField("crtype_obj_tf", 15, _xmouse+50, _ymouse+142, 50, 20);


//---------инициализация текстовых полей---------------
//-----name_obj_tf---------------
name_obj_tf.text = item_prop["namesite"];  
name_obj_tf=init_tf(name_obj_tf);  
name_obj_tf.textColor =0xffffcc;
var format_name:TextFormat = new TextFormat(name_obj_tf); 
format_name.font = "Verdana";
format_name.size=14;
format_name.align = "center"; 
format_name.bold = true;
this._highquality = 2;
name_obj_tf.setTextFormat(format_name); 
//-----local_obj_tf--------------
local_obj_tf.text = item_prop["localsite"];  
local_obj_tf=init_tf(local_obj_tf);  
var format_local:TextFormat = new TextFormat(local_obj_tf); 
format_local.font = "Verdana";
format_local.size=10;
format_local.align = "left"; 
format_local.bold = true;
this._highquality = 2;
local_obj_tf.setTextFormat(format_local); 
//-----data_obj_tf-------из массива item_prop----
data_obj_tf.text = item_prop["datainscript"];  
data_obj_tf=init_tf(data_obj_tf); 
var format_data:TextFormat = new TextFormat(data_obj_tf); 
format_data.font = "Verdana";
format_data.size=10;
format_data.align = "left"; 
format_data.bold = true;
this._highquality = 2;
data_obj_tf.setTextFormat(format_data); 
//----data_tf----------текст----
data_tf.text = "Date of Inscription:";  
data_tf=init_tf(data_tf); 
var format_dat:TextFormat = new TextFormat(data_tf); 
format_dat.font = "Verdana";
format_dat.size=10;
format_dat.align = "left"; 
format_dat.bold = true;
this._highquality = 2;
data_tf.setTextFormat(format_dat); 
//-----criteria_tf--------------
criteria_tf.text = "Criteria:";  
criteria_tf=init_tf(criteria_tf); 
var format_crit:TextFormat = new TextFormat(criteria_tf); 
format_crit.font = "Verdana";
format_crit.size=10;
format_crit.align = "left"; 
format_crit.bold = true;
this._highquality = 2;
criteria_tf.setTextFormat(format_crit); 

//-----criteria_obj_tf--------из массива item_prop---
criteria_obj_tf.text = item_prop["criteria"];  
criteria_obj_tf=init_tf(criteria_obj_tf); 
var format_criteria:TextFormat = new TextFormat(criteria_obj_tf); 
format_criteria.font = "Verdana";
format_criteria.size=10;
format_criteria.align = "left"; 
format_criteria.bold = true;
this._highquality = 2;
criteria_obj_tf.setTextFormat(format_criteria); 
//-----crtype_obj_tf--------------
crtype_obj_tf.text = item_prop["critype"];  
var format_crtype:TextFormat = new TextFormat(crtype_obj_tf); 
format_crtype.font = "Verdana";
format_crtype.size=10;
format_crtype.align = "left"; 
format_crtype.bold = true;
this._highquality = 2;
crtype_obj_tf.setTextFormat(format_crtype);
crtype_obj_tf=init_tf(crtype_obj_tf);
//----------------------------------------
//Mouse.hide();

function init_tf(init_txt_f:TextField):TextField
{
init_txt_f.textColor =0x000000;      
init_txt_f.background = true;     
init_txt_f.backgroundColor = 0x339900; 
init_txt_f.wordWrap = true;   
return 	init_txt_f;
}

var mouseListCreate:Object = new Object();
mouseListCreate.onMouseMove= function()
	{
  	  country_info_mc._x = _xmouse+125;
	  country_info_mc._y = _ymouse+36.5;
	  green_bottom._x =_xmouse+125;
	  green_bottom._y =_ymouse+200;
	  name_obj_tf._x = _xmouse;
	  name_obj_tf._y = _ymouse+78;
  	  local_obj_tf._x = _xmouse;
	  local_obj_tf._y = _ymouse+88;
	  data_obj_tf._x = _xmouse;
	  data_obj_tf._y = _ymouse+108;
  	  criteria_obj_tf._x = _xmouse;
	  criteria_obj_tf._y = _ymouse+118;
  	  crtype_obj_tf._x = _xmouse+125;
	  crtype_obj_tf._y = _ymouse+78;
   	updateAfterEvent();	
	};
Mouse.addListener(mouseListCreate);
 
var mouseListDel:Object = new Object();
mouseListDel.onMouseDown = function() 
   {
	removeMovieClip(country_info_mc);
	removeMovieClip(green_bottom);
	name_obj_tf.removeTextField();
	local_obj_tf.removeTextField();
	data_obj_tf.removeTextField();
	data_tf.removeTextField();
	criteria_obj_tf.removeTextField();
	crtype_obj_tf.removeTextField();
	criteria_tf.removeTextField();
		
	updateAfterEvent();
    Mouse.show();
   };
Mouse.addListener(mouseListDel);
 
 
}//from fn ItemDraw

Старый 04.06.2007, 00:13
Kaetana вне форума Посмотреть профиль Отправить личное сообщение для Kaetana Найти все сообщения от Kaetana
  № 3  
Kaetana
 
Аватар для Kaetana

Регистрация: Jun 2007
Сообщений: 7
По умолчанию вот код на кнопке

Код:
rus_9.onPress= function():Void {
	var countryFlag:String="Bulgaria";
	var IDsite:Number =9;
	var infoLayer:String = "infoLayerRus";
	var item_prop:Array = fnItemUIdraw(countryFlag, IDsite, infoLayer);
		
}
	
	Mouse.addListener(rus_9);

Старый 04.06.2007, 00:18
Kaetana вне форума Посмотреть профиль Отправить личное сообщение для Kaetana Найти все сообщения от Kaetana
  № 4  
Kaetana
 
Аватар для Kaetana

Регистрация: Jun 2007
Сообщений: 7
По умолчанию XML файлик со странами и объектами в них

почему-то не получается загрузить маленький архивчик (zip) 14 kb с xml файликом ....но в общем вот тестовый...
Код:
<code><?xml version="1.0" encoding="utf-8"?>

<objects_list>
<country label="Bulgaria">

	<item IDsite="1">
		
		<NameSite>Boyana Church</NameSite>
		<LocalSite>Boyana district, Sofia</LocalSite>
		<dateInscription>1979</dateInscription>
		<criteria type="Cultural">ii,iii</criteria>
		<description>Located on the outskirts of Sofia, Boyana Church consists of three buildings. The eastern  hurch was built in the 10th century, then enlarged at the beginning of the 13th century by Sebastocrator Kaloyan, who ordered a second two-storey building to be erected next to it. The frescoes in this second church, painted in 1259, make it one of the most important collections of medieval paintings. The ensemble is completed by a third church, built at the beginning of the 19th century. This site is one of the most complete and perfectly preserved monuments of east European medieval art.</description>
		<link_ru></link_ru>
     		<link_org></link_org>
	</item>

	<item IDsite="2">
		
		<NameSite>Madara Rider</NameSite>
		<LocalSite>Village of Madara, Province of Shumen</LocalSite>
		<dateInscription>1979</dateInscription>
		<criteria type="Cultural">i,iii</criteria>
		<description>The Madara Rider, representing the figure of a knight triumphing over a lion, is carved into a 100m-high cliff near the village of Madara in north-east Bulgaria. Madara was the principal sacred place of the First Bulgarian Empire before Bulgaria's conversion to Christianity in the 9th century. The inscriptions beside the sculpture tell of events that occurred between A.D. 705 and 801.</description>
		<link_ru>  </link_ru>
     		<link_org> </link_org>
	</item>

	<item IDsite="3">
		
		<NameSite>Thracian Tomb of Kazanlak</NameSite>
		<LocalSite>Kazanlak, Province of Stara Zagora</LocalSite>
		<dateInscription>1979</dateInscription>
		<criteria type="Cultural">i,iii,iv</criteria>
		<description>Discovered in 1944, this tomb dates from the Hellenistic period, around the end of the 4th century B.C. It is located near Seutopolis, the capital city of the Thracian king Seutes III, and is part of a large Thracian necropolis. The tholos has a narrow corridor and a round burial chamber, both decorated with murals representing Thracian burial rituals and culture. These paintings are Bulgaria's best-preserved artistic masterpieces from the Hellenistic period.</description>
		<link_ru></link_ru>
     		<link_org></link_org>
	</item>

	<item IDsite="4">
		
		<NameSite>Rockhewn Churches of Ivanovo</NameSite>
		<LocalSite>Village of Ivanovo, Province of Ruse</LocalSite>
		<dateInscription>1979</dateInscription>
		<criteria type="Cultural">ii,iii</criteria>
		<description>In the valley of the Roussenski Lom river, in north-east Bulgaria, a complex of rock-hewn churches, chapels, monasteries and cells developed in the vicinity of the village of Ivanovo. This is where the first hermits had dug out their cells and churches during the 12th century. The 14th-century murals testify to the exceptional skill of the artists belonging to the Tarnovo school of painting.</description>
		<link_ru></link_ru>
     		<link_org></link_org>
	</item>

	<item IDsite="5">
		
		<NameSite>Rila Monastery</NameSite>
		<LocalSite>Rila, Kyustendil Province</LocalSite>
		<dateInscription>1983</dateInscription>
		<criteria type="Cultural">vi</criteria>
		<description>Rila Monastery was founded in the 10th century by St John of Rila, a hermit canonized by the Orthodox Church. His ascetic dwelling and tomb became a holy site and were transformed into a monastic complex, which subsequently played an important role in the spiritual and social life of medieval Bulgaria. Destroyed by fire at the beginning of the 19th century, the complex was rebuilt between 1834 and 1862. The monument is a characteristic example of the Bulgarian Renaissance (18th-19th centuries) and symbolizes an awareness of a Slavic cultural identity following centuries of occupation.</description>
		<link_ru></link_ru>
     		<link_org></link_org>
	</item>

	<item IDsite="6">
		
		<NameSite>Ancient City of Nessebar</NameSite>
		<LocalSite>Burgas Province</LocalSite>
		<dateInscription>1983</dateInscription>
		<criteria type="Cultural">iii,iv</criteria>
		<description>Situated on a rocky peninsula on the Black Sea, the more than 3,000-year-old site of Nessebar was originally a Thracian settlement (Menebria). At the beginning of the 6th century B.C., the city became a Greek colony. The city's remains, which date mostly from the Hellenistic period, include the acropolis, a temple of Apollo, an agora and a wall from the Thracian fortifications. Among other monuments, the Stara Mitropolia Basilica and the fortress date from the Middle Ages, when this was one of the most important Byzantine towns on the west coast of the Black Sea. Wooden houses built in the 19th century are typical of the Black Sea architecture of the period.</description>
		<link_ru></link_ru>
     		<link_org></link_org>
	</item>

	<item IDsite="7">
		
		<NameSite>Srebarna Nature Reserve</NameSite>
		<LocalSite>Village of Srebarna, Province of Silistra</LocalSite>
		<dateInscription>1983</dateInscription>
		<criteria type="Natural">iv</criteria>
		<description>The Srebarna Nature Reserve is a freshwater lake adjacent to the Danube and extending over 600 ha. It is the breeding ground of almost 100 species of birds, many of which are rare or endangered. Some 80 other bird species migrate and seek refuge there every winter. Among the most interesting bird species are the Dalmatian pelican, great egret, night heron, purple heron, glossy ibis and white spoonbill.</description>
		<link_ru></link_ru>
     		<link_org></link_org>
	</item>

	<item IDsite="8">
		
		<NameSite>Pirin National Park</NameSite>
		<LocalSite>Pirin Mountain, Blagoevgrad Province</LocalSite>
		<dateInscription>1983</dateInscription>
		<criteria type="Cultural"></criteria>
		<description>Extending over an area of 27,400 ha and lying at an altitude of 1,008-2,914 m in the Pirin mountains, in south-west Bulgaria, Pirin National Park has a limestone Balkan landscape, with lakes, waterfalls, caves and pine forests. The rugged mountains, with some 70 glacial lakes scattered throughout them, are home to hundreds of endemic and rare species, many of which are representative of the Balkan  Pleistocene flora. The mountains also have diverse and unique landscapes of great aesthetic value.</description>
		<link_ru></link_ru>
     		<link_org></link_org>
	</item>

<item IDsite="9">
		
		<NameSite>Thracian Tomb of Sveshtari</NameSite>
		<LocalSite>Thracian Tomb of Sveshtari</LocalSite>
		<dateInscription>1985</dateInscription>
		<criteria type="Cultural">i,iii</criteria>
		<description>Discovered in 1982 near the village of Sveshtari, this 3rd-century B.C. Thracian tomb reflects the fundamental structural principles of Thracian cult buildings. The tomb has a unique architectural decor, with polychrome half-human, half-plant caryatids and painted murals. The 10 female figures carved in high relief on the walls of the central chamber and the decoration of the lunette in its vault are the only examples of this type found so far in the Thracian lands. It is a remarkable reminder of the culture of the Getes, a Thracian people who were in contact with the Hellenistic and Hyperborean worlds, according to ancient geographers.</description>
		<link_ru></link_ru>
     		<link_org></link_org>
	</item>



</country>

<country label="Germany">

		<item IDsite="14">
		
		<NameSite>Collegiate Church, Castle, and Old Town of Quedlinburg</NameSite>
		<LocalSite>State of Saxony-Anhalt</LocalSite>
		<dateInscription>1994</dateInscription>
		<criteria type="Cultural">iv</criteria>
		<description>Quedlinburg, in the Land of Sachsen-Anhalt, was a capital of the East Franconian German Empire at the time of the Saxonian-Ottonian ruling dynasty. It has been a prosperous trading town since the Middle Ages. The number and high quality of the timber-framed buildings make Quedlinburg an exceptional example of a medieval European town. The Collegiate Church of St Servatius is one of the masterpieces of Romanesque architecture.</description> 
		<link_ru></link_ru>
     		<link_org></link_org>
	</item>

		
</country>

</objects_list>



</code>


Последний раз редактировалось etc; 04.06.2007 в 04:13.
Старый 04.06.2007, 00:20
Kaetana вне форума Посмотреть профиль Отправить личное сообщение для Kaetana Найти все сообщения от Kaetana
  № 5  
Kaetana
 
Аватар для Kaetana

Регистрация: Jun 2007
Сообщений: 7
Сразу прошу прощения перед модераторами за выкладку такого количества буковок без должной упаковки, но в архивах оно не аплодится...(

Старый 04.06.2007, 00:26
Kaetana вне форума Посмотреть профиль Отправить личное сообщение для Kaetana Найти все сообщения от Kaetana
  № 6  
Kaetana
 
Аватар для Kaetana

Регистрация: Jun 2007
Сообщений: 7
еще насчет уловок етого бага: вроде как XML -синтаксически правилен, и если вырезать небольшой кусочек из всего XML файла, вставить другой и брать данные из этого другого, то он работает...проблемы начинаются судя по всему, если в цикле for(i=0; i<item_nodes.childNodes.length; i++)
{///switch(...){...}}
перебирается больше 9 <item ...> НО не всегда....
В общем какой-то достаточно подлая ошибуська... не могу найти где....((

Старый 04.06.2007, 00:45
Kaetana вне форума Посмотреть профиль Отправить личное сообщение для Kaetana Найти все сообщения от Kaetana
  № 7  
Kaetana
 
Аватар для Kaetana

Регистрация: Jun 2007
Сообщений: 7
По умолчанию помогите...а?

Комрады, ай нид ёрр квалифайд help!


Последний раз редактировалось Kaetana; 04.06.2007 в 00:57.
Старый 04.06.2007, 04:11
etc вне форума Посмотреть профиль Найти все сообщения от etc
  № 8  
etc
Et cetera
 
Аватар для etc

Регистрация: Sep 2002
Сообщений: 30,787
Kaetana получает плюсы:
0. За флуд;
1. За название темы;
2. За забытые теги для кода.

Три плюса = бан. До свидания.

Создать новую тему Закрытая тема Часовой пояс GMT +4, время: 23:52.
Быстрый переход
  « Предыдущая тема | Следующая тема »  

Ваши права в разделе
Вы не можете создавать новые темы
Вы не можете отвечать в темах
Вы не можете прикреплять вложения
Вы не можете редактировать свои сообщения

BB коды Вкл.
Смайлы Вкл.
[IMG] код Вкл.
HTML код Выкл.


 


Часовой пояс GMT +4, время: 23:52.


Copyright © 1999-2008 Flasher.ru. All rights reserved.
Работает на vBulletin®. Copyright ©2000 - 2026, Jelsoft Enterprises Ltd. Перевод: zCarot
Администрация сайта не несёт ответственности за любую предоставленную посетителями информацию. Подробнее см. Правила.