Classes...again

So I’m back to attempting classes…again. I figured I’d go for something that seemed simple and try to make a pulse class…yes I’m aware there are WAY easier ways to make things pulse, but it’s what I chose.

my problem is that I can’t seem to get it to work. here’s the class so far:


class Pulse extends MovieClip {
    //declare class members
    public var passedMC:MovieClip;
    public var highAlpha:Number;
    public var lowAlpha:Number;
    public var speed:Number;
    private var mySwitch:Number = 1;
    //constructor that takes mc as arguement
    public function Pulse($passedMC:MovieClip, $highAlpha:Number, $lowAlpha:Number, $speed:Number) {
        passedMC = $passedMC;
        highAlpha = $highAlpha;
        lowAlpha = $lowAlpha;
        speed = $speed;
        passedMC._alpha = lowAlpha;
        if (mySwitch == 1) {
            fadeUp(passedMC);
        }
    }
    //fade up function
    private function fadeUp($passedMC) {
        $passedMC._alpha += 5;
    }
    //fade down function
    private function fadeDown($passedMC) {
        $passedMC._alpha -= 5;
    }
}

i’m guessing i need a way to call the onEnterFrame but that seems to return an error. Any help would be appreciated. And if this class isn’t formatted properly or there are better coding principles, please advise.