Brandan Hall wrote the PriorityQueue (pQueue) class in “Object Oriented Programming with ActionScript” published by New Riders. I’ve converted that class to ActionScript 2 which you may download from here.