Well for starters, your fadeObj method defines a parameter which has the
same name as your public variable.
Also, it appears that your onEnterFrame contains a reference to "mc" that
doesn't exist in its scope; perhaps using a Delegate helper would solve
that, or simply change it to "this" since the method belongs to your "mc"
anyway.
Although this could just be a typo, where you're instantiating your class,
you're missing a "(" after the class name.
Hope that helps get you back on track - good luck!
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of CK
Sent: 05 August 2006 23:58
To: Flashcoders mailing list
Subject: [Flashcoders] Class Silent
Hi,
The following class I've coded fails to fade the MC on stage. Could
someone explain why the code fails?
//Class
class FadeAlpha extends MovieClip {
private var alpha:Number = this._alpha;
private var visible:Boolean = this._visible;
public var alphaRate:Number;
public var mc:MovieClip;
//constructor left enpty, can use later.
public function FadeAlpha() {
fadeObj();
}
function fadeObj(mc:MovieClip, alphaRate:Number) {
mc.onEnterFrame = function() {
mc.alpha -= alphaRate;
if (mc.alpha<=0) {
mc._visible = false;
delete mc.onEnterFrame;
}
};
}
}
From AS Timeline:
import FadeAlpha;
var fadeAlpha:FadeAlpha = new FadeAlpha);
img01_mc.fadeAlpha(this, 5);
On Stage:
img1_mc
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com