隨筆-75  評論-193  文章-5  trackbacks-0

          事件是實現對象通訊的一個重要手段,對于構建一個靈活的系統(tǒng)來說是非常必要的。在Flash Player 9中,將事件發(fā)送機制內建在了flash.events.EventDispatcher類中。所有需要發(fā)送事件的類都必須繼承EventDispatcher類。
          調用EventDispatcher類中的addEventListener( ) and removeEventListener( )方法,就可以注冊或者移除事件監(jiān)聽器。EventDispatcher中還定義了dispatchEvent()方法,可以使用該方法發(fā)送事件。dispatchEvent()方法至少需要一個參數,即flash.events.Event對象或者它的子類。

          原文如下:
          Events are an important way for objects to communicate. They are essential for creating flexible systems. Flash Player 9, for example, has a built-in event dispatching mechanism in the flash.events.EventDispatcher class. All classes that dispatch events inherit from EventDispatcher (e.g., NetStream and Sprite). If you want to define a class that dispatches events, you can extend EventDispatcher, as follows:

          package {
              import flash.events.EventDispatcher;
              public class Example extends EventDispatcher {

              }
          }


          The EventDispatcher class has public methods called addEventListener( ) and removeEventListener( ) that you can call from any instance of an EventDispatcher subclass to register event listeners. EventDispatcher also defines a protected method called dispatchEvent( ), which you can call from within a subclass to dispatch an event. The dispatchEvent( ) method requires at least one parameter as a flash.events.Event object or a subclass of Event.

          posted on 2007-01-13 15:09 The Matrix 閱讀(466) 評論(0)  編輯  收藏 所屬分類: Flex
          <2007年1月>
          31123456
          78910111213
          14151617181920
          21222324252627
          28293031123
          45678910

          隨筆分類(72)

          隨筆檔案(67)

          文章分類(5)

          搜索

          •  

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 舞钢市| 兰溪市| 岗巴县| 杭锦后旗| 周宁县| 淳化县| 英超| 海盐县| 香格里拉县| 咸阳市| 普洱| 塔河县| 巴东县| 岑溪市| 夹江县| 平舆县| 镇康县| 安福县| 义乌市| 英吉沙县| 任丘市| 佛冈县| 龙口市| 阿勒泰市| 琼结县| 明溪县| 阳泉市| 永宁县| 句容市| 东海县| 阆中市| 旅游| 漳浦县| 罗平县| 拜泉县| 府谷县| 东港市| 将乐县| 桂东县| 雅安市| 崇左市|