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

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

Версия для печати  Отправить по электронной почте    « Предыдущая тема | Следующая тема »  
Опции темы Опции просмотра
 
Создать новую тему  
Старый 06.03.2009, 21:53
Kalabania вне форума Посмотреть профиль Отправить личное сообщение для Kalabania Найти все сообщения от Kalabania
  № 1  
Ответить с цитированием
Kalabania

Регистрация: Jan 2009
Сообщений: 129
По умолчанию Guestbokk в двух кадрах с разными php и xml файлами

Здравствуйте, есть одна гостевая книга, есть два кадра в каждом кадре одна и та же гостевая книга только с разными ссылками на php и xml файлы тоесть: comments.xml , comments2.xml(куда записываются комментарии), дело в том что когда пишешь комментарии во второй гостевой оно их некоректно записывает в свою базу, а как то отображается в комментах в гостевой в первом кадре.
Код:
var currPage = 0;
var showAmount = 900;			// set this to the amount of entries you want to view at a time
previous._visible = false;
createMessage._visible = false;
createButton.onRelease = function(){
	this._visible = false;
	this._parent.createMessage._visible = true;
	if (createMessage.nameField.text == ""){
		Selection.setFocus(createMessage.nameField);
	}
	else if (createMessage.messageField.text == ""){
		Selection.setFocus(createMessage.messageField);
	}
}

// **** Load XML ****************************
myXML = new XML();
myXML.ignoreWhite = true;
receiverXML = new XML();

myXML.onLoad = function(success){
	myXML.contentType = "text/xml";
	if (success){
		this.showXML();
	}
	else{
		trace("Error loading XML file");
	}
}
myIdentifier=Math.round(Math.random()*10000);
myXML.load("guestbook.xml?uniq="+myIdentifier);

receiverXML.onLoad = function(){
	this.contentType = "text/xml";
	_root.currPage = 0;
	this.showXML();
}
createMessage.closeButton.onRelease = function(){
	this._parent._visible = false;
	createButton._visible = true;
}
createMessage.sendButton.onRelease = function(){
	var myName = this._parent.nameField.text;
	var myMessage = this._parent.messageField.text;
	if (myName == ""){
		this._parent.errorField.text = "Ты забыл имя написать!";
		Selection.setFocus(this._parent.nameField);		
	}
	else if (myMessage == ""){
		this._parent.errorField.text = "А сообщение кто будет писать?";
		Selection.setFocus(this._parent.messageField);
	}
	else {
		myXML.firstChild.appendChild(myXML.createElement("entry"));
		myXML.firstChild.lastChild.attributes.myName = myName;
		myXML.firstChild.lastChild.appendChild(myXML.createElement("myText"));
		myXML.firstChild.lastChild.lastChild.appendChild(myXML.createTextNode(myMessage));
		myXML.sendAndLoad("processXML.php", receiverXML);
		this._parent._visible = false;
		createButton._visible = true;
	}
}
XML.prototype.showXML = function(){
	myGuestbook.scroll = 1;
	myGuestbook.htmlText = "";
	var numItems = this.firstChild.childNodes.length;
	var firstItem = numItems - (currPage*showAmount);		
	if (currPage == 0) previous._visible = false;
	var lastItem = firstItem - showAmount ;
	if (lastItem<=0) {
		lastItem = 0;
		next._visible = false;
	}
	myCount.text = "Total messages: " + numItems;
	if (firstItem == lastItem+1) nowShowing.text = "Showing message " + firstItem;
	else nowShowing.text = "Showing message " + firstItem + " to " + (lastItem + 1);
	for (i=(firstItem-1); i>= lastItem; i--){
		myGuestbook.htmlText += "<B>" + this.firstChild.childNodes[i].attributes.myName + "</B> wrote:\n";
		myGuestbook.htmlText +=  this.firstChild.childNodes[i].firstChild.firstChild.nodeValue + "\n\n";
	}
}
previous.onRelease = function(){	
	currPage--;
	myXML.showXML();
	next._visible = true;
}
next.onRelease = function(){	
	currPage++;
	myXML.showXML();
	previous._visible = true;
}


Последний раз редактировалось Kalabania; 07.03.2009 в 00:41.
Создать новую тему   Часовой пояс GMT +4, время: 08:53.
Быстрый переход
  « Предыдущая тема | Следующая тема »  

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

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


 


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


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