Diff for "FlashWorkBook" | UserPreferences |
// ¿©±â¼ºÎÅÍ ÇÊ¿äÇÑ ÄÚµå
var kioskdata = _global.kioskdata;
var wsc = kioskdata.wsc;
// Å×½ºÆ® ÄÚµå
kioskdata.GetServiceStatus();
kioskdata.WebServiceResultCallBack(
function()
{
switch(kioskdata.GetWebServiceCallStatus())
{
// ¾ÆÁ÷ ÁøÇàÁß
case 'Progress':
break;
// À¥¼ºñ½º ÀÀ´ä ¾øÀ½
case 'ConnectionFail':
trace('server down');
break;
// °á°ú ¹ÞÀ½
case 'Stop':
trace('results:' + kioskdata.WebServiceResults);
break;
}
}
);
}}}
°ªÀ» °¡Á®¿À´Â ÄÚµå´Â À§Ã³·³ ÁÙ¿©³õ±ä Çߴµ¥, ´öºÐ¿¡ ó¸®ÇÏ´Â Äڵ尡 ¿¶ó ¸¹¾ÆÁ³´Ù.
{{{
// À¥ ¼ºñ½º °ü·Ã ÀÎÀÚ
public var wsc;
private var wsc_callback_interval;
public var WebServiceCallStatus:String = 'Stop';
public var WebServiceResults:String = '';
// wsc(À¥¼ºñ½ºÄ¿³ØÅÍ)ÀÇ status À̺¥Æ®¿¡ È£ÃâµÊ
public function WebServiceOnStatus(code)
{
// ¿¬°á ÀÚü°¡ ºÒ°¡´É!
if(code =='WebServiceFault')
{
WebServiceCallStatus = 'ConnectionFail';
}
trace('WebServiceOnStatus:' + code);
}
// wscÀÇ result À̺¥Æ®¿¡ È£ÃâµÊ
public function WebServiceOnResult(results)
// ¿©±â¼ºÎÅÍ ÇÊ¿äÇÑ ÄÚµå
var kioskdata = _global.kioskdata;
var wsc = kioskdata.wsc;
// Å×½ºÆ® ÄÚµå
kioskdata.GetServiceStatus();
kioskdata.WebServiceResultCallBack(
function()
WebServiceCallStatus = 'Stop';
WebServiceResults = results;
trace('WebServiceOnResult:' + results);
}
// À¥¼ºñ½ºÀÇ ÇöÀç »óŸ¦ üũ
// È£ÃâÀÌ Ã³¸®µÇ°í ÀÖ´Â °æ¿ì ProgressÀÌ°í,
// ±× ÀÌ¿ÜÀÇ °æ¿ì¿£ wsc_callback_intervalÀ» Ŭ¸®¾îÇؼ È£ÃâÀ» ¸ØÃá´Ù.
public function GetWebServiceCallStatus()
{
switch(WebServiceCallStatus)
switch(kioskdata.GetWebServiceCallStatus())
// ¾ÆÁ÷ ÁøÇàÁß
case 'Progress':
break;
trace('server down');
break;
clearInterval(wsc_callback_interval);
wsc_callback_interval = undefined;
trace('results:' + kioskdata.WebServiceResults);
return WebServiceCallStatus;
);
}}}
°ªÀ» °¡Á®¿À´Â ÄÚµå´Â À§Ã³·³ ÁÙ¿©³õ±ä Çߴµ¥, ´öºÐ¿¡ ó¸®ÇÏ´Â Äڵ尡 ¿¶ó ¸¹¾ÆÁ³´Ù.
// ÄݹéÇÔ¼ö ½ÇÇà ´ë¸®ÇÔ¼ö
public function WebServiceResultCallBack(callbackfn)
{{{
// À¥ ¼ºñ½º °ü·Ã ÀÎÀÚ
public var wsc;
private var wsc_callback_interval;
public var WebServiceCallStatus:String = 'Stop';
public var WebServiceResults:String = '';
// wsc(À¥¼ºñ½ºÄ¿³ØÅÍ)ÀÇ status À̺¥Æ®¿¡ È£ÃâµÊ
public function WebServiceOnStatus(code)
{
// ¿¬°á ÀÚü°¡ ºÒ°¡´É!
if(code =='WebServiceFault')
if(undefined==wsc_callback_interval)
wsc_callback_interval = setInterval(callbackfn, 100);
WebServiceCallStatus = 'ConnectionFail';
trace('WebServiceOnStatus:' + code);
}
// À¥ ¼ºñ½º È£Ãâ
private function CallWebService(op, param)
// wscÀÇ result À̺¥Æ®¿¡ È£ÃâµÊ
public function WebServiceOnResult(results)
{
WebServiceCallStatus = 'Stop';
WebServiceResults = results;
trace('WebServiceOnResult:' + results);
}
// À¥¼ºñ½ºÀÇ ÇöÀç »óŸ¦ üũ
// È£ÃâÀÌ Ã³¸®µÇ°í ÀÖ´Â °æ¿ì ProgressÀÌ°í,
// ±× ÀÌ¿ÜÀÇ °æ¿ì¿£ wsc_callback_intervalÀ» Ŭ¸®¾îÇؼ È£ÃâÀ» ¸ØÃá´Ù.
public function GetWebServiceCallStatus()
{
switch(WebServiceCallStatus)
if(WebServiceCallStatus == 'Progress')
{
trace('CallWebService fail - it is progress');
return;
}
WebServiceCallStatus = 'Progress';
wsc.operation = op;
wsc.params = param;
wsc.trigger();
// À¥¼ºñ½º ÀÀ´ä ¾øÀ½
case 'ConnectionFail':
// °á°ú ¹ÞÀ½
case 'Stop':
clearInterval(wsc_callback_interval);
wsc_callback_interval = undefined;
break;
}
return WebServiceCallStatus;
}
// ÄݹéÇÔ¼ö ½ÇÇà ´ë¸®ÇÔ¼ö
public function WebServiceResultCallBack(callbackfn)
{
if(undefined==wsc_callback_interval)
wsc_callback_interval = setInterval(callbackfn, 100);
}
// À¥ ¼ºñ½º È£Ãâ
private function CallWebService(op, param)
{
if(WebServiceCallStatus == 'Progress')
{
trace('CallWebService fail - it is progress');
return;
WebServiceCallStatus = 'Progress';
wsc.operation = op;
wsc.params = param;
wsc.trigger();
}