actionscript ?
- Started
- Last post
- 4 Responses
- fourtenlabs
i know you used to be able to add a prototype to a class like movieClip to give it new methods. is there a different way to do that in as2.0 now?
- dijitaq0
class
??
- fourtenlabs0
yeah. i already have a class written i just wanted to see if there was a way i could call it as movieClip_mc.someMethod(); as opposed to someObject.someMethod();
- dijitaq0
misunderstood your question.
myMC.prototype = new MovieClip();
myMC.prototype.myMethod = function() {
};??
- unfittoprint0
you can't.
you can however create a class that extends Movieclip:
//in your library folder create a MovieClip.as
class MovieClip2 extends MovieClip {
//constructor
function MovieClip2 (){
}//methods
static public method1(){}
static public method2(){}}
//usage
MovieClip2.method1();remember to add your library folder in Flash's actionscript preferences.
believe me, the new OOP syntax is much more powerful, one central library for all your code, that will grow from each project and allow you to deploy code 1000x faster than before...
essential book:
http://moock.org/eas2/