【永恒的瞬間】
          ?Give me hapy ?
          在MXML的頁面中,使用了http返回參數中沒有定義的變量,并沒有顯示報錯信息,而是顯示了underfined。我用在text的顯示和輸入界面里了,如果用在tree或者其他的變量可能就報錯了。所以還是定義一個函數專門處理返回的參數能夠使程序更健壯吧!


          近在看Flex的groups中發現有一個以前遇到的問題,但是沒有意識到的問題。當我在一個函數中發出httpservice,然后加入一個事件的監聽處理httpservice返回的值,后面如果還有代碼回馬上執行,并不會等處理完httpservice返回再進行。是我的代碼有問題還是Flex本身就是這樣的呢?剛剛看到Group里的一個貼子說在ActionScript中沒有真正意義上的Blocking,用Alert,并且配合shoumodel模式來實現阻止用戶繼續和界面交互。這樣對于我剛剛遇到的問題沒有什么幫助,可以嘗試在處理httpservice返回函數設置返回值,調用函數根據這個返回值進行下一步的操作。

          There is no true blocking in ActionScript. Both alerts and modal pop-ups only
          stop the user from interacting with the UI. All code continues to execute to
          the end.

          To do what you want, you need to have a two part approach, where you call the
          confirmation dialog first, then, when that is dismissed, take the actual action.

          Below is an example using an alert. In my application, is use a modal pop-up
          so that I can have more control.

          Tracy

          <?xml version="1.0" encoding="utf-8"?>

          <mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml">

          <mx:Script><![CDATA[

          ? ? ? ??private function doAction(sAction:String):Void
          ? ? ? ??{
          ? ? ? ??? ? ? ??alert(sAction,
          ? ? ? ??? ? ? ??? ? ? ??? ? ? ??"Confirm Action",
          ? ? ? ??? ? ? ??? ? ? ??? ? ? ??mx.controls.Alert.YES|mx.controls.Alert.NO,
          ? ? ? ??? ? ? ??? ? ? ??? ? ? ??handleConfirm,
          ? ? ? ??? ? ? ??? ? ? ??? ? ? ??mx.controls.Alert.NO)
          ? ? ? ??}//? ? ? ??

          ? ? ? ??private function handleConfirm(oEvent:Object):Void
          ? ? ? ??{
          ? ? ? ??? ? ? ??switch(oEvent.detail)
          ? ? ? ??? ? ? ??{
          ? ? ? ??? ? ? ??? ? ? ??case 1:
          ? ? ? ??? ? ? ??? ? ? ??? ? ? ??alert("The Action was Confirmed")
          ? ? ? ??? ? ? ??? ? ? ??? ? ? ??break;
          ? ? ? ??? ? ? ??? ? ? ??case 2:
          ? ? ? ??? ? ? ??? ? ? ??? ? ? ??alert("The Action was Canceled")
          ? ? ? ??? ? ? ??? ? ? ??? ? ? ??break;
          ? ? ? ??? ? ? ??}//switch()

          ? ? ? ??}//
          ]]></mx:Script>

          ? ? ? ??<mx:Button label="Do Some Action" click="doAction('delete')"/>

          </mx:Application>

          posted on 2007-01-12 16:00 ???MengChuChen 閱讀(222) 評論(0)  編輯  收藏

          只有注冊用戶登錄后才能發表評論。


          網站導航:
           
          主站蜘蛛池模板: 报价| 本溪| 肥西县| 灵台县| 邵阳县| 合山市| 永顺县| 西丰县| 乐都县| 永德县| 朔州市| 孝感市| 安顺市| 石台县| 德州市| 南川市| 小金县| 梅河口市| 岳池县| 雷山县| 石狮市| 山西省| 漠河县| 山丹县| 云和县| 同心县| 福安市| 湟中县| 兴城市| 遵义县| 突泉县| 庄浪县| 正蓝旗| 凤台县| 吉隆县| 金门县| 勐海县| 永胜县| 比如县| 崇信县| 昭觉县|