Can you tell me why i get undefined in this class?

Hi all!

I have an issue regarding this class, infact its burned up my afternoon. I am developing for a mobile device using actionscript 2.1 but lets just say AS2.0

Please check out the DigitalClock class:

class DigitalClock{
    private var canvas_mc:MovieClip;
    private var text_field:TextField;
    private var text_format:TextFormat;
    public function DigitalClock (mc:MovieClip, x:Number, y:Number)
        canvas_mc = mc;
        canvas_mc._x = x;
        canvas_mc._y = y;
        canvas_mc.createTextField("textfield", 0, 0, 0, 100, 20);
        text_field = canvas_mc.textfield;
        setInterval(setText, 5000, text_field);
    private function setText(textfield:TextField): Void
        var date:Date = new Date();
        var hours:String = parseDate(date.getHours());
        var mins:String = parseDate(date.getMinutes());
        var string:String = hours + ":" + mins;
        textfield.text = string;
    private function parseDate(val:Number):String
        if (val < 10)
            return "0"+val.toString();
            return val.toString();

Basically its a textfield that is created on canvas_mc. The hours and mins are taken from the date object and then formatted to look like 00:00.

I cant seem to get the desired results on the setInterval… it displays “undefined:undefined”. Any ideas why?

Also, i am trying to get used to OOP, please feel free to point out any flaws in this class. Its all a learning curve after all :stuck_out_tongue: