newsfeed_class.as

来自「这是《Flash MX编程与创意实现》的源代码」· AS 代码 · 共 39 行

AS
39
字号
/*
  NewsFeed Class 
  Oct. 29, 2002
  (c) 2002 Robert Penner
  
  This is a simple custom event source object, used to demonstrate
  event broadcasting with ASBroadcaster and listeners.
  A NewsFeed instance can subscribe multiple objects to itself
  and send news items to them.
  
  Dependencies: ASBroadcaster (undocumented feature of Flash MX)
  
  Discussed in Chapter 6 of 
  Robert Penner's Programming Macromedia Flash MX
  
  http://www.robertpenner.com/profmx
  http://www.amazon.com/exec/obidos/ASIN/0072223561/robertpennerc-20
*/


_global.NewsFeed = function (name) {
    this.name = name;
    this._listeners = new Array();
};

ASBroadcaster.initialize (NewsFeed.prototype);

NewsFeed.prototype.toString = function () {
    return this.name;
};

NewsFeed.prototype.sendNews = function (headline, summary, url) {
    this.broadcastMessage ("onNews", this, headline, summary, url);
};




⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?