什么,我基本上希望做的是改变输出实例的名称。AS3:函数和变量
但我的问题是如何发送传递思想的功能“find_name”到“Event.Complete”功能loadNameInfo变量?
下面的代码:
// Finds a persons name using the ID
private function find_name(page_Name='search.php',instance_name='name',get1='g1=1',get2='g2=2',get3='g3=3'):void
{
var randomParam:String = "?p=" + Math.floor(Math.random() * (10000000));
var create_URL = (URL + page_Name + randomParam + '&'+ get1 + '&' + get2 + '&' + get3);
_loader = new URLLoader();
_request = new URLRequest(create_URL);
_request.method = URLRequestMethod.POST;
_loader.addEventListener(Event.COMPLETE, loadNameInfo);
_loader.load(_request);
}
// Loads the name into the correct place
public function loadNameInfo(e:Event)
{
instance_name.text = e.target.data;
}
这是有点事可能吗?
礼
要使用自定义事件,你需要编写自定义的URLLoader类:) – skozin 2012-04-21 01:57:14
扩展URLLoader不是困难,有一个thousund例子在那里像http://www.mikechambers.com/blog/2008/09/ 12/urlloader-subclass-with-automatic-refresh-support /。我不说这是最好的解决方案,但工作和优雅。 – rcdmk 2012-04-21 02:01:41
无论如何,该链接有4种解决方案供您选择。 – rcdmk 2012-04-21 02:03:10