Referencing issue with AS files

Hi all,

I am making a slide show controlled by AS files. Every thing works fine except the Interval function I defined. I am unable to retrieve the values which were defined in Class file.

Here is my code…


class ctrl {
    private var config:Object;
    private var mcl:MovieClipLoader;
    private var Listener:Object;
    private var wvar:Number;
    private var hvar:Number;
    private var count:Number = 2;
    private var total:Number = 14;
    private var inc:Number = 1;
    private var interval;
    function ctrl() {
        var ref = this;
        config = {};
        this.loadConfig();
        mcl = new MovieClipLoader();
        Listener = new Object();
        wvar = config.loader_mc._width;
        hvar = config.loader_mc._height;
        interval = setInterval(slideshow, 1000);
        Listener.onLoadInit = function(t:MovieClip) {
            this = ref;
            t._width = wvar;
            t._height = hvar;
        };
        mcl.addListener(Listener);
        config.n_mc.onRelease = function() {
            this = ref;
            if (count>=total) {
                return;
            }
            count++;
            var path:String = "pics/slide"+count+".jpg";
            mcl.loadClip(path, config.loader_mc);
            config.stat_txt.text = "slide"+count+" of "+total;
        };
        config.p_mc.onRelease = function() {
            this = ref;
            if (count<=1) {
                return;
            }
            count--;
            var path:String = "pics/slide"+count+".jpg";
            mcl.loadClip(path, config.loader_mc);
            config.stat_txt.text = "slide"+count+" of "+total;
        };
    }
    private function loadConfig() {
        for (var cfv in _root) {
            if (_root[cfv] != undefined && _root[cfv]._name) {
                config[cfv] = _root[cfv];
            }
        }
    }
    private function slideshow() {
        if (count == 1 || count == total) {
            inc *= -1;
        }
        trace("function running...");
        count++;
        var path:String = "pics/slide"+count+".jpg";
        mcl.loadClip(path, config.loader_mc);
        config.stat_txt.text = "slide"+count+" of "+total;
    }
}

I made a [COLOR=Red]setInterval [/COLOR]function named [COLOR=Red]slideshow[/COLOR]. But in that function I am unable to retrieve the [COLOR=Red]count, inc, total[/COLOR] variables. I think its a [COLOR=Red]scope [/COLOR][COLOR=Black]i[/COLOR]ssue as it is being used with setInterval function.

Could some one please explains me the way to solve this problem…

Thanks in advance
pandu