![]() |
|
||||||||||
|
|||||
|
Регистрация: Jan 2006
Сообщений: 15
|
Дано: Flash, использующий часто и много callback-функции. Задача. Реализовать триггер, т.е. гарантировано дождаться результата функции. Тупой цикл не подходит - flash начинает ругаться, что клип собирается повесить машину. Помогите, а то грустно
![]() |
|
|||||
|
ля ля ля ... песенка повеселело?
берёшь переменную какую нить и меняешь её..))
__________________
Best regards, Boris Petrov |
|
|||||
|
вобщем что именно ты подрузомеваешь под тригером???
__________________
Best regards, Boris Petrov |
|
|||||
|
Banned
[+1 16.05.2006]
[++1 16.05.2006] [+ 1 21.05.06] [++ за хамство] [+1 21.05.2006] Регистрация: Dec 2003
Сообщений: 3,925
|
Читать про EventDispatcher и event handlers
|
|
|||||
|
Регистрация: Jan 2006
Сообщений: 15
|
Цитата:
|
|
|||||
|
Banned
[+ 1.1 24.10.2005]
[+ 1.11 27.01.2006] [1.11 28.01.2006] Регистрация: Jul 2005
Сообщений: 107
|
вместо цикла юзай onEnterFrame, либо читай про EventDispatcher
|
|
|||||
|
Цитата:
дочерний процесс при завершении вызывает соответствующий метод родителя или любого другого объекта, внесенного в массив слушателей (_listeners), реализуется методами AsBroadcaster (встроенный объект) или класса EventDispatcher |
|
|||||
|
Регистрация: Jan 2006
Сообщений: 15
|
Класс, наследник mx.services.WebService
/**
* Base Class For Web Service Page
* (c) ...
*
*/
import mx.services.WebService;
class WebServicePage
{
/**
* Current Session Id
*
*/
public static var SID;
/**
* Web Service URL
*
*/
private static var serviceURL;
/**
* Inner CallBack Object For SOAP functions
*
*/
public var callBack:Object = new Object();
/**
* Link to "this" for callback object
*/
public var service:WebServicePage;
/**
* Parent Movie Clip For New Page View
*
*/
var parentMovie:MovieClip;
public function WebServicePage(_parentMovie) {
parentMovie = _parentMovie;
if (!serviceURL) {
if (_root.wsdl) {
serviceURL = _root.wsdl + '?wsdl';
} else {
serviceURL = 'http://127.0.0.1/ig-php/server.php?wsdl';
}
}
this.prototype = new _global.mx.services.WebService(serviceURL);
if (!WebServicePage.SID) {
// Init session trigger
this.accessRemote('init');
}
this.service = this;
}
/**
* Execute SOAP call
*
*/
public function accessRemote(methodName:String, obj:Object)
{
this.callBack = this.prototype[methodName](WebServicePage.SID, obj);
this.callBack.resultFunction = this[methodName add '_onResult'];
this.callBack.statusFunction = this[methodName add '_onFault'];
this.callBack.service = this.service;
if (!this.callBack.statusFunction) {
this.callBack.statusFunction = this['default_onFault'];
}
this.callBack.onResult = function(result){
this.resultFunction(result);
}
this.callBack.onFault = function(status){
this.statusFunction(status);
}
}
/**
* Store Session ID
*
*/
function init_onResult(data)
{
WebServicePage.SID = data;
trace('SessionID = ' add data);
}
function init_onFault(data)
{
WebServicePage.SID = 'fault';
trace('Session fault');
}
function default_onFault(code) {
trace('WEBSERVICE FAULT!');
for(var a in code) {
trace([a,code[a]]);
}
}
/**
* Unserialize SOAP results
*
*/
public function unserialize(data)
{
for (var aNode:XMLNode = data.firstChild; aNode != null; aNode = aNode.nextSibling) {
this[aNode.nodeName] = aNode.firstChild.nodeValue;
}
}
}
Последний раз редактировалось zevvs; 28.01.2006 в 13:38. |
![]() |
![]() |
Часовой пояс GMT +4, время: 14:53. |
|
|
« Предыдущая тема | Следующая тема » |
| Опции темы | |
| Опции просмотра | |
|
|