Flash Prototype functions..
- Started
- Last post
- 11 Responses
- sauerbraten
so i have say the following on _level0:
Movieclip.prototype.myBuddy = function() {
trace("dammit");
}i'm having trouble accessing this function from say _level1 ..
anybody know some syntax for me?
tanks.
- Anarchitect0
a movieclip prototype is inherited only by movicelips [including the _root] not levels.
mc.myBuddy();
_root.myBuddy();
myMc.innerMC.myBuddy();
etc...
- ********0
yeah I sorta' had this problem yesterday
- tomkat0
ahaaa..
*scratches chin
- sauerbraten0
well, i have no problem putting the function on the _root say on _level1 and calling it from an MC that's like embedded 4 levels in MCs on the root..
- Anarchitect0
in Object Oriented Programming it's a good idea to deal directly with err.. objects [sounds, movieclips, date, xml's, etc...] instead of levels.
- highrise0
npt really paying attention but....
i had the issue yesterday where I had a prototype defined on _level0 and when I applied to movieclips in _level20 the _root for that movieclip was defined as _level0 even though the movieclip was in _level20? in the end I used this._root
huh?
- cinder0
this.myBuddy();
- sauerbraten0
this.myBigWhiteAss();
- unfittoprint0
a prototype should be location independent. When relating to inner variables, inner function and inner objects use always this.etc... when making the protoype.
- sauerbraten0
heh, yeah, it's working fine.. strategically placed 'this's..
i love prototype functions. wee!
switch statements are neat too.
- cinder0
I just did it.
worked for me