我有2個文件,我的應用程序和一個自定義組件。 在我的組件中,我有一個httpservice
和一個名爲_requestUrl
的可綁定的字符串。 httpservice
使用此。將參數傳遞給flex中的組件
<mx:HTTPService id="srv"
url="{_requestUrl}"
result="parseHttpResult(event)"
resultFormat="xml"
method="GET"
useProxy="false">
在我的應用程序文件,使我的在onCreationComplete
功能組件的實例。
在此功能中,如果我說
mycomponent._urlRequest ="http://example.com"
的httpservice
拋出一個null url error
但如果我說mycomponent.srv.url="http://example.com"
它工作正常。
這是爲什麼?
編輯:
<mx:Script>
import mx.events.FlexEvent;
import components.custom
private var comp:custom= new custom()
private var comp:custom= new custom()
public function setVars(event:FlexEvent):void
{
comp._requestUrl = "http://example.com"
comp.setVars(event)
pform.addChild(comp)
}
//creationComplete="setVars(event)"
</mx:Script>
我不明白?我在嘗試設置字符串之前創建組件?我編輯了我的問題。 它不是一個巨大的交易或任何東西....我的應用作品。它只會bug我,如果我不知道:) – dubbeat 2010-04-20 12:13:47
我希望我的解釋現在對你有用。 – 2010-04-20 18:29:31
太好了。非常感激! – dubbeat 2010-04-22 12:48:10