Add & Remove to Array


/ Published in: ActionScript 3
Save to your folder(s)



Copy this code and paste it in your HTML
  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


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.