topical media & game development

talk show tell print

actionscript-video-com-flashconnections-ui-component-mediaPlayer-playlist-PlaylistUtils.ax

actionscript-video-com-flashconnections-ui-component-mediaPlayer-playlist-PlaylistUtils.ax [swf] flex


  
Flash Video for Professionals: MVC Player http://www.flashconnections.com
author: James O'Reilly

  
  package com.flashconnections.ui.component.mediaPlayer.playlist
  {
          import com.flashconnections.core.Core;
          
          public class @ax-actionscript-video-com-flashconnections-ui-component-mediaPlayer-playlist-PlaylistUtils extends Core
          {
                  public static function addUniqueItem(a:Array, o:Object):Number {
                          var n:Number = a.length;
                          for(var i:Number = 0; i < n; i++) if(a[i] == o) return i;
                          a.push(o);
                          return a.length;
                  }
                  public static function removeItem(a:Array, o:Object):Array {
                          var n:Number = a.length;
                          for(var i:Number = 0; i < n; i++) {
                                  if (a[i] == o) {
                                          a.splice(i, 1);
                                          return a;
                                  }
                          }
                          return null;
                  }
                  public static function removeItemAt(a:Array, index:Number):Array {
                          a.splice(index, 1);
                          return a;
                  }
                  public static function replaceItem(a:Array, oldObject:Object, newObject:Object):Number {
                          var n:Number = a.length;
                          for(var i:Number = 0; i < n; i++) if(a[i] == oldObject) a[i] = newObject;
                          return a.length;
                  }
          }
  }


(C) Æliens 27/08/2009

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.