Posted By

rwitten on 05/09/08


Tagged

list array


Versions (?)

Who likes this?

3 people have marked this snippet as a favorite

Wiederkehr
outbox
THEPWN3R


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.