// vim:syntax=javascript

class BlastMeter extends MovieClip
{
    var last_n : Number;

    function onLoad() {
        last_n = 0;
    }

    function iconName(n : Number) : String {
        return "blast_"+n+"_mc";
    }

    function setBlasts(n : Number) {
        // remove any extras
        for (var i = n; i < last_n; i++) {
            this[iconName(i)].removeMovieClip();
        }

        // add any additional
        for (var i = last_n; i < n; i++) {
            attachMovie("blast_icon", iconName(i), getNextHighestDepth(),
                {_x:5 + i*25, _y:0, _width:20, _height:20});
        }

        last_n = n;
    }
}
