Sequence class

I’m trying to create sequence class for my application. My goal is- I’m loading bunch of images (say 15) and I want to display them in 3 sprites (for example red, green & blue). also I want to sort my images as they load and display them in my R/G/B sprites based on some property. I want to create sequence class that will hold my images when they load and when I ask I want it to return next or previous image. but, let’s say I don’t really know what I’m loading, and still want to do what I described… lol
anyway here’s what I made so far. I’m having problems with constructor. I guess I’m not understanding how some things really work.


package classes.common.util {
    
    import flash.utils.Dictionary;

    public class Sequence extends Dictionary {
        private static var sequenceList:Array = new Array();
        
        private var sequenceName:String;
        public function Sequence(object:*) {
            super();
            var items:Array = new Array();
            sequenceName = /*Public.settings[object]..@sprite*/;
            this[sequenceName] = items;
            sequenceList.push(sequenceName);
        }
        private static var currentObject:*;
        public static function sort(object:*):void {
            currentObject = object;
            var sequenceExist:Boolean = Sequence.sequenceList.some(checkName);
            
            if (sequenceExist) {
                Sequence[/*Public.settings[object]..@sprite*/].push(object);
            } else {
                var newSequence:Sequence = new Sequence(object);
                Sequence[/*Public.settings[object]..@sprite*/].push(object);
            }
        }
        private static function checkName(element:*):Boolean {
            return (element == /*Public.settings[currentObject]..@sprite*/);
        }
        // some methods
    }
}

…just ignore things I commented, you can put object.parent.name instead… Whole point of this is to make a class and don’t care about what it does… I just want to take my object call sort method when it loads and when I’m done with it I’ll just call getNext method (deleted from code above) and use next image…


// onLoadComplete handler
function onLoadComplete(event:Event):void {
  var image:Loader = event.currentTarget.loader;
  Sequence.sort(image);
//....
// animate image
  image = Sequence.getNext(image);
}

if I understand corectly this is what’s my constructor suppose to do:


        public function Sequence(object:*) {
// create new instance of class as Dictionary object
            super();
// declare new array
            var items:Array = new Array();
// assign value to String variable
            sequenceName = /*Public.settings[object]..@sprite*/;
// reference that String variable in instance I created with array
            this[sequenceName] = items;
// assign value to another String variable
            sequenceList.push(sequenceName);
        }

but I’m obviously wrong in some steps…