We Recommend

Essential ActionScript 3.0 Essential ActionScript 3.0
The book focuses on the core language and object-oriented programming, but also adds a deep look at the centerpiece of Flash Player's new API: display programming. Enjoy hundreds of brand new pages covering exciting new language features, such as the DOM-based event architecture, E4X, and namespaces--all brimming with real-world sample code.


Ballyhoo


Posted By

rwitten on 05/09/08


Tagged

list array


Versions (?)


Who likes this?

1 person has marked this snippet as a favorite

Wiederkehr


Add & Remove to Array


Published in: ActionScript 3 


  1. /** Adds a responder to an Array of responders. */
  2. public function addResponder(responder:IResponder):void {
  3. if(responder == null) return;
  4. for each(var responderInList:IResponder in _responders) {
  5. if(responderInList == responder) return;
  6. }
  7. _responders.push(responder);
  8. }
  9.  
  10. /** Removes a responder from an Array of responders. */
  11. public function removeResponder(responder:IResponder):void {
  12. if(responder == null) return;
  13. for(var i:int=0; i < _responders.length; i++) {
  14. if(_responders[i] == responder) {
  15. _responders = _responders.splice(i, 1);
  16. }
  17. }
  18. }

Report this snippet 

You need to login to post a comment.