0
這是非常基本的,有samples那裏,但我仍然掙扎。如何關閉事件YesNo Alert Box?
我需要用yes/no選項發出警報。
我需要在動作中做到這一點。
Alert.show("Open new tab to search in Google Maps?",
"No places found", Alert.YES | Alert.NO, this, alertListener, null, Alert.NO);
function alertListener(eventObj:CloseEvent):void {
if (eventObj.detail==Alert.YES) {
Alert.show("You clicked yes");
}
}
此方法返回閃存調試播放一個例外:
TypeError: Error #1034: Type Coercion failed: cannot convert mx.rpc::[email protected] to flash.display.Sprite.
at Function/ExampleCustomTools.Locator:locator/private:doFind/ExampleCustomTools.Locator:onResult()[C:\Users\sjackson\Adobe Flash Builder 4\DekhoSimulator_Profiler\src\ExampleCustomTools\Locator\locator.mxml:142]
at mx.rpc::AsyncResponder/result()[E:\dev\hero_private_beta\frameworks\projects\rpc\src\mx\rpc\AsyncResponder.as:95]
at com.esri.ags.tasks::Locator/handleAddressCandidates()[C:\checkout\flex_api2\api\src\com\esri\ags\tasks\Locator.as:187]
at Function/http://adobe.com/AS3/2006/builtin::call()
at com.esri.ags.tasks::BaseTask/handleResult()[C:\checkout\flex_api2\api\src\com\esri\ags\tasks\BaseTask.as:667]
at Function/com.esri.ags.tasks:BaseTask/esri_internal:sendURLVariables2/com.esri.ags.tasks:result()[C:\checkout\flex_api2\api\src\com\esri\ags\tasks\BaseTask.as:604]
at mx.rpc::Responder/result()[E:\dev\hero_private_beta\frameworks\projects\rpc\src\mx\rpc\Responder.as:56]
at mx.rpc::AsyncToken/http://www.adobe.com/2006/flex/mx/internal::applyResult()[E:\dev\hero_private_beta\frameworks\projects\rpc\src\mx\rpc\AsyncToken.as:239]
at mx.rpc.events::ResultEvent/http://www.adobe.com/2006/flex/mx/internal::callTokenResponders()[E:\dev\hero_private_beta\frameworks\projects\rpc\src\mx\rpc\events\ResultEvent.as:207]
at HTTPOperation/http://www.adobe.com/2006/flex/mx/internal::dispatchRpcEvent()[E:\dev\hero_private_beta\frameworks\projects\rpc\src\mx\rpc\http\HTTPService.as:991]
at mx.rpc::AbstractInvoker/http://www.adobe.com/2006/flex/mx/internal::resultHandler()[E:\dev\hero_private_beta\frameworks\projects\rpc\src\mx\rpc\AbstractInvoker.as:318]
at mx.rpc::Responder/result()[E:\dev\hero_private_beta\frameworks\projects\rpc\src\mx\rpc\Responder.as:56]
at mx.rpc::AsyncRequest/acknowledge()[E:\dev\hero_private_beta\frameworks\projects\rpc\src\mx\rpc\AsyncRequest.as:84]
at DirectHTTPMessageResponder/completeHandler()[E:\dev\hero_private_beta\frameworks\projects\rpc\src\mx\messaging\channels\DirectHTTPChannel.as:451]
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at flash.net::URLLoader/onComplete()
我已經嘗試了代碼的幾個變化,但仍然出現錯誤。 道歉爲這樣一個微不足道的Q,但感謝任何幫助指出最新的錯誤和最優雅的方式做到這一點。
Here is the code in its fuller context at pastebin (line 31).
完成。我是編程新手 - 如果我經歷過,它會在警戒線上跌倒,所以我認爲這是原因?我會做一些閱讀,瞭解爲什麼它努力轉換AsyncResponder。 – Simon
請顯示locator.mxml的代碼 –
錯誤不在警報中。該錯誤與類型轉換有關。請檢查BaseTask.as文件中的「結果事件」。 –