as2
hey, from outside a class, how do you control a function inside that class?
i want to do something like:
doFunction();
and inside the class MyFancyClassName is the function
public function doFunction() { doTotallyAwesomeStuff(); }
where is that function available? on the root?
classInstance.function()
so according to my above example, would that be:
MyFancyClassName.doFunction();
when i try that, i get this error:
There is no method with the name 'doFunction'.
please excuse my asking what i'm sure are somewhat idiotic questions, i'm not the best actionscripter and just barely venturing into classes.
thanks for the help
As Arsis pointed out - you need to address an instance of the class.
var fancyPants:MyFancyClassName=new MyFancyClassName(); fancyPants.doFunction();
thanks guys
You can do this:
MyFancyClassName.doFunction();
without making a new instance of the class when the class is written as:
class MyFancyClassName { function MyFancyClassName() { } static function get doFunction():Void { trace("ok"); } }
good to know, thanks.
good to see you around.