Показать сообщение отдельно
Старый 20.02.2008, 18:32
Rzer вне форума Посмотреть профиль Отправить личное сообщение для Rzer Посетить домашнюю страницу Rzer Найти все сообщения от Rzer
  № 10  
Ответить с цитированием
Rzer
 
Аватар для Rzer

блогер
Регистрация: Feb 2007
Адрес: Spb
Сообщений: 613
Записей в блоге: 8
Отправить сообщение для Rzer с помощью ICQ
Пытаюсь создать EventDispatcher на сервере и ничего не получается:

Пробую так:

Код:
var a = new flash.events.EventDispatcher ();
var a = new EventDispatcher ();
Или так (как в случае явы):
Код:
var a =  flash.events.EventDispatcher;
var a = EventDispatcher;
Во всех четырех вариантах никакого результата. 2 CrazyFlasher: используете ли Вы на стороне сервера EventDispatcher и, если да, не затруднит ли написать как?

p.s. Пример серверного as3 выладываю. Разве тут что-то есть из as 3 и нет ни тега package и class - куда делать импорт классов?

Код:
/*
* E4X Example based on the  XML Parser Example
* 
* Demonstrates how to use E4X languages inside an actionscript extension
*/
var xmlObj = null

function init()
{
	var xmlData = _server.readFile("sfsExtensions/data/books.xml")
	xmlObj = new XML(xmlData)
	readTheXmlFile()

	var books = xmlObj.bookList.book.(@year == 2003)
	for (var i = 0; i < books.length(); i++)
	{
		trace("Title    : " + books[i].@title)
		trace("Author   : " + books[i].@author)
		trace("-------------------------------------")
	}*/
	
	// Example #2: match a substring in name attribute
	/*
	var books = xmlObj.bookList.book.(@title.toString().indexOf("Java") > -1)

	for (var i = 0; i < books.length(); i++)
	{
		trace("Title    : " + books[i].@title)
		trace("Author   : " + books[i].@author)
		trace("-------------------------------------")
	}
	*/
	
}

/*
* Read and parse the XML file
*/
function readTheXmlFile()
{
	// Show the <collectionName> and <collectionOwner> nodes
	trace("Collection Name: " + xmlObj.collectionName)
	trace("Collection Owner: " + xmlObj.collectionOwner + newline)
	
	var bookList = xmlObj.bookList.book

	for (var i = 0; i < bookList.length(); i++)
	{
		trace("Title    : " + bookList[i].@title)
		trace("Author   : " + bookList[i].@author)
		trace("Year     : " + bookList[i].@year)
		trace("Publisher: " + bookList[i].@publisher)
		trace("-------------------------------------")
	}
}


/*
* This method is called by the server when an extension
* is being removed / destroyed.
* 
* Always make sure to release resources like setInterval(s)
* open files etc in this method.
*
*/
function destroy()
{
	//
}



/*
* 
* Handle Client Requests
* 
* cmd 		= a string with the client command to execute 
* params 	= list of parameters expected from the client
* user 		= the User object representing the sender
* fromRoom 	= the id of the room where the request was generated
* 
*/
function handleRequest(cmd, params, user, fromRoom)
{
	
	//
}


/*
* This method handles internal events
* Internal events are dispactched by the Zone or Room where the extension is attached to
* 
* the (evt) object
*/
function handleInternalEvent(evt)
{
	//
}


Последний раз редактировалось Rzer; 20.02.2008 в 18:41.