If you want to use a class like this:
MyClass.myMethod(myargs)
Then the myMethod function in MyClass should be defined as static. So instead
of:
public class MotionBlur
{
public static function coordBlur(mc:MovieClip, blurFactor:Number = 1.5)
{
//logic here
}
}
And there is no need for the constructor, since you're not using it in the
class, and the class is meant to have all static members.
Jason Merrill
Bank of America Instructional Technology & Media · GCIB & Staff Support
L&LD
Interested in Flash Platform technologies? Join the Bank of America Flash
Platform Developer Community
Interested in innovative ideas in Learning? Check out the Innovative Learning
Blog and subscribe.
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Sander Schuurman
Sent: Wednesday, January 07, 2009 5:44 AM
To: Flash Coders List
Subject: [Flashcoders] Class syntax question...
Hi cool list,
I want to make a Class that contains MotionBlur methods that I can call like
this: MotionBlur.coordBlur(mc, 1.5);
I have other classes wich I don't initiate and just call static methods from.
The MotionBlur class looks like this:
public class MotionBlur
{
public function MotionBlur()
{
// empty, never initiated
}
public static function coordBlur( mc :MovieClip, blurFactor
:Number = 1.5 ) :void
{
// calculate blur and apply blur setting to mc
}
public static function clearBlur( mc :MovieClip ) :void
{
// clear blur setting on mc
}
}
Ideally I want to use this through TweenMax like this:
TweenMax.from(mc, .4, {
alpha: 0, x: 1500, delay: 2, ease: Back.easeOut,
onUpdate: MotionBlur.coordBlur,
onUpdateParams: [mc, 1.5],
onComplete:
MotionBlur.clearBlur, onCompleteParams: [mc], overwrite: false
} );
But I get the following error: (even if I just call the method outside tweenmax
like this MotionBlur.coordBlur(chick, 2);)
1120: Access of undefined property MotionBlur.
I'm not quit sure what is going wrong here... does anyone see something strange
that I'm totally missing?
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders