Webservice problem in Flash (Currently As2.0)

[ 2008-06-18 13:19:33 | Author: liuhuan ]
Font Size: Large | Medium | Small
Working with Ford Excitement China website in the past few days, Jimmy and I found a problem when using webservice in flash.

It was once perfect for us to use as2.0 webservice component in flash site. There are 3 different ways for webservice communication:
1. Use Flash Actionscript 2.0 UI component. WebServiceConnector is a nice and convinient component. You can just set the parameters in the component panel and using trigger() function to accomplish the whole process. Very easy way. The only problem is the file is a bit fat.
2. Use code date binding. Still use the WebServiceConnector component but use code to construct new bindings.
3. The most simple way i think, is to use PendingCall, which allows us to specify handlers for success (onResult) and failure (onFault).

However, things changes these days, as we can't get the response via explorer. It's also very strange that sometimes problems occurs in Firefox, some in IE(Or in different versions). The problem is not very clear since now. We suspect this is caused by certain windows pack, or some explorer security strategy.

Anyway, Jimmy has found a way to post webservice using sendAndLoad.
Quote
var ws_lv = new LoadVars();
var xmlresult:XML = new XML();
xmlresult.ignoreWhite = true;

function login() {
  ws_lv.userName = tUsername.text;
  ws_lv.password = tPassword.text;
  ws_lv.onData = function(src) {
    if (src == undefined) {
      trace("loading...");
    } else {
      trace(src);
      xmlresult.parseXML(src);
    }
  };
  ws_lv.sendAndLoad(_global.ServiceUrl+"example.asmx/UserLogin",ws_lv,"post");
}
[Last Modified By liuhuan, at 2008-06-18 13:40:14]
Comments Feed Comments Feed: http://www.liuhuan.com/blog/feed.asp?q=comment&id=879

There is no comment on this article.

You can't post comment on this article.